/** * @param databaseName * @param tableName * @return */ public boolean isCappedCollection(String databaseName, String tableName) { List<Schema> schemas = getDataStore() != null ? getDataStore().getSchemas() : null; if (schemas != null) { for (Schema schema : schemas) { if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName)) { for (Table table : schema.getTables()) { if (table.getProperties() != null && tableName.equals(table.getName())) { return Boolean.parseBoolean(table.getProperties().getProperty(MongoDBConstants.CAPPED)); } } } } } return false; }
public Schema getSchema(String schemaName) { DataStore dataStore = getDataStore(dataStoreName); if (dataStore != null) { List<Schema> schemas = dataStore.getSchemas(); if (schemas != null && !schemas.isEmpty()) { for (Schema s : schemas) { if (s != null && s.getName() != null && s.getName().equalsIgnoreCase(schemaName)) { return s; } } } } return null; }
public boolean isInvertedIndexingEnabled(String schemaName) { DataStore dataStore = getDataStore(dataStoreName); boolean result = false; if (schemaName != null && dataStore != null && dataStore.getSchemas() != null) { for (Schema schema : dataStore.getSchemas()) { if (schema != null && schemaName.equals(schema.getName()) && schema.getSchemaProperties() != null && schema.getSchemaProperties() != null) { result = Boolean.parseBoolean((String) schema.getSchemaProperties().get( CassandraConstants.INVERTED_INDEXING_ENABLED)); break; } } } return result; }
/** * Sets the properties. * * @param ksDef * the ks def * @param strategy_options * the strategy_options */ private void setProperties(KsDef ksDef, Map<String, String> strategy_options) { Schema schema = CassandraPropertyReader.csmd.getSchema(databaseName); if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName) && schema.getSchemaProperties() != null) { setKeyspaceProperties(ksDef, schema.getSchemaProperties(), strategy_options, schema.getDataCenters()); } else { setDefaultReplicationFactor(strategy_options); } }
Assert.assertEquals("KunderaHbaseXmlTest", store.getSchemas().get(0).getName()); Assert.assertNotNull(store.getSchemas().get(0).getTables()); Assert.assertEquals(1, store.getSchemas().get(0).getTables().size()); Assert.assertEquals("KunderaCassandraXmlTest", store.getSchemas().get(0).getName()); Assert.assertNotNull(store.getSchemas().get(0).getTables()); Assert.assertEquals(2, store.getSchemas().get(0).getTables().size());
/** * @param databaseName * @param tableName * @return */ public boolean isCappedCollection(String databaseName, String tableName) { List<Schema> schemas = getDataStore() != null ? getDataStore().getSchemas() : null; if (schemas != null) { for (Schema schema : schemas) { if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName)) { for (Table table : schema.getTables()) { if (table.getProperties() != null && tableName.equals(table.getName())) { return Boolean.parseBoolean(table.getProperties().getProperty(MongoDBConstants.CAPPED)); } } } } } return false; }
/** * Read external properties. */ private void readExternalProperties() { schemas = HBasePropertyReader.hsmd.getDataStore() != null ? HBasePropertyReader.hsmd.getDataStore() .getSchemas() : null; List<Table> tables = null; if (schemas != null && !schemas.isEmpty()) { for (Schema s : schemas) { if (s.getName() != null && s.getName().equalsIgnoreCase(databaseName)) { tables = s.getTables(); } } } if (tables != null && !tables.isEmpty()) { for (Table table : tables) { externalProperties.put(HBaseUtils.getHTableName(databaseName, table.getName()), table.getProperties()); } } }
/** * Sets the properties. * * @param ksDef * the ks def * @param strategy_options * the strategy_options */ private void setProperties(KsDef ksDef, Map<String, String> strategy_options) { Schema schema = CassandraPropertyReader.csmd.getSchema(databaseName); if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName) && schema.getSchemaProperties() != null) { setKeyspaceProperties(ksDef, schema.getSchemaProperties(), strategy_options, schema.getDataCenters()); } else { setDefaultReplicationFactor(strategy_options); } }
public Schema getSchema(String schemaName) { DataStore dataStore = getDataStore(dataStoreName); if (dataStore != null) { List<Schema> schemas = dataStore.getSchemas(); if (schemas != null && !schemas.isEmpty()) { for (Schema s : schemas) { if (s != null && s.getName() != null && s.getName().equalsIgnoreCase(schemaName)) { return s; } } } } return null; }
public boolean isInvertedIndexingEnabled(String schemaName) { DataStore dataStore = getDataStore(dataStoreName); boolean result = false; if (schemaName != null && dataStore != null && dataStore.getSchemas() != null) { for (Schema schema : dataStore.getSchemas()) { if (schema != null && schemaName.equals(schema.getName()) && schema.getSchemaProperties() != null && schema.getSchemaProperties() != null) { result = Boolean.parseBoolean((String) schema.getSchemaProperties().get( CassandraConstants.INVERTED_INDEXING_ENABLED)); break; } } } return result; }