• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ColumnType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中me.prettyprint.hector.api.ddl.ColumnType的典型用法代码示例。如果您正苦于以下问题:Java ColumnType类的具体用法?Java ColumnType怎么用?Java ColumnType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ColumnType类属于me.prettyprint.hector.api.ddl包,在下文中一共展示了ColumnType类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createRequiredSchemaEntities

import me.prettyprint.hector.api.ddl.ColumnType; //导入依赖的package包/类
@Override
public void createRequiredSchemaEntities() throws DataAccessLayerException {
	final String keyspaceName = _keyspace.getKeyspaceName();
	KeyspaceDefinition ksdef = _factory.getCluster().describeKeyspace(keyspaceName);

	if (!hasColumnFamily(ksdef, _cf_name)) {
		ColumnFamilyDefinition cfDef = HFactory.createColumnFamilyDefinition(keyspaceName, _cf_name);
		cfDef.setKeyValidationClass(ComparatorType.UTF8TYPE.getClassName());
		cfDef.setComparatorType(ComparatorType.UTF8TYPE);
		cfDef.setCompactionStrategy("LeveledCompactionStrategy");
		cfDef.setDefaultValidationClass(ComparatorType.COUNTERTYPE.getClassName());
		cfDef.setColumnType(ColumnType.STANDARD);
		_factory.getCluster().addColumnFamily(cfDef, true);
	}

	setDefaultValue(-1L);
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:18,代码来源:Cassandra12xCounterDAO.java


示例2: createCF_PO_Sx

import me.prettyprint.hector.api.ddl.ColumnType; //导入依赖的package包/类
/**
 * Creates POS? column family.
 * 
 * @param cfName the column family name.
 * @return the POS? column family definition.
 */
protected ColumnFamilyDefinition createCF_PO_Sx(final String cfName) {

	final ColumnFamilyDefinition cfdef = HFactory.createColumnFamilyDefinition(_dataAccessLayerFactory.getKeyspaceName(), cfName, ComparatorType.COMPOSITETYPE);
	cfdef.setColumnType(ColumnType.STANDARD);
	cfdef.setKeyValidationClass(ComparatorType.BYTESTYPE.getClassName());
	cfdef.setDefaultValidationClass(ComparatorType.BYTESTYPE.getClassName());
	cfdef.setComparatorTypeAlias("(DoubleType, BytesType)");
	cfdef.setCompactionStrategy("LeveledCompactionStrategy");
	
	cfdef.setCompressionOptions(_compressionOptions);
	return new ThriftCfDef(cfdef);
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:19,代码来源:Cassandra12xTripleIndexDAO.java


示例3: createCF_RDT_PO_S

import me.prettyprint.hector.api.ddl.ColumnType; //导入依赖的package包/类
/**
 * Creates POS? column family used for date range queries.
 * 
 * @param cfName the column family name.
 * @return the POS? column family definition.
 */
protected ColumnFamilyDefinition createCF_RDT_PO_S(final String cfName) {
	final ColumnFamilyDefinition cfdef = HFactory.createColumnFamilyDefinition(_dataAccessLayerFactory.getKeyspaceName(), cfName, ComparatorType.COMPOSITETYPE);
	cfdef.setColumnType(ColumnType.STANDARD);
	cfdef.setKeyValidationClass(ComparatorType.BYTESTYPE.getClassName());
	cfdef.setDefaultValidationClass(ComparatorType.BYTESTYPE.getClassName());
	cfdef.setComparatorTypeAlias("(LongType, BytesType)");
	cfdef.setCompactionStrategy("LeveledCompactionStrategy");

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


示例4: createCF_RDT_SP_O

import me.prettyprint.hector.api.ddl.ColumnType; //导入依赖的package包/类
/**
 * Creates SPO? column family used for date range queries.
 * 
 * @param cfName the column family name.
 * @return the SPO? column family definition.
 */
protected ColumnFamilyDefinition createCF_RDT_SP_O(final String cfName) {
	final ColumnFamilyDefinition cfdef = HFactory.createColumnFamilyDefinition(_dataAccessLayerFactory.getKeyspaceName(), cfName, ComparatorType.LONGTYPE);
	cfdef.setColumnType(ColumnType.STANDARD);
	cfdef.setKeyValidationClass(ComparatorType.BYTESTYPE.getClassName());
	cfdef.setDefaultValidationClass(ComparatorType.BYTESTYPE.getClassName());
	cfdef.setCompactionStrategy("LeveledCompactionStrategy");

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


示例5: createCF_SP_Ox

import me.prettyprint.hector.api.ddl.ColumnType; //导入依赖的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


示例6: createRequiredSchemaEntities

import me.prettyprint.hector.api.ddl.ColumnType; //导入依赖的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


示例7: dropAndCreateSchema

import me.prettyprint.hector.api.ddl.ColumnType; //导入依赖的package包/类
@Override
protected void dropAndCreateSchema() throws InterruptedException {
    super.dropAndCreateSchema();
    ColumnFamilyDefinition columnFamilyDefinition = HFactory.createColumnFamilyDefinition(keyspace.getKeyspaceName(),
                                                                                          columnFamily,
                                                                                          ComparatorType.UTF8TYPE);
    columnFamilyDefinition.setColumnType(ColumnType.SUPER);
    columnFamilyDefinition.setDefaultValidationClass("UTF8Type");
    columnFamilyDefinition.setSubComparatorType(ComparatorType.UTF8TYPE);
    cluster.addColumnFamily(columnFamilyDefinition);
}
 
开发者ID:ezoerner,项目名称:c-star-path-j,代码行数:12,代码来源:ThriftSuperStructuredDataSupportSystemTest.java


示例8: createColumnFamily

import me.prettyprint.hector.api.ddl.ColumnType; //导入依赖的package包/类
protected void createColumnFamily(String columnFamilyName, ColumnType columnType) {
    ColumnFamilyDefinition columnFamilyDefinition = HFactory.createColumnFamilyDefinition(keyspace.getKeyspaceName(),

                                                                                          columnFamilyName,
                                                                                          ComparatorType.UTF8TYPE);
    columnFamilyDefinition.setDefaultValidationClass("UTF8Type");
    columnFamilyDefinition.setKeyValidationClass("UTF8Type");
    columnFamilyDefinition.setColumnType(columnType);
    if (columnType == ColumnType.SUPER) {
        columnFamilyDefinition.setSubComparatorType(ComparatorType.UTF8TYPE);
    }
    cluster.addColumnFamily(columnFamilyDefinition);
}
 
开发者ID:ezoerner,项目名称:c-star-path-j,代码行数:14,代码来源:AbstractCassandraThriftSystemTest.java


示例9: createFreshSchema

import me.prettyprint.hector.api.ddl.ColumnType; //导入依赖的package包/类
private static void createFreshSchema(Cluster cluster, String keyspaceName) {
	ColumnFamilyDefinition cfThresholdsDef = HFactory.createColumnFamilyDefinition(keyspaceName,                              
			THRESHOLDS_CF, 
               ComparatorType.BYTESTYPE);
	cfThresholdsDef.setColumnType(ColumnType.SUPER);
	cfThresholdsDef.setSubComparatorType(ComparatorType.BYTESTYPE);
	
	ColumnFamilyDefinition cfManifestMapDef = HFactory.createColumnFamilyDefinition(keyspaceName,                              
			MANIFESTMAP_CF, 
               ComparatorType.BYTESTYPE);

	ColumnFamilyDefinition cfRealizedAsMapDef = HFactory.createColumnFamilyDefinition(keyspaceName,                              
			REALIZED_AS_CF, 
               ComparatorType.LONGTYPE);
	
	ColumnFamilyDefinition cfOpsDef = HFactory.createColumnFamilyDefinition(keyspaceName,                              
			OPS_EVENTS_CF, 
               ComparatorType.LONGTYPE);

	ColumnFamilyDefinition cfCiStateHistDef = HFactory.createColumnFamilyDefinition(keyspaceName,                              
			CI_STATE_HIST_CF, 
               ComparatorType.LONGTYPE);

	ColumnFamilyDefinition cfCiOpenEventsDef = HFactory.createColumnFamilyDefinition(keyspaceName,                              
			CI_OPEN_EVENTS_CF, 
               ComparatorType.BYTESTYPE);
	cfCiOpenEventsDef.setColumnType(ColumnType.SUPER);
	cfCiOpenEventsDef.setSubComparatorType(ComparatorType.BYTESTYPE);

	ColumnFamilyDefinition cfComponentStateDef = HFactory.createColumnFamilyDefinition(keyspaceName,                              
			COMPONENT_STATE_CF, 
               ComparatorType.BYTESTYPE);
	cfComponentStateDef.setColumnType(ColumnType.STANDARD);
	cfComponentStateDef.setDefaultValidationClass(ComparatorType.COUNTERTYPE.getClassName());
	cfComponentStateDef.setKeyValidationClass(ComparatorType.LONGTYPE.getClassName());
	
	ColumnFamilyDefinition cfOrphanEventsDef = HFactory.createColumnFamilyDefinition(keyspaceName,
			ORPHAN_CLOSE_EVENTS_CF, 
			ComparatorType.LONGTYPE);
	cfOrphanEventsDef.setColumnType(ColumnType.SUPER);
	cfOrphanEventsDef.setSubComparatorType(ComparatorType.BYTESTYPE);

	KeyspaceDefinition newKeyspace = HFactory.createKeyspaceDefinition(keyspaceName,                 
	              ThriftKsDef.DEF_STRATEGY_CLASS,  
	              1,
	              Arrays.asList(cfThresholdsDef,cfManifestMapDef, cfRealizedAsMapDef, cfOpsDef, cfCiStateHistDef, cfCiOpenEventsDef, cfComponentStateDef));
	//Add the schema to the cluster.
	//"true" as the second param means that Hector will block until all nodes see the change.
	cluster.addKeyspace(newKeyspace, true);
	logger.info("Added keyspace " + keyspaceName);
}
 
开发者ID:oneops,项目名称:oneops,代码行数:52,代码来源:SchemaBuilder.java


示例10: createCF

import me.prettyprint.hector.api.ddl.ColumnType; //导入依赖的package包/类
/**
 * Creates a column family definition.
 * 
 * @param cfName the column family name.
 * @param indexedCols names of columns that will be indexed.
 * @param keyComp the key comparator.
 * @param valueValidationClass the value validation class.
 * @param compositeCol a flag that indicates if columns are composite.
 * @return the column family definition.
 */
protected ColumnFamilyDefinition createCF(
		final String cfName,
		final List<byte[]> indexedCols,
		final ComparatorType keyComp,
		final ComparatorType valueValidationClass,
		final boolean compositeCol) {

	final ColumnFamilyDefinition cfdef = HFactory.createColumnFamilyDefinition(
			_dataAccessLayerFactory.getKeyspaceName(), 
			cfName, 
			compositeCol
				? ComparatorType.COMPOSITETYPE
				: ComparatorType.BYTESTYPE);
	cfdef.setKeyspaceName(_dataAccessLayerFactory.getKeyspaceName());
	cfdef.setColumnType(ColumnType.STANDARD);
	cfdef.setCompactionStrategy("LeveledCompactionStrategy");

	if (compositeCol) {
		cfdef.setComparatorTypeAlias("(BytesType, BytesType, BytesType)");
	}

	for (byte[] col : indexedCols) {
		final String indexColumnFamilyName = "index_" + cfName + "_" + Arrays.hashCode(col);
		try {
			_dataAccessLayerFactory.getCluster().dropColumnFamily(
					_dataAccessLayerFactory.getKeyspaceName(),
					indexColumnFamilyName,
					true);
		} catch (HInvalidRequestException ignore) {
			// Nothing to be done here...
		}
		cfdef.addColumnDefinition(createCDef(col, valueValidationClass.getClassName(), indexColumnFamilyName));
	}

	cfdef.setKeyValidationClass(keyComp.getClassName());
	cfdef.setDefaultValidationClass(valueValidationClass.getClassName());
	cfdef.setCompressionOptions(_compressionOptions);

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


示例11: createSchema

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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClusterRenderer类代码示例发布时间:2022-05-22
下一篇:
Java IPageRequestHandler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap