本文整理汇总了Java中org.apache.accumulo.core.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于org.apache.accumulo.core包,在下文中一共展示了Constants类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createScanner
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
private Scanner createScanner(Query<K,T> query) throws TableNotFoundException {
// TODO make isolated scanner optional?
Scanner scanner = new IsolatedScanner(conn.createScanner(mapping.tableName, Constants.NO_AUTHS));
setFetchColumns(scanner, query.getFields());
scanner.setRange(createRange(query));
if (query.getStartTime() != -1 || query.getEndTime() != -1) {
IteratorSetting is = new IteratorSetting(30, TimestampFilter.class);
if (query.getStartTime() != -1)
TimestampFilter.setStart(is, query.getStartTime(), true);
if (query.getEndTime() != -1)
TimestampFilter.setEnd(is, query.getEndTime(), true);
scanner.addScanIterator(is);
}
return scanner;
}
开发者ID:jianglibo,项目名称:gora-boot,代码行数:20,代码来源:AccumuloStore.java
示例2: printTablePretty
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
/**
* Prints the table with pretty formatting using the specified config and additional settings.
* @param tableName the name of the table to print.
* @param config the {@link AccumuloRdfConfiguration}.
* @param shouldAddCommonIterators {@code true} to add the common iterators to the table scanner.
* {@code false} otherwise.
* @param settings the additional {@link IteratorSetting}s to add besides the common ones.
* @throws IOException
*/
public static void printTablePretty(final String tableName, final Configuration config, final boolean shouldAddCommonIterators, final IteratorSetting... settings) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, IOException {
final Scanner scanner = AccumuloRyaUtils.getScanner(tableName, config, shouldAddCommonIterators);
for (final IteratorSetting setting : settings) {
scanner.addScanIterator(setting);
}
final String format = "| %-64s | %-24s | %-28s | %-20s | %-20s | %-10s |";
final int totalFormatLength = String.format(format, 1, 2, 3, 4, 5, 6).length();
final String instance = config.get(MRUtils.AC_INSTANCE_PROP);
log.info(StringUtils.rightPad("==================", totalFormatLength, "="));
log.info(StringUtils.rightPad("| TABLE: " + tableName + " INSTANCE: " + instance, totalFormatLength - 1) + "|");
log.info(StringUtils.rightPad("------------------", totalFormatLength, "-"));
log.info(String.format(format, "--Row--", "--ColumnVisibility--", "--Timestamp--", "--ColumnFamily--", "--ColumnQualifier--", "--Value--"));
log.info(StringUtils.rightPad("|-----------------", totalFormatLength - 1, "-") + "|");
for (final Entry<Key, Value> entry : scanner) {
final Key k = entry.getKey();
final String rowString = Key.appendPrintableString(k.getRow().getBytes(), 0, k.getRow().getLength(), Constants.MAX_DATA_TO_PRINT, new StringBuilder()).toString();
log.info(String.format(format, rowString, k.getColumnVisibility(), new Date(k.getTimestamp()), k.getColumnFamily(), k.getColumnQualifier(), entry.getValue()));
}
log.info(StringUtils.rightPad("==================", totalFormatLength, "="));
}
开发者ID:apache,项目名称:incubator-rya,代码行数:31,代码来源:AccumuloRyaUtils.java
示例3: createScanner
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
private Scanner createScanner(Query<K,T> query) throws TableNotFoundException {
// TODO make isolated scanner optional?
Scanner scanner = new IsolatedScanner(conn.createScanner(mapping.tableName, Constants.NO_AUTHS));
setFetchColumns(scanner, query.getFields());
scanner.setRange(createRange(query));
if (query.getStartTime() != -1 || query.getEndTime() != -1) {
IteratorSetting is = new IteratorSetting(30, TimestampFilter.class);
if (query.getStartTime() != -1)
TimestampFilter.setStart(is, query.getStartTime(), true);
if (query.getEndTime() != -1)
TimestampFilter.setEnd(is, query.getEndTime(), true);
scanner.addScanIterator(is);
}
return scanner;
}
开发者ID:maestros,项目名称:gora-oraclenosql,代码行数:20,代码来源:AccumuloStore.java
示例4: dumpConfiguration
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
public void dumpConfiguration(Configuration config, Entry e) throws Exception {
Preconditions.checkNotNull(config, "Configuration must be supplied.");
Preconditions.checkNotNull(e, "Entry must be supplied.");
AddCommand add = git.add();
CommitCommand commit = git.commit();
try {
//Dump Zookeeper
String instanceId = config.getConnector().getInstance().getInstanceID();
String zkPath = Constants.ZROOT + "/" + instanceId;
File zkDump = new File(gitDir, ZK_DUMP_FILE);
LOG.debug("Dump ZooKeeper configuration at {} to {}", zkPath, zkDump);
FileOutputStream out = new FileOutputStream(zkDump);
DumpZookeeper.run(out, zkPath);
out.close();
//Dump the configuration
LOG.debug("Dumping Accumulo configuration to {}", gitDir);
DumpConfigCommand command = new DumpConfigCommand();
command.allConfiguration = true;
command.directory = gitDir.getAbsolutePath();
Instance instance = config.getConnector().getInstance();
String principal = config.getUsername();
PasswordToken token = new PasswordToken(config.getPassword().getBytes());
Admin.printConfig(instance, principal, token, command);
//Add, commit, and tag
add.addFilepattern(".").call();
commit.setMessage("Backup " + e.getUUID().toString()).call();
git.tag().setName(e.getUUID().toString()).call();
LOG.debug("Git tag {} created.", e.getUUID());
//Should we remove all of the files from the existing git workspace?
} catch (Exception ex) {
LOG.error("Error saving configuration", ex);
git.reset().setMode(ResetType.HARD).setRef("HEAD").call();
throw ex;
}
}
开发者ID:dlmarion,项目名称:raccovery,代码行数:36,代码来源:AccumuloConfigurations.java
示例5: snapshotTable
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
public static Path snapshotTable(Volume vol, Entry entry, String tableId) throws IOException {
FileSystem fs = vol.getFileSystem();
if (fs instanceof DistributedFileSystem) {
DistributedFileSystem dfs = (DistributedFileSystem) fs;
Path tableDir = new Path(vol.getBasePath()+Constants.HDFS_TABLES_DIR+"/"+tableId);
List<Path> paths = getSnapshotPaths(tableDir);
if (paths.size() == 0) {
throw new RuntimeException("Unable to compute snapshot path for: "+tableDir.toString());
}
if (paths.size() > 1) {
throw new RuntimeException("Too many snapshot paths computed for: "+tableDir.toString());
}
Path snapshotPath = null;
try {
LOG.debug("Creating snapshot for table {} at {}", tableId, paths.get(0));
snapshotPath = dfs.createSnapshot(paths.get(0), entry.getUUID().toString());
LOG.debug("Snapshot created at {}", snapshotPath);
//Return the snapshot path plus the table dir because nested snapshots are not allowed
return new Path(snapshotPath.toString() + "/" + Constants.HDFS_TABLES_DIR +"/"+ tableId);
} catch (SnapshotException e) {
//Because HDFS does not currently support nested snapshots, we can't create snapshots
//in the tables directory.
if (e.getMessage().contains("there is already a snapshot with the same name")) {
LOG.warn("Snapshot already exists.");
return new Path(vol.getBasePath() + "/.snapshot/" + entry.getUUID() +
Constants.HDFS_TABLES_DIR +"/"+ tableId);
} else {
throw e;
}
}
} else {
throw new RuntimeException("Configured Accumulo volume is not an HDFS DistributedFileSystem.");
}
}
开发者ID:dlmarion,项目名称:raccovery,代码行数:35,代码来源:Utils.java
示例6: setDefaults
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
/**
* Set some reasonable defaults for this configuration.
*/
private void setDefaults() {
setMaxWriteLatency(60000L);
setMaxWriteMemory(20L * 1024 * 1024);
setMaxWriteThreads(3);
setMaxWriteTimeout(Long.MAX_VALUE);
setQueryThreads(3);
setAutoFlush(true);
setCreate(false);
setInstanceType(InstanceType.Distributed);
setAuthorizations(Constants.NO_AUTHS);
setSkipExistenceChecks(false);
setPreloadAllProperties(false);
}
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:17,代码来源:AccumuloGraphConfiguration.java
示例7: addDocument
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
protected Mutation addDocument(Store id, Record<?> queryResult) throws IOException {
Mutation m = getDocumentPrefix(id, queryResult, queryResult.docId().getBytes(Constants.UTF8));
// Store the docId as a searchable entry
m.put(Defaults.DOCID_FIELD_NAME, Order.FORWARD + Defaults.NULL_BYTE_STR + queryResult.docId(), queryResult.documentVisibility(), Defaults.EMPTY_VALUE);
// Write the contents for this record once
m.put(Defaults.CONTENTS_COLFAM_TEXT, new Text(), queryResult.documentVisibility(), queryResult.toValue());
return m;
}
开发者ID:joshelser,项目名称:cosmos,代码行数:12,代码来源:CosmosImpl.java
示例8: initScannerAndWriter
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
protected void initScannerAndWriter() throws TableNotFoundException, AccumuloException {
indexScanner = parent.opts.getConnector().createScanner(
parent.opts.getIndexTable(), Constants.NO_AUTHS);
indexWriter = parent.opts.getConnector().createBatchWriter(
parent.opts.getIndexTable(), 1000000L, 10L, 2);
if (parent.opts.getAutoflush()) {
indexWriter = new FlushedBatchWriter(indexWriter);
}
}
开发者ID:mikelieberman,项目名称:blueprints-accumulo-graph,代码行数:11,代码来源:AccumuloKeyIndex.java
示例9: initScannersAndWriter
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
protected void initScannersAndWriter() throws TableNotFoundException, AccumuloException {
scanner = opts.getConnector().createScanner(opts.getGraphTable(), Constants.NO_AUTHS);
batchScanner = opts.getConnector().createBatchScanner(opts.getGraphTable(),
Constants.NO_AUTHS, 2);
writer = opts.getConnector().createBatchWriter(opts.getGraphTable(), 1000000L, 10L, 2);
if (opts.getAutoflush()) {
writer = new FlushedBatchWriter(writer);
}
}
开发者ID:mikelieberman,项目名称:blueprints-accumulo-graph,代码行数:11,代码来源:AccumuloGraph.java
示例10: bytesToCharArray
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
@Override
public String bytesToCharArray(byte[] b) throws IOException {
return new String(b, Constants.UTF8);
}
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:5,代码来源:AccumuloBinaryConverter.java
示例11: bytesToDateTime
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
/**
* NOT IMPLEMENTED
*/
@Override
public DateTime bytesToDateTime(byte[] b) throws IOException {
String s = new String(b, Constants.UTF8);
return DateTime.parse(s);
}
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:9,代码来源:AccumuloBinaryConverter.java
示例12: toBytes
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
@Override
public byte[] toBytes(DateTime dt) throws IOException {
return dt.toString().getBytes(Constants.UTF8);
}
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:5,代码来源:AccumuloBinaryConverter.java
示例13: getState
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
public static State getState(Store id) throws TableNotFoundException {
checkNotNull(id);
Connector con = id.connector();
Scanner s = con.createScanner(id.metadataTable(), Constants.NO_AUTHS);
s.setRange(new Range(id.uuid()));
s.fetchColumnFamily(STATE_COLFAM);
Iterator<Entry<Key,Value>> iter = s.iterator();
if (iter.hasNext()) {
Entry<Key,Value> stateEntry = iter.next();
return deserializeState(stateEntry.getValue());
}
return State.UNKNOWN;
}
开发者ID:joshelser,项目名称:cosmos,代码行数:21,代码来源:PersistedStores.java
示例14: test
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
@Test
public void test() throws Exception {
Store id = Store.create(c, Constants.NO_AUTHS, Collections.<Index> emptySet());
Assert.assertEquals(State.UNKNOWN, PersistedStores.getState(id));
Cosmos s = new CosmosImpl(zk.getConnectString());
s.register(id);
Assert.assertEquals(State.LOADING, PersistedStores.getState(id));
s.finalize(id);
Assert.assertEquals(State.LOADED, PersistedStores.getState(id));
// Would be State.DELETING during this call
s.delete(id);
Assert.assertEquals(State.UNKNOWN, PersistedStores.getState(id));
s.close();
}
开发者ID:joshelser,项目名称:cosmos,代码行数:23,代码来源:SortableResultStateTest.java
示例15: getAuths
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
public static Authorizations getAuths() {
return Constants.NO_AUTHS;
}
开发者ID:hltcoe,项目名称:rebar,代码行数:4,代码来源:Configuration.java
示例16: generateIterator
import org.apache.accumulo.core.Constants; //导入依赖的package包/类
public static Iterator<Entry<Key, Value>> generateIterator(Connector conn, String tableName, Range range) throws TableNotFoundException {
Scanner sc = conn.createScanner(tableName, Constants.NO_AUTHS);
sc.setRange(range);
return sc.iterator();
}
开发者ID:hltcoe,项目名称:rebar,代码行数:6,代码来源:AbstractAccumuloTest.java
注:本文中的org.apache.accumulo.core.Constants类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论