本文整理汇总了Java中me.prettyprint.cassandra.model.BasicColumnDefinition类的典型用法代码示例。如果您正苦于以下问题:Java BasicColumnDefinition类的具体用法?Java BasicColumnDefinition怎么用?Java BasicColumnDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BasicColumnDefinition类属于me.prettyprint.cassandra.model包,在下文中一共展示了BasicColumnDefinition类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createKeyspace
import me.prettyprint.cassandra.model.BasicColumnDefinition; //导入依赖的package包/类
/** Creates the keyspace. */
private void createKeyspace(Cluster cluster) {
ColumnFamilyDefinition cfDef = HFactory.createColumnFamilyDefinition(
KEYSPACE_NAME, COLUMN_FAMILY_NAME, ComparatorType.BYTESTYPE);
cfDef.setGcGraceSeconds(1);
cfDef.setCompactionStrategy("LeveledCompactionStrategy");
BasicColumnDefinition column = new BasicColumnDefinition();
column.setName(StringSerializer.get().toByteBuffer(COLUMN_NAME));
column.setValidationClass(ComparatorType.BYTESTYPE.getClassName());
cfDef.addColumnDefinition(column);
KeyspaceDefinition newKeyspace = HFactory.createKeyspaceDefinition(
KEYSPACE_NAME, ThriftKsDef.DEF_STRATEGY_CLASS, 1,
Arrays.asList(cfDef));
cluster.addKeyspace(newKeyspace, true);
}
开发者ID:vimaier,项目名称:conqat,代码行数:18,代码来源:CassandraStorageSystem.java
示例2: createLinksTable
import me.prettyprint.cassandra.model.BasicColumnDefinition; //导入依赖的package包/类
private static void createLinksTable() {
// column family l
final String CF_LINKS = "l";
final String QF_URL = "u";
ColumnFamilyDefinition cfLinks = HFactory.createColumnFamilyDefinition(
LINKS, CF_LINKS, ComparatorType.UTF8TYPE);
cfLinks.setKeyValidationClass(ComparatorType.UTF8TYPE.getTypeName());
List<ColumnDefinition> linksMetaData = new ArrayList<ColumnDefinition>();
BasicColumnDefinition twLinks = new BasicColumnDefinition();
twLinks.setName(StringSerializer.get().toByteBuffer(QF_URL));
twLinks.setValidationClass(ComparatorType.UTF8TYPE.getClassName());
linksMetaData.add(twLinks);
cfLinks.addColumnDefinition(twLinks);
List<ColumnFamilyDefinition> cfDefs = new ArrayList<ColumnFamilyDefinition>();
cfDefs.add(cfLinks);
KeyspaceDefinition linksDef = HFactory.createKeyspaceDefinition(LINKS,
SIMPLESTRATEGY, replFactor, cfDefs);
cluster.addKeyspace(linksDef);
}
开发者ID:mvogiatzis,项目名称:storm-unshortening,代码行数:26,代码来源:Schema.java
示例3: createCDef
import me.prettyprint.cassandra.model.BasicColumnDefinition; //导入依赖的package包/类
/**
* Creates a column family definition.
*
* @param colName the column family name.
* @param validationClass the validation class.
* @param indexName the index name.
* @return the column family definition.
*/
protected ColumnDefinition createCDef(
final byte[] colName,
final String validationClass,
final String indexName) {
final BasicColumnDefinition colDef = new BasicColumnDefinition();
colDef.setName(ByteBuffer.wrap(colName));
colDef.setValidationClass(validationClass);
colDef.setIndexType(ColumnIndexType.KEYS);
colDef.setIndexName(indexName);
return colDef;
}
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:21,代码来源:Cassandra12xTripleIndexDAO.java
示例4: createRequiredSchemaEntities
import me.prettyprint.cassandra.model.BasicColumnDefinition; //导入依赖的package包/类
@Override
public void createRequiredSchemaEntities() throws DataAccessLayerException {
final String keyspace_name = _keyspace.getKeyspaceName();
final KeyspaceDefinition ksdef = _factory.getCluster().describeKeyspace(keyspace_name);
if (!hasColumnFamily(ksdef, _cf_name)) {
final ColumnFamilyDefinition cfDef = HFactory.createColumnFamilyDefinition(keyspace_name, _cf_name);
final Map<String, String> compressionOptions = new HashMap<String, String>();
compressionOptions.put("sstable_compression", "SnappyCompressor");
cfDef.setCompressionOptions(compressionOptions);
cfDef.setColumnType(ColumnType.STANDARD);
cfDef.setKeyValidationClass(ComparatorType.BYTESTYPE.getClassName());
cfDef.setDefaultValidationClass(ComparatorType.BYTESTYPE.getClassName());
cfDef.setCompactionStrategy("LeveledCompactionStrategy");
if (_isBidirectional) {
BasicColumnDefinition colDef = new BasicColumnDefinition();
colDef.setName(BytesArraySerializer.get().toByteBuffer(COLUMN_NAME));
colDef.setValidationClass(ComparatorType.BYTESTYPE.getClassName());
colDef.setIndexType(ColumnIndexType.KEYS);
colDef.setIndexName(_cf_name + "_val_idx");
cfDef.addColumnDefinition(colDef);
}
_factory.getCluster().addColumnFamily(new ThriftCfDef(cfDef), true);
}
}
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:32,代码来源:Cassandra12xMapDAO.java
示例5: createTweetsTable
import me.prettyprint.cassandra.model.BasicColumnDefinition; //导入依赖的package包/类
private static void createTweetsTable() {
final String QF_ID = "id";
// Column Family tweets
final String CF_TWEET = "t";
final String QF_TEXT = "txt";
ColumnFamilyDefinition cfTweet = HFactory.createColumnFamilyDefinition(
TWEETS, CF_TWEET, ComparatorType.UTF8TYPE);
cfTweet.setKeyValidationClass(ComparatorType.LONGTYPE.getTypeName());
List<ColumnDefinition> tweetMetaData = new ArrayList<ColumnDefinition>();
BasicColumnDefinition t_txt = new BasicColumnDefinition();
t_txt.setName(StringSerializer.get().toByteBuffer(QF_TEXT));
t_txt.setValidationClass(ComparatorType.UTF8TYPE.getClassName());
tweetMetaData.add(t_txt);
cfTweet.addColumnDefinition(t_txt);
List<ColumnFamilyDefinition> cfDefs = new ArrayList<ColumnFamilyDefinition>();
cfDefs.add(cfTweet);
KeyspaceDefinition tweetsDef = HFactory.createKeyspaceDefinition(
TWEETS, SIMPLESTRATEGY, replFactor, cfDefs);
cluster.addKeyspace(tweetsDef);
}
开发者ID:mvogiatzis,项目名称:storm-unshortening,代码行数:29,代码来源:Schema.java
示例6: createSchema
import me.prettyprint.cassandra.model.BasicColumnDefinition; //导入依赖的package包/类
private void createSchema() {
// ColumnFamily 1
BasicColumnDefinition columnDefinition1_1 = new BasicColumnDefinition();
columnDefinition1_1.setName(stringSerializer.toByteBuffer("name"));
columnDefinition1_1.setValidationClass(ComparatorType.LONGTYPE.getClassName());
BasicColumnDefinition columnDefinition1_2 = new BasicColumnDefinition();
columnDefinition1_2.setName(stringSerializer.toByteBuffer("column_A_B"));
columnDefinition1_2.setValidationClass(ComparatorType.UTF8TYPE.getClassName());
BasicColumnFamilyDefinition columnFamilyDefinition1 = new BasicColumnFamilyDefinition();
columnFamilyDefinition1.setKeyspaceName(KEYSPACE_NAME);
columnFamilyDefinition1.setName(COLUMN_FAMILY_NAME_1);
columnFamilyDefinition1.addColumnDefinition(columnDefinition1_1);
columnFamilyDefinition1.addColumnDefinition(columnDefinition1_2);
ColumnFamilyDefinition cfDef1 = new ThriftCfDef(columnFamilyDefinition1);
// ColumnFamily 2
BasicColumnDefinition columnDefinitionIndexed1 = new BasicColumnDefinition();
columnDefinitionIndexed1.setName(stringSerializer.toByteBuffer("column_test_1"));
columnDefinitionIndexed1.setIndexType(ColumnIndexType.KEYS);
columnDefinitionIndexed1.setIndexName("INDEX_COLUMN_TEST_1");
columnDefinitionIndexed1.setValidationClass(ComparatorType.UTF8TYPE.getClassName());
BasicColumnDefinition columnDefinitionIndexed2 = new BasicColumnDefinition();
columnDefinitionIndexed2.setName(stringSerializer.toByteBuffer("birthdate"));
columnDefinitionIndexed2.setIndexType(ColumnIndexType.KEYS);
columnDefinitionIndexed2.setIndexName("INDEX_BIRTH_DATE");
columnDefinitionIndexed2.setValidationClass(ComparatorType.LONGTYPE.getClassName());
BasicColumnFamilyDefinition columnFamilyDefinitionIndexed = new BasicColumnFamilyDefinition();
columnFamilyDefinitionIndexed.setKeyspaceName(KEYSPACE_NAME);
columnFamilyDefinitionIndexed.setName(COLUMN_FAMILY_INDEXED_1);
columnFamilyDefinitionIndexed.addColumnDefinition(columnDefinitionIndexed1);
columnFamilyDefinitionIndexed.addColumnDefinition(columnDefinitionIndexed2);
ColumnFamilyDefinition cfDef2 = new ThriftCfDef(columnFamilyDefinitionIndexed);
// ColumnFamilySuper
BasicColumnDefinition columnDefinitionSuper1 = new BasicColumnDefinition();
columnDefinitionSuper1.setName(stringSerializer.toByteBuffer("Super_Column_1"));
columnDefinitionSuper1.setValidationClass(ComparatorType.UTF8TYPE.getClassName());
BasicColumnFamilyDefinition columnFamilyDefinitionSuper2 = new BasicColumnFamilyDefinition();
columnFamilyDefinitionSuper2.setKeyspaceName(KEYSPACE_NAME);
columnFamilyDefinitionSuper2.setName(COLUMN_FAMILY_SUPER_1);
columnFamilyDefinitionSuper2.setColumnType(ColumnType.SUPER);
columnFamilyDefinitionSuper2.addColumnDefinition(columnDefinitionSuper1);
ColumnFamilyDefinition cfDefSuper = new ThriftCfDef(columnFamilyDefinitionSuper2);
KeyspaceDefinition keyspaceDefinition = HFactory.createKeyspaceDefinition(KEYSPACE_NAME,
SimpleStrategy.class.getName(), 1, Arrays.asList(cfDef1, cfDef2, cfDefSuper));
cluster.addKeyspace(keyspaceDefinition, true);
// cluster.updateKeyspace(keyspaceDefinition);
}
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:64,代码来源:HectorCassandraTest.java
注:本文中的me.prettyprint.cassandra.model.BasicColumnDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论