if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName) && schema.getSchemaProperties() != null) Properties schemaProperties = schema.getSchemaProperties(); if (placement_strategy.equalsIgnoreCase(SimpleStrategy.class.getSimpleName()) || placement_strategy.equalsIgnoreCase(SimpleStrategy.class.getName())) if (schema.getDataCenters() != null && !schema.getDataCenters().isEmpty()) for (DataCenter dc : schema.getDataCenters())
if (s.getName() != null && s.getName().equalsIgnoreCase(databaseName)) tableProperties = s.getSchemaProperties(); tables = s.getTables();
if (s.getName() != null && s.getName().equalsIgnoreCase(databaseName)) tableProperties = s.getSchemaProperties(); tables = s.getTables();
/** * @param tableInfo * @return CfDef object */ private CfDef getTableMetadata(TableInfo tableInfo) { CfDef cfDef = new CfDef(); cfDef.setKeyspace(databaseName); cfDef.setName(tableInfo.getTableName()); cfDef.setKey_validation_class(CassandraValidationClassMapper.getValidationClass(tableInfo.getTableIdType(), isCql3Enabled(tableInfo))); Schema schema = CassandraPropertyReader.csmd.getSchema(databaseName); tables = schema != null ? schema.getTables() : null; Properties cFProperties = getColumnFamilyProperties(tableInfo); String defaultValidationClass = null; if (tableInfo.getType() != null && tableInfo.getType().equals(Type.SUPER_COLUMN_FAMILY.name())) { getSuperColumnFamilyMetadata(tableInfo, cfDef, defaultValidationClass); } else if (tableInfo.getType() != null) { getColumnFamilyMetadata(tableInfo, cfDef, cFProperties); } setColumnFamilyProperties(cfDef, cFProperties, null); return cfDef; }
public Table getColumnFamily(String schemaName, String cfName) { Schema schema = getSchema(schemaName); if (schema != null) { if (schema.getTables() != null) { for (Table table : schema.getTables()) { if (table != null && table.getName() != null && table.getName().equalsIgnoreCase(cfName)) { return table; } } if (logger.isWarnEnabled()) { logger.warn("No column family schema found, returning null."); } } } return null; }
/** * @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; }
/** * @return the placement_strategy */ public String getPlacement_strategy(String schemaName) { Schema schema = getSchema(schemaName); String placementStrategy = SimpleStrategy.class.getName(); if (schema != null && schema.getSchemaProperties() != null && !schema.getSchemaProperties().isEmpty()) { placementStrategy = schema.getSchemaProperties().getProperty(CassandraConstants.PLACEMENT_STRATEGY) ; } if (logger.isInfoEnabled()) { logger.info("Returning placement strategy value {}", placementStrategy); } return placementStrategy; }
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); } }
/** * @return the replication_factor */ public String getReplication_factor(String schemaName) { Schema schema = getSchema(schemaName); String replication = "1"; if (schema != null && schema.getSchemaProperties() != null && !schema.getSchemaProperties().isEmpty()) { replication = schema.getSchemaProperties().getProperty(CassandraConstants.REPLICATION_FACTOR); } if (logger.isInfoEnabled()) { logger.info("Returning replication factor value {}", replication); } return replication; }
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("HBASEUSERXYZ", store.getSchemas().get(0).getTables().get(0).getName()); Assert.assertNotNull(store.getSchemas().get(0).getTables().get(0).getProperties()); Assert.assertEquals(5, store.getSchemas().get(0).getTables().get(0).getProperties().size()); Assert.assertNull(store.getSchemas().get(0).getDataCenters()); Assert.assertNull(store.getSchemas().get(0).getSchemaProperties()); Assert.assertNotNull(store.getConnection()); Assert.assertNotNull(store.getConnection().getProperties()); Assert.assertEquals("KunderaCassandraXmlTest", store.getSchemas().get(0).getName()); Assert.assertNotNull(store.getSchemas().get(0).getTables()); Assert.assertEquals(2, store.getSchemas().get(0).getTables().size()); Assert.assertEquals("CASSANDRAUSERXYZ", store.getSchemas().get(0).getTables().get(0).getName()); Assert.assertNotNull(store.getSchemas().get(0).getTables().get(0).getProperties()); Assert.assertEquals(7, store.getSchemas().get(0).getTables().get(0).getProperties().size()); Assert.assertNotNull(store.getSchemas().get(0).getDataCenters()); Assert.assertEquals(2, store.getSchemas().get(0).getDataCenters().size()); Assert.assertNotNull(store.getSchemas().get(0).getSchemaProperties()); Assert.assertEquals(3, store.getSchemas().get(0).getSchemaProperties().size());
if (s.getName() != null && s.getName().equalsIgnoreCase(databaseName)) tableProperties = s.getSchemaProperties(); tables = s.getTables();