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


Java ColumnFamilyDefinition.setDefaultValidationClass方法代码示例

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


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

示例1: createRequiredSchemaEntities

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入方法依赖的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.ColumnFamilyDefinition; //导入方法依赖的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.ColumnFamilyDefinition; //导入方法依赖的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.ColumnFamilyDefinition; //导入方法依赖的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: createRequiredSchemaEntities

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

示例6: dropAndCreateSchema

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

示例7: dropAndCreateSchema

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入方法依赖的package包/类
@Override
protected void dropAndCreateSchema() throws InterruptedException {
    super.dropAndCreateSchema();

    ColumnFamilyDefinition columnFamilyDefinition = HFactory.createColumnFamilyDefinition(keyspace.getKeyspaceName(),
                                                                                          columnFamily,
                                                                                          ComparatorType.UTF8TYPE);
    columnFamilyDefinition.setDefaultValidationClass("UTF8Type");
    cluster.addColumnFamily(columnFamilyDefinition);
}
 
开发者ID:ezoerner,项目名称:c-star-path-j,代码行数:11,代码来源:ThriftStructuredDataSupportSystemTest.java

示例8: createColumnFamily

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入方法依赖的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: getCfDefs

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入方法依赖的package包/类
public static List<ColumnFamilyDefinition> getCfDefs( Class<? extends CFEnum> cfEnum,
                                                      List<ColumnFamilyDefinition> cf_defs, String keyspace ) {

    if ( cf_defs == null ) {
        cf_defs = new ArrayList<ColumnFamilyDefinition>();
    }

    CFEnum[] values = null;
    try {
        values = ( CFEnum[] ) invokeStaticMethod( cfEnum, "values", null);
    }
    catch ( Exception e ) {
        logger.error( "Couldn't get CFEnum values", e );
    }
    if ( values == null ) {
        return null;
    }

    for ( CFEnum cf : values ) {
        if ( !cf.create() ) {
            continue;
        }
        String defaultValidationClass = cf.getValidator();
        List<ColumnDefinition> metadata = cf.getMetadata();

        ColumnFamilyDefinition cf_def = HFactory.createColumnFamilyDefinition( keyspace, cf.getColumnFamily(),
                ComparatorType.getByClassName( cf.getComparator() ), metadata );

        if ( defaultValidationClass != null ) {
            cf_def.setDefaultValidationClass( defaultValidationClass );
        }

        cf_defs.add( cf_def );
    }

    return cf_defs;
}
 
开发者ID:apache,项目名称:usergrid,代码行数:38,代码来源:CassandraPersistenceUtils.java

示例10: createFreshSchema

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

示例11: createCF

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


注:本文中的me.prettyprint.hector.api.ddl.ColumnFamilyDefinition.setDefaultValidationClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。