本文整理汇总了Java中me.prettyprint.hector.api.ddl.KeyspaceDefinition.getCfDefs方法的典型用法代码示例。如果您正苦于以下问题:Java KeyspaceDefinition.getCfDefs方法的具体用法?Java KeyspaceDefinition.getCfDefs怎么用?Java KeyspaceDefinition.getCfDefs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类me.prettyprint.hector.api.ddl.KeyspaceDefinition
的用法示例。
在下文中一共展示了KeyspaceDefinition.getCfDefs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cfExists
import me.prettyprint.hector.api.ddl.KeyspaceDefinition; //导入方法依赖的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;
}
示例2: hasColumnFamily
import me.prettyprint.hector.api.ddl.KeyspaceDefinition; //导入方法依赖的package包/类
/**
* Returns true if a given keyspace has a column family.
*
* @param ksdef the keyspace.
* @param cfname the column family name.
* @return true if the keyspace has the column family, false otherwise.
*/
public static boolean hasColumnFamily(final KeyspaceDefinition ksdef, final String cfname) {
for (final ColumnFamilyDefinition cfdef : ksdef.getCfDefs()) {
if (cfdef.getName().equals(cfname)) {
return true;
}
}
return false;
}
示例3: getColumnFamilies
import me.prettyprint.hector.api.ddl.KeyspaceDefinition; //导入方法依赖的package包/类
public List<ColumnFamilyDefinition> getColumnFamilies(String keyspaceName) throws SummarizerException {
KeyspaceDefinition keyspaceDefinition = newConnection().describeKeyspace(keyspaceName);
if (keyspaceDefinition != null && !keyspaceDefinition.equals("")) {
return keyspaceDefinition.getCfDefs();
} else {
Exception e = null;
log.error("There are no key spaces in the server yet");
throw new SummarizerException("There are no key spaces in the server yet", e);
}
}
示例4: describeKeySpace
import me.prettyprint.hector.api.ddl.KeyspaceDefinition; //导入方法依赖的package包/类
private void describeKeySpace() {
List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();
for (KeyspaceDefinition kd : keyspaces) {
if (kd.getName().equals(KEYSPACE_NAME)) {
System.out.println("Name: " + kd.getName());
System.out.println("RF: " + kd.getReplicationFactor());
System.out.println("strategy class: " + kd.getStrategyClass());
List<ColumnFamilyDefinition> cfDefs = kd.getCfDefs();
ColumnFamilyDefinition def = cfDefs.get(0);
System.out.println(" CF Name: " + def.getName());
System.out.println(" CF Metadata: " + def.getColumnMetadata());
}
}
}