当前位置: 首页>>代码示例>>Java>>正文


Java BasicColumnFamilyDefinition.setColumnType方法代码示例

本文整理汇总了Java中me.prettyprint.cassandra.model.BasicColumnFamilyDefinition.setColumnType方法的典型用法代码示例。如果您正苦于以下问题:Java BasicColumnFamilyDefinition.setColumnType方法的具体用法?Java BasicColumnFamilyDefinition.setColumnType怎么用?Java BasicColumnFamilyDefinition.setColumnType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在me.prettyprint.cassandra.model.BasicColumnFamilyDefinition的用法示例。


在下文中一共展示了BasicColumnFamilyDefinition.setColumnType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCF_SP_Ox

import me.prettyprint.cassandra.model.BasicColumnFamilyDefinition; //导入方法依赖的package包/类
/**
 * Creates SPO? column family.
 * 
 * @param cfName the column family name.
 * @return the SPO? column family definition.
 */
protected ColumnFamilyDefinition createCF_SP_Ox(final String cfName) {
	final BasicColumnFamilyDefinition cfdef = new BasicColumnFamilyDefinition();
	cfdef.setKeyspaceName(_dataAccessLayerFactory.getKeyspaceName()); 
	cfdef.setName(cfName);
	cfdef.setColumnType(ColumnType.STANDARD);
	cfdef.setComparatorType(ComparatorType.getByClassName("org.apache.cassandra.db.marshal.DoubleType"));
	cfdef.setCompactionStrategy("LeveledCompactionStrategy");

	cfdef.setKeyValidationClass(ComparatorType.BYTESTYPE.getClassName());
	cfdef.setDefaultValidationClass(ComparatorType.BYTESTYPE.getClassName());

	cfdef.setCompressionOptions(_compressionOptions);
	return new ThriftCfDef(cfdef);
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:21,代码来源:Cassandra12xTripleIndexDAO.java

示例2: createSchema

import me.prettyprint.cassandra.model.BasicColumnFamilyDefinition; //导入方法依赖的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.BasicColumnFamilyDefinition.setColumnType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。