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


Java ColumnFamilyDefinition类代码示例

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


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

示例1: createSchema

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入依赖的package包/类
private void createSchema(int replicationFactor)
{
	List<ColumnFamilyDefinition> cfDef = new ArrayList<ColumnFamilyDefinition>();

	cfDef.add(HFactory.createColumnFamilyDefinition(
			m_keyspaceName, CF_DATA_POINTS, ComparatorType.BYTESTYPE));

	cfDef.add(HFactory.createColumnFamilyDefinition(
			m_keyspaceName, CF_ROW_KEY_INDEX, ComparatorType.BYTESTYPE));

	cfDef.add(HFactory.createColumnFamilyDefinition(
			m_keyspaceName, CF_STRING_INDEX, ComparatorType.UTF8TYPE));

	KeyspaceDefinition newKeyspace = HFactory.createKeyspaceDefinition(
			m_keyspaceName, ThriftKsDef.DEF_STRATEGY_CLASS,
			replicationFactor, cfDef);

	m_cluster.addKeyspace(newKeyspace, true);
}
 
开发者ID:quqiangsheng,项目名称:abhot,代码行数:20,代码来源:CassandraDatastore.java

示例2: createColumnFamiliyDefinitions

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入依赖的package包/类
/**
 * Creates required column families according with the concrete store layout.
 * 
 * @return a list of column family definitions.
 */
