本文整理汇总了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);
}
示例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 );
}
示例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;
}
示例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);
}
示例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;
}
示例6: getMetadata
import me.prettyprint.hector.api.ddl.ColumnDefinition; //导入依赖的package包/类
public List<ColumnDefinition> getMetadata();