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


Java ColumnDefinition类代码示例

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


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

示例1: createLinksTable

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

示例2: getIndexMetadata

import me.prettyprint.hector.api.ddl.ColumnDefinition; //导入依赖的package包/类
public static List<ColumnDefinition> getIndexMetadata( String indexes ) {
    if ( indexes == null ) {
        return null;
    }
    String[] index_entries = split( indexes, ',' );
    List<ColumnDef> columns = new ArrayList<ColumnDef>();
    for ( String index_entry : index_entries ) {
        String column_name = stringOrSubstringBeforeFirst( index_entry, ':' ).trim();
        String comparer = substringAfterLast( index_entry, ":" ).trim();
        if ( StringUtils.isBlank( comparer ) ) {
            comparer = "UUIDType";
        }
        if ( StringUtils.isNotBlank( column_name ) ) {
            ColumnDef cd = new ColumnDef( bytebuffer( column_name ), comparer );
            cd.setIndex_name( column_name );
            cd.setIndex_type( IndexType.KEYS );
            columns.add( cd );
        }
    }
    return ThriftColumnDef.fromThriftList( columns );
}
 
开发者ID:apache,项目名称:usergrid,代码行数:22,代码来源:CassandraPersistenceUtils.java

示例3: createCDef

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

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

示例5: getCfDefs

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

示例6: getMetadata

import me.prettyprint.hector.api.ddl.ColumnDefinition; //导入依赖的package包/类
public List<ColumnDefinition> getMetadata(); 
开发者ID:apache,项目名称:usergrid,代码行数:2,代码来源:CFEnum.java


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