本文整理汇总了Java中me.prettyprint.hector.api.ddl.ComparatorType类的典型用法代码示例。如果您正苦于以下问题:Java ComparatorType类的具体用法?Java ComparatorType怎么用?Java ComparatorType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ComparatorType类属于me.prettyprint.hector.api.ddl包,在下文中一共展示了ComparatorType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSchema
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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);
}
示例2: createColumnFamiliyDefinitions
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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;
}
示例3: createRequiredSchemaEntities
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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);
}
示例4: createKeyspace
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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);
}
示例5: createLinksTable
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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);
}
示例6: checkAndCreateFKIndexes
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的package包/类
private void checkAndCreateFKIndexes(EntityMetadata metadata) {
for (ForeignKeyMetadata index : metadata.getIndexes().values()) {
logger.info(MessageFormat.format("Found index {0} for {1}", index.getKeyClass().getName(), metadata.getEntityClass().getName()));
if (dataDriver.checkAndCreateColumnFamily(hercules.getCluster(), hercules.getKeyspaceName(), index.getColumnFamily(), ComparatorType.BYTESTYPE)) {
logger.info("Creating index table: " + index.getColumnFamily());
fillFKIndex(metadata, index);
}
}
for (CollectionIndexMetadata collectionIndex : metadata.getCollectionIndexes().values()) {
logger.info(MessageFormat.format("Found collection index {0} for {1}", collectionIndex.getIndexColumnFamily(), metadata.getEntityClass().getName()));
if (dataDriver.checkAndCreateColumnFamily(hercules.getCluster(), hercules.getKeyspaceName(), collectionIndex.getIndexColumnFamily(), ComparatorType.BYTESTYPE)) {
logger.info("Creating index table: " + collectionIndex.getIndexColumnFamily());
fillCollectionIndex(metadata, collectionIndex);
}
}
}
示例7: createCF_PO_Sx
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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);
}
示例8: createCF_RDT_PO_S
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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);
}
示例9: createCF_RDT_SP_O
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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);
}
示例10: createCF_SP_Ox
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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);
}
示例11: createColumnFamiliyDefinitions
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected List<ColumnFamilyDefinition> createColumnFamiliyDefinitions() {
List<ColumnFamilyDefinition> defs = super.createColumnFamiliyDefinitions();
defs.add(createCF(OC_PS, Arrays.asList(COMPOSITE_SERIALIZER.toBytes(C_COL)), ComparatorType.BYTESTYPE, ComparatorType.BYTESTYPE, true));
defs.add(createCF(SC_OP, Collections.EMPTY_LIST, ComparatorType.BYTESTYPE, ComparatorType.BYTESTYPE, true));
defs.add(createCF(SPC_O, Arrays.asList(COMPOSITE_SERIALIZER.toBytes(PC_COL)), ComparatorType.BYTESTYPE, ComparatorType.BYTESTYPE, true));
return defs;
}
示例12: createRequiredSchemaEntities
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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);
}
}
示例13: dropAndCreateSchema
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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);
}
示例14: dropAndCreateSchema
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的package包/类
@Override
protected void dropAndCreateSchema() throws InterruptedException {
super.dropAndCreateSchema();
ColumnFamilyDefinition columnFamilyDefinition = HFactory.createColumnFamilyDefinition(keyspace.getKeyspaceName(),
columnFamily,
ComparatorType.UTF8TYPE);
columnFamilyDefinition.setDefaultValidationClass("UTF8Type");
cluster.addColumnFamily(columnFamilyDefinition);
}
示例15: createColumnFamily
import me.prettyprint.hector.api.ddl.ComparatorType; //导入依赖的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);
}