@SuppressWarnings("unchecked")
protected List<ColumnFamilyDefinition> createColumnFamiliyDefinitions() {

	final ColumnFamilyDefinition spoc = createCF(S_POC, Collections.EMPTY_LIST, ComparatorType.BYTESTYPE, ComparatorType.BYTESTYPE, true);
	final ColumnFamilyDefinition ospc = createCF(O_SPC, Collections.EMPTY_LIST, ComparatorType.BYTESTYPE, ComparatorType.BYTESTYPE, true);
	final ColumnFamilyDefinition posc = createCF(PO_SC, Arrays.asList(COMPOSITE_SERIALIZER.toBytes(P_COL)), ComparatorType.BYTESTYPE, ComparatorType.BYTESTYPE, true);
	
	final ColumnFamilyDefinition spox = createCF_SP_Ox(RN_SP_O);
	final ColumnFamilyDefinition psox = createCF_PO_Sx(RN_PO_S);
	final ColumnFamilyDefinition psodtx = createCF_RDT_PO_S(RDT_PO_S);
	final ColumnFamilyDefinition spodtx = createCF_RDT_SP_O(RDT_SP_O);

	List<ColumnFamilyDefinition> defs = new ArrayList<ColumnFamilyDefinition>();
	defs.addAll(Arrays.asList(spoc, ospc, posc, spox, psox, psodtx, spodtx));
	return defs;
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:22,代码来源:Cassandra12xTripleIndexDAO.java

示例3: 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

示例4: createKeyspace

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

示例5: filterColumnFamilies

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入依赖的package包/类
public List<String> filterColumnFamilies(String keyspaceName) throws SummarizerException {
    ColumnFamilyHandler columnFamilyHandler = new ColumnFamilyHandler();
    List<ColumnFamilyDefinition> columnFamilyDefinitionList = columnFamilyHandler.getColumnFamilies(keyspaceName);
    List<String> selectedColumnFamilies = new ArrayList<String>(columnFamilyDefinitionList.size());

    //Retrieve Column Families that has previous date
    for (ColumnFamilyDefinition aColumnFamilyDefinitionList : columnFamilyDefinitionList) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd");
        Date date = new Date();
        String currentDate = dateFormat.format(date.getTime());
        String columnFamilyName = aColumnFamilyDefinitionList.getName();
        if (!columnFamilyName.contains(currentDate)) {
            Pattern pattern = Pattern.compile("(log_)([\\d]+)(_)([A-Z|a-z]+)(_)\\d{4}(_)\\d{2}(_)\\d{2}");
                Matcher matcher = pattern.matcher(columnFamilyName);
            if(matcher.matches()) {
                selectedColumnFamilies.add(columnFamilyName);
            }
        }
    }
    return selectedColumnFamilies;
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:22,代码来源:ColumnFamilyHandler.java

示例6: createLinksTable

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

示例7: createColumnFamily

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入依赖的package包/类
/**
 * Lazy creates a column family in the keyspace. If it doesn't exist, it will be created, then the call will sleep
 * until all nodes have acknowledged the schema change
 */
public void createColumnFamily( String keyspace, ColumnFamilyDefinition cfDef ) {

    if ( !keySpaceExists( keyspace ) ) {
        createKeySpace( keyspace );
    }


    //add the cf

    if ( !cfExists( keyspace, cfDef.getName() ) ) {

        //default read repair chance to 0.1
        cfDef.setReadRepairChance( 0.1d );
        cfDef.setCompactionStrategy( "LeveledCompactionStrategy" );
        cfDef.setCompactionStrategyOptions( new MapUtils.HashMapBuilder().map("sstable_size_in_mb", "512"  ) );

        cluster.addColumnFamily( cfDef, true );
        logger.info( "Created column family {} in keyspace {}", cfDef.getName(), keyspace );
    }
}
 
开发者ID:apache,项目名称:usergrid,代码行数:25,代码来源:CassandraService.java

示例8: cfExists

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入依赖的package包/类
/** Return true if the column family exists */
public boolean cfExists( String keyspace, String cfName ) {
    KeyspaceDefinition ksDef = cluster.describeKeyspace( keyspace );

    if ( ksDef == null ) {
        return false;
    }

    for ( ColumnFamilyDefinition cf : ksDef.getCfDefs() ) {
        if ( cfName.equals( cf.getName() ) ) {
            return true;
        }
    }

    return false;
}
 
开发者ID:apache,项目名称:usergrid,代码行数:17,代码来源:CassandraService.java

示例9: getOrCreateKeyspace

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入依赖的package包/类
@Override public Keyspace getOrCreateKeyspace(String keyspaceName, int replicationFactor, Cluster cluster) {
    KeyspaceDefinition keyspaceDef = cluster.describeKeyspace(keyspaceName);
    List<ColumnFamilyDefinition> cfDefs = new LinkedList<ColumnFamilyDefinition>();
    // If keyspace does not exist create it without CFs.
    if (keyspaceDef == null) {
        keyspaceDef = HFactory.createKeyspaceDefinition(keyspaceName, ThriftKsDef.DEF_STRATEGY_CLASS, replicationFactor, cfDefs);
        cluster.addKeyspace(keyspaceDef);
    }

    Keyspace keyspace = HFactory.createKeyspace(keyspaceName, cluster);

    ConfigurableConsistencyLevel consistencyLevel = new ConfigurableConsistencyLevel();
    consistencyLevel.setDefaultReadConsistencyLevel(HConsistencyLevel.QUORUM);
    consistencyLevel.setDefaultWriteConsistencyLevel(HConsistencyLevel.QUORUM);
    keyspace.setConsistencyLevelPolicy(consistencyLevel);

    return keyspace;
}
 
开发者ID:appmetr,项目名称:hercules,代码行数:19,代码来源:ThriftDataDriver.java

示例10: getColumnFamilyDefinitions

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入依赖的package包/类
public List<ColumnFamilyDefinition> getColumnFamilyDefinitions() {
  List<ColumnFamilyDefinition> list = new ArrayList<>();
  for (String key: this.columnFamilyDefinitions.keySet()) {
    ColumnFamilyDefinition columnFamilyDefinition = this.columnFamilyDefinitions.get(key);
    ThriftCfDef thriftCfDef = new ThriftCfDef(columnFamilyDefinition);
    list.add(thriftCfDef);
  }
  
  return list;
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:11,代码来源:CassandraMapping.java

示例11: getConsisLevelForColFams

import me.prettyprint.hector.api.ddl.ColumnFamilyDefinition; //导入依赖的package包/类
/**
 * Method in charge of setting the consistency level for defined column families.
 * @param pColFams  Column families
 * @return Map<String, HConsistencyLevel> with the mapping between colFams and consistency level.
 */
private Map<String, HConsistencyLevel> getConsisLevelForColFams(List<ColumnFamilyDefinition> pColFams) {
  Map<String, HConsistencyLevel> clMap = new HashMap<>();
  // Get columnFamily consistency level.
  String colFamConsisLvl = (colFamConsLvl != null && !colFamConsLvl.isEmpty())?colFamConsLvl:DEFAULT_HECTOR_CONSIS_LEVEL;
  LOG.debug("ColumnFamily consistency level configured to '" + colFamConsisLvl + "'.");
  // Define consistency for ColumnFamily "ColumnFamily"
  for (ColumnFamilyDefinition colFamDef : pColFams)
    clMap.put(colFamDef.getName(), HConsistencyLevel.valueOf(colFamConsisLvl));
  return clMap;
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:16,代码来源:CassandraClient.java

示例12: 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

示例13: 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

示例14: 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

示例15: createCF_SP_Ox

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


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