本文整理匯總了Java中com.datastax.driver.core.Metadata.getKeyspaces方法的典型用法代碼示例。如果您正苦於以下問題:Java Metadata.getKeyspaces方法的具體用法?Java Metadata.getKeyspaces怎麽用?Java Metadata.getKeyspaces使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.datastax.driver.core.Metadata
的用法示例。
在下文中一共展示了Metadata.getKeyspaces方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loadTablesFromRemote
import com.datastax.driver.core.Metadata; //導入方法依賴的package包/類
public static Cluster loadTablesFromRemote(String host, int port, String cfidOverrides) throws IOException {
Map<String, UUID> cfs = parseOverrides(cfidOverrides);
Cluster.Builder builder = Cluster.builder().addContactPoints(host).withPort(port);
Cluster cluster = builder.build();
Metadata metadata = cluster.getMetadata();
IPartitioner partitioner = FBUtilities.newPartitioner(metadata.getPartitioner());
if (DatabaseDescriptor.getPartitioner() == null)
DatabaseDescriptor.setPartitionerUnsafe(partitioner);
for (com.datastax.driver.core.KeyspaceMetadata ksm : metadata.getKeyspaces()) {
if (!ksm.getName().equals("system")) {
for (TableMetadata tm : ksm.getTables()) {
String name = ksm.getName()+"."+tm.getName();
try {
CassandraUtils.tableFromCQL(
new ByteArrayInputStream(tm.asCQLQuery().getBytes()),
cfs.get(name) != null ? cfs.get(name) : tm.getId());
} catch(SyntaxException e) {
// ignore tables that we cant parse (probably dse)
logger.debug("Ignoring table " + name + " due to syntax exception " + e.getMessage());
}
}
}
}
return cluster;
}
示例2: execute
import com.datastax.driver.core.Metadata; //導入方法依賴的package包/類
/**
* Execute Describe Keysapces
* @param metaData
* @return table
*/
@Override
public Table execute(Metadata metaData) {
FunctionalList<KeyspaceMetadata,RowData> functional = new FunctionalList<>(metaData.getKeyspaces());
List<RowData> rowDatas = functional.map(new KeyspacestoRowDataFuntion());
return new Table(new ListUtils<String>().buildList(), rowDatas);
}
示例3: execute
import com.datastax.driver.core.Metadata; //導入方法依賴的package包/類
/**
* Execute DESCRIBE TABLES .
* @param metaData
* @return table
*/
@Override
public Table execute(Metadata metaData) {
FunctionalList<KeyspaceMetadata,RowData> functional = new FunctionalList<>( metaData.getKeyspaces());
List<RowData> rows = functional.map(new KeyspaceTablestoRowData());
return new Table(new ListUtils<String>().buildList(), rows);
}