本文整理汇总了Java中org.apache.accumulo.core.client.AccumuloSecurityException类的典型用法代码示例。如果您正苦于以下问题:Java AccumuloSecurityException类的具体用法?Java AccumuloSecurityException怎么用?Java AccumuloSecurityException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccumuloSecurityException类属于org.apache.accumulo.core.client包,在下文中一共展示了AccumuloSecurityException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResult
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
public String getResult() throws IOException, AccumuloSecurityException, AccumuloException, TableNotFoundException {
resultBuilder.append("[");
GeoTemporalTweetQuery query = new GeoTemporalTweetQuery(config);
query.setBoundingBox(
Double.parseDouble(northCoordinate),
Double.parseDouble(eastCoordinate),
Double.parseDouble(southCoordinate),
Double.parseDouble(westCoordinate));
query.setTimeRange(
Long.parseLong(startTime),
Long.parseLong(endTime));
query.setCallback(this);
// start the query -> process is called once for each result
query.query();
resultBuilder.append("]");
return resultBuilder.toString();
}
示例2: calcData
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
@BeforeClass
public static void calcData() throws AccumuloException, AccumuloSecurityException, InterruptedException, IOException {
ZonedDateTime time = ZonedDateTime.parse("Fri Apr 29 09:05:55 +0000 2016", formatterExtract);
ts = time.toEpochSecond();
tweet = "{\"created_at\":\"Fri Apr 29 09:05:55 +0000 2016\",\"id\":725974381906804738,\"id_str\":\"725974381906804738\",\"text\":\"Das sage ich dir gleich, das funktioniert doch nie! #haselnuss\",\"user\":{\"id\":179905182,\"name\":\"Peter Tosh\",\"screen_name\":\"PeTo\"}}";
int bufferSize = tweet.length();
ByteBuffer bb1 = ByteBuffer.allocate(bufferSize);
bb1.put(tweet.getBytes(Charsets.UTF_8));
hash = hashFunction.hashBytes(bb1.array()).asInt();
ByteBuffer bb2 = ByteBuffer.allocate(Long.BYTES + Integer.BYTES);
bb2.putLong(ts).putInt(hash);
bytes = bb2.array();
}
示例3: main
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
public static void main(String[] args) throws AccumuloException, AccumuloSecurityException, MutationsRejectedException, TableExistsException,
TableNotFoundException {
ClientOnRequiredTable opts = new ClientOnRequiredTable();
BatchWriterOpts bwOpts = new BatchWriterOpts();
opts.parseArgs(InsertWithBatchWriter.class.getName(), args, bwOpts);
Connector connector = opts.getConnector();
MultiTableBatchWriter mtbw = connector.createMultiTableBatchWriter(bwOpts.getBatchWriterConfig());
if (!connector.tableOperations().exists(opts.getTableName()))
connector.tableOperations().create(opts.getTableName());
BatchWriter bw = mtbw.getBatchWriter(opts.getTableName());
Text colf = new Text("colfam");
System.out.println("writing ...");
for (int i = 0; i < 10000; i++) {
Mutation m = new Mutation(new Text(String.format("row_%d", i)));
for (int j = 0; j < 5; j++) {
m.put(colf, new Text(String.format("colqual_%d", j)), new Value((String.format("value_%d_%d", i, j)).getBytes()));
}
bw.addMutation(m);
if (i % 100 == 0)
System.out.println(i);
}
mtbw.close();
}
示例4: execute
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
public void execute(Opts opts) throws TableNotFoundException, InterruptedException, AccumuloException, AccumuloSecurityException, TableExistsException {
if (opts.createtable) {
opts.getConnector().tableOperations().create(opts.getTableName());
}
if (opts.createEntries) {
createEntries(opts);
}
if (opts.readEntries) {
readEntries(opts);
}
if (opts.deletetable) {
opts.getConnector().tableOperations().delete(opts.getTableName());
}
}
示例5: createEntries
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
private void createEntries(Opts opts) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
// Trace the write operation. Note, unless you flush the BatchWriter, you will not capture
// the write operation as it is occurs asynchronously. You can optionally create additional Spans
// within a given Trace as seen below around the flush
TraceScope scope = Trace.startSpan("Client Write", Sampler.ALWAYS);
System.out.println("TraceID: " + Long.toHexString(scope.getSpan().getTraceId()));
BatchWriter batchWriter = opts.getConnector().createBatchWriter(opts.getTableName(), new BatchWriterConfig());
Mutation m = new Mutation("row");
m.put("cf", "cq", "value");
batchWriter.addMutation(m);
// You can add timeline annotations to Spans which will be able to be viewed in the Monitor
scope.getSpan().addTimelineAnnotation("Initiating Flush");
batchWriter.flush();
batchWriter.close();
scope.close();
}
示例6: readEntries
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
private void readEntries(Opts opts) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
Scanner scanner = opts.getConnector().createScanner(opts.getTableName(), opts.auths);
// Trace the read operation.
TraceScope readScope = Trace.startSpan("Client Read", Sampler.ALWAYS);
System.out.println("TraceID: " + Long.toHexString(readScope.getSpan().getTraceId()));
int numberOfEntriesRead = 0;
for (Entry<Key,Value> entry : scanner) {
System.out.println(entry.getKey().toString() + " -> " + entry.getValue().toString());
++numberOfEntriesRead;
}
// You can add additional metadata (key, values) to Spans which will be able to be viewed in the Monitor
readScope.getSpan().addKVAnnotation("Number of Entries Read".getBytes(UTF_8), String.valueOf(numberOfEntriesRead).getBytes(UTF_8));
readScope.close();
}
示例7: main
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
/**
* Writes a specified number of entries to Accumulo using a {@link BatchWriter}. The rows of the entries will be sequential starting at a specified number.
* The column families will be "foo" and column qualifiers will be "1". The values will be random byte arrays of a specified size.
*/
public static void main(String[] args) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
Opts opts = new Opts();
BatchWriterOpts bwOpts = new BatchWriterOpts();
opts.parseArgs(SequentialBatchWriter.class.getName(), args, bwOpts);
Connector connector = opts.getConnector();
BatchWriter bw = connector.createBatchWriter(opts.getTableName(), bwOpts.getBatchWriterConfig());
long end = opts.start + opts.num;
for (long i = opts.start; i < end; i++) {
Mutation m = RandomBatchWriter.createMutation(i, opts.valueSize, opts.vis);
bw.addMutation(m);
}
bw.close();
}
示例8: setAccumuloConfigs
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
@Override
public void setAccumuloConfigs(Job job) throws AccumuloSecurityException {
super.setAccumuloConfigs(job);
final String principal = getPrincipal(), tableName = getTableName();
if (tokenFile.isEmpty()) {
AuthenticationToken token = getToken();
AccumuloInputFormat.setConnectorInfo(job, principal, token);
AccumuloOutputFormat.setConnectorInfo(job, principal, token);
} else {
AccumuloInputFormat.setConnectorInfo(job, principal, tokenFile);
AccumuloOutputFormat.setConnectorInfo(job, principal, tokenFile);
}
AccumuloInputFormat.setInputTableName(job, tableName);
AccumuloInputFormat.setScanAuthorizations(job, auths);
AccumuloOutputFormat.setCreateTables(job, true);
AccumuloOutputFormat.setDefaultTableName(job, tableName);
}
示例9: loadBulkFiles
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
private int loadBulkFiles() throws IOException, AccumuloException, AccumuloSecurityException, TableNotFoundException
{
Configuration conf = getConf();
Connector connector = WikipediaConfiguration.getConnector(conf);
FileSystem fs = FileSystem.get(conf);
String directory = WikipediaConfiguration.bulkIngestDir(conf);
String failureDirectory = WikipediaConfiguration.bulkIngestFailureDir(conf);
for(FileStatus status: fs.listStatus(new Path(directory)))
{
if(status.isDir() == false)
continue;
Path dir = status.getPath();
Path failPath = new Path(failureDirectory+"/"+dir.getName());
fs.mkdirs(failPath);
connector.tableOperations().importDirectory(dir.getName(), dir.toString(), failPath.toString(), true);
}
return 0;
}
示例10: ExportTask
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
ExportTask(String instanceName, String zookeepers, String user, String password, String table)
throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
ZooKeeperInstance zki = new ZooKeeperInstance(
new ClientConfiguration().withInstance(instanceName).withZkHosts(zookeepers));
// TODO need to close batch writer
Connector conn = zki.getConnector(user, new PasswordToken(password));
try {
bw = conn.createBatchWriter(table, new BatchWriterConfig());
} catch (TableNotFoundException tnfe) {
try {
conn.tableOperations().create(table);
} catch (TableExistsException e) {
// nothing to do
}
bw = conn.createBatchWriter(table, new BatchWriterConfig());
}
}
示例11: removeIterators
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
private void removeIterators(
final String tablename,
final Connector connector )
throws AccumuloSecurityException,
AccumuloException,
TableNotFoundException {
connector.tableOperations().removeIterator(
tablename,
new IteratorSetting(
FeatureCollectionDataAdapter.ARRAY_TO_ELEMENTS_PRIORITY,
ArrayToElementsIterator.class).getName(),
EnumSet.of(IteratorScope.scan));
connector.tableOperations().removeIterator(
tablename,
new IteratorSetting(
FeatureCollectionDataAdapter.ELEMENTS_TO_ARRAY_PRIORITY,
ElementsToArrayIterator.class).getName(),
EnumSet.of(IteratorScope.scan));
}
示例12: init
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
@Before
public void init() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException {
mock = new MockInstance("accumulo");
PasswordToken pToken = new PasswordToken("pass".getBytes());
conn = mock.getConnector("user", pToken);
config = new BatchWriterConfig();
config.setMaxMemory(1000);
config.setMaxLatency(1000, TimeUnit.SECONDS);
config.setMaxWriteThreads(10);
if (conn.tableOperations().exists("rya_prospects")) {
conn.tableOperations().delete("rya_prospects");
}
if (conn.tableOperations().exists("rya_selectivity")) {
conn.tableOperations().delete("rya_selectivity");
}
arc = new AccumuloRdfConfiguration();
arc.setTableLayoutStrategy(new TablePrefixLayoutStrategy());
arc.setMaxRangesForScanner(300);
}
开发者ID:apache,项目名称:incubator-rya,代码行数:25,代码来源:RdfCloudTripleStoreSelectivityEvaluationStatisticsTest.java
示例13: initialize
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
private void initialize(Properties props) throws AccumuloException, AccumuloSecurityException {
this.p = props;
acConfDir = p.getProperty(AC_CONF_DIR, null);
instanceName = p.getProperty(INSTANCE_NAME, null);
zookeepers = p.getProperty(ZOOKEEPERS, null);
username = p.getProperty(USERNAME, null);
password = p.getProperty(PASSWORD, null);
dataDir = p.getProperty(DATA_DIR, null);
persistenceImpl = p.getProperty(PERSISTENCE_CLASS, InfinispanPersistence.class.getName());
hdfsDir = p.getProperty(HDFS_DIR, null);
Preconditions.checkNotNull(acConfDir, AC_CONF_DIR + " must be configured.");
Preconditions.checkNotNull(instanceName, INSTANCE_NAME + " must be configured.");
Preconditions.checkNotNull(zookeepers, ZOOKEEPERS + " must be configured.");
Preconditions.checkNotNull(username, USERNAME + " must be configured.");
Preconditions.checkNotNull(password, PASSWORD + " must be configured.");
Preconditions.checkNotNull(dataDir, DATA_DIR + " must be configured.");
Preconditions.checkNotNull(hdfsDir, HDFS_DIR + " must be configured.");
LOG.debug("Configuration initialized: {}", this);
}
示例14: doOperation
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
private void doOperation(final SplitStoreFromIterable<String> operation, final AccumuloStore store) throws OperationException {
if (null == operation.getInput()) {
throw new OperationException("Operation input is required.");
}
final SortedSet<Text> splits = new TreeSet<>();
for (final String split : operation.getInput()) {
splits.add(new Text(Base64.decodeBase64(split)));
}
try {
store.getConnection().tableOperations().addSplits(store.getTableName(), splits);
LOGGER.info("Added {} splits to table {}", splits.size(), store.getTableName());
} catch (final TableNotFoundException | AccumuloException | AccumuloSecurityException | StoreException e) {
LOGGER.error("Failed to add {} split points to table {}", splits.size(), store.getTableName());
throw new RuntimeException("Failed to add split points: " + e.getMessage(), e);
}
}
示例15: testCreateExistingTable
import org.apache.accumulo.core.client.AccumuloSecurityException; //导入依赖的package包/类
@Test
public void testCreateExistingTable() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException {
TableOperations tops = connector.tableOperations();
try {
Assert.assertFalse(tops.exists(table));
tops.create(table);
Assert.assertTrue(tops.exists(table));
try {
tops.create(table);
Assert.fail("Expected second table create to fail.");
} catch (TableExistsException tee) {
// expected
Assert.assertTrue(true);
}
} finally {
if (tops.exists(table)) {
tops.delete(table);
}
Assert.assertFalse(tops.exists(table));
}
}