本文整理汇总了Java中org.apache.accumulo.core.client.TableExistsException类的典型用法代码示例。如果您正苦于以下问题:Java TableExistsException类的具体用法?Java TableExistsException怎么用?Java TableExistsException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TableExistsException类属于org.apache.accumulo.core.client包,在下文中一共展示了TableExistsException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的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();
}
示例2: execute
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的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());
}
}
示例3: ExportTask
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的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());
}
}
示例4: init
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的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
示例5: init
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的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);
res = new ProspectorServiceEvalStatsDAO(conn, arc);
}
示例6: getQueryIds
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的package包/类
/**
* This test ensures that when there are PCJ tables in Accumulo as well as
* the Fluo table's export destinations column, the command for fetching the
* list of queries only includes queries that appear in both places.
*/
@Test
public void getQueryIds() throws AccumuloException, AccumuloSecurityException, TableExistsException {
try(FluoClient fluoClient = FluoFactory.newClient(super.getFluoConfiguration())) {
// Store a few SPARQL/Query ID pairs in the Fluo table.
try(Transaction tx = fluoClient.newTransaction()) {
tx.set("SPARQL_3", QUERY_NODE_ID, "ID_3");
tx.set("SPARQL_1", QUERY_NODE_ID, "ID_1");
tx.set("SPARQL_4", QUERY_NODE_ID, "ID_4");
tx.set("SPARQL_2", QUERY_NODE_ID, "ID_2");
tx.commit();
}
// Ensure the correct list of Query IDs is retured.
final List<String> expected = Lists.newArrayList("ID_1", "ID_2", "ID_3", "ID_4");
final List<String> queryIds = new ListQueryIds().listQueryIds(fluoClient);
assertEquals(expected, queryIds);
}
}
示例7: createTableIfNeeded
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的package包/类
/**
* Creates the child table if it doesn't already exist.
* @param childTableName the name of the child table.
* @throws IOException
*/
public void createTableIfNeeded(final String childTableName) throws IOException {
try {
final Configuration childConfig = MergeToolMapper.getChildConfig(conf);
final AccumuloRdfConfiguration childAccumuloRdfConfiguration = new AccumuloRdfConfiguration(childConfig);
childAccumuloRdfConfiguration.setTablePrefix(childTablePrefix);
final Connector childConnector = AccumuloRyaUtils.setupConnector(childAccumuloRdfConfiguration);
if (!childConnector.tableOperations().exists(childTableName)) {
log.info("Creating table: " + childTableName);
childConnector.tableOperations().create(childTableName);
log.info("Created table: " + childTableName);
log.info("Granting authorizations to table: " + childTableName);
childConnector.securityOperations().grantTablePermission(childUserName, childTableName, TablePermission.WRITE);
log.info("Granted authorizations to table: " + childTableName);
}
} catch (TableExistsException | AccumuloException | AccumuloSecurityException e) {
throw new IOException(e);
}
}
示例8: initReadWrite
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的package包/类
/**
* Initialize for writable use.
* This is called from the DAO, perhaps others.
*/
private void initReadWrite() throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
TableExistsException, RyaClientException {
if (mtbw == null)
throw new RyaClientException("Failed to initialize temporal index, setMultiTableBatchWriter() was not set.");
if (conf == null)
throw new RyaClientException("Failed to initialize temporal index, setConf() was not set.");
if (temporalIndexTableName==null)
throw new RyaClientException("Failed to set temporalIndexTableName==null.");
// Now do all the writable setup, read should already be complete.
// Create one index table on first run.
Boolean isCreated = ConfigUtils.createTableIfNotExists(conf, temporalIndexTableName);
if (isCreated) {
logger.info("First run, created temporal index table: " + temporalIndexTableName);
}
temporalIndexBatchWriter = mtbw.getBatchWriter(temporalIndexTableName);
}
示例9: exists_ryaDetailsTable
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的package包/类
@Test
public void exists_ryaDetailsTable() throws AccumuloException, AccumuloSecurityException, RyaClientException, TableExistsException {
final Connector connector = getConnector();
final TableOperations tableOps = connector.tableOperations();
// Create the Rya instance's Rya details table.
final String instanceName = "test_instance_";
final String ryaDetailsTable = instanceName + AccumuloRyaInstanceDetailsRepository.INSTANCE_DETAILS_TABLE_NAME;
tableOps.create(ryaDetailsTable);
// Verify the command reports the instance exists.
final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(
getUsername(),
getPassword().toCharArray(),
getInstanceName(),
getZookeepers());
final AccumuloInstanceExists instanceExists = new AccumuloInstanceExists(connectionDetails, getConnector());
assertTrue( instanceExists.exists(instanceName) );
}
示例10: exists_dataTables
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的package包/类
@Test
public void exists_dataTables() throws AccumuloException, AccumuloSecurityException, RyaClientException, TableExistsException {
final Connector connector = getConnector();
final TableOperations tableOps = connector.tableOperations();
// Create the Rya instance's Rya details table.
final String instanceName = "test_instance_";
final String spoTableName = instanceName + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX;
final String ospTableName = instanceName + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX;
final String poTableName = instanceName + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX;
tableOps.create(spoTableName);
tableOps.create(ospTableName);
tableOps.create(poTableName);
// Verify the command reports the instance exists.
final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(
getUsername(),
getPassword().toCharArray(),
getInstanceName(),
getZookeepers());
final AccumuloInstanceExists instanceExists = new AccumuloInstanceExists(connectionDetails, getConnector());
assertTrue( instanceExists.exists(instanceName) );
}
示例11: getDetails_instanceDoesNotHaveDetails
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的package包/类
@Test
public void getDetails_instanceDoesNotHaveDetails() throws AccumuloException, AccumuloSecurityException, InstanceDoesNotExistException, RyaClientException, TableExistsException {
// Mimic a pre-details rya install.
final TableOperations tableOps = getConnector().tableOperations();
final String spoTableName = getRyaInstanceName() + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX;
final String ospTableName = getRyaInstanceName() + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX;
final String poTableName = getRyaInstanceName() + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX;
tableOps.create(spoTableName);
tableOps.create(ospTableName);
tableOps.create(poTableName);
// Verify that the operation returns empty.
final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(
getUsername(),
getPassword().toCharArray(),
getInstanceName(),
getZookeepers());
final GetInstanceDetails getInstanceDetails = new AccumuloGetInstanceDetails(connectionDetails, getConnector());
final Optional<RyaDetails> details = getInstanceDetails.getDetails(getRyaInstanceName());
assertFalse( details.isPresent() );
}
示例12: testStoreStatementBadInterval
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的package包/类
/**
* Test method for {@link AccumuloTemporalIndexer#storeStatement(convertStatement(org.openrdf.model.Statement)}
*
* @throws NoSuchAlgorithmException
*/
@Test
public void testStoreStatementBadInterval() throws IOException, AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException, NoSuchAlgorithmException {
// count rows expected to store:
int rowsStoredExpected = 0;
ValueFactory vf = new ValueFactoryImpl();
URI pred1_atTime = vf.createURI(URI_PROPERTY_AT_TIME);
// Test: Should not store an improper date interval, and log a warning (log warning not tested).
final String invalidDateIntervalString="[bad,interval]";
// Silently logs a warning for bad dates.
tIndexer.storeStatement(convertStatement(new StatementImpl(vf.createURI("foo:subj1"), pred1_atTime, vf.createLiteral(invalidDateIntervalString))));
final String validDateIntervalString="[2016-12-31T20:59:59-05:00,2016-12-31T21:00:00-05:00]";
tIndexer.storeStatement(convertStatement(new StatementImpl(vf.createURI("foo:subj2"), pred1_atTime, vf.createLiteral(validDateIntervalString))));
rowsStoredExpected++;
tIndexer.flush();
int rowsStoredActual = printTables("junit testing: Temporal intervals stored in testStoreStatement", null, null);
Assert.assertEquals("Only good intervals should be stored.", rowsStoredExpected*2, rowsStoredActual); // 2 index entries per interval statement
}
示例13: ProspectorService
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的package包/类
/**
* Constructs an instance of {@link ProspectorService}.
*
* @param connector - The Accumulo connector used to communicate with the table. (not null)
* @param tableName - The name of the Accumulo table that will be queried for Prospect results. (not null)
* @throws AccumuloException A problem occurred while creating the table.
* @throws AccumuloSecurityException A problem occurred while creating the table.
*/
public ProspectorService(Connector connector, String tableName) throws AccumuloException, AccumuloSecurityException {
this.connector = requireNonNull(connector);
this.tableName = requireNonNull(tableName);
this.plans = ProspectorUtils.planMap(manager.getPlans());
// Create the table if it doesn't already exist.
try {
final TableOperations tos = connector.tableOperations();
if(!tos.exists(tableName)) {
tos.create(tableName);
}
} catch(TableExistsException e) {
// Do nothing. Something else must have made it while we were.
}
}
示例14: init
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的package包/类
@Before
public void init() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
c = mockInstance.getConnector("root", new PasswordToken(""));
if (c.tableOperations().exists("rya_prospects")) {
c.tableOperations().delete("rya_prospects");
}
if (c.tableOperations().exists("rya_selectivity")) {
c.tableOperations().delete("rya_selectivity");
}
if (c.tableOperations().exists("rya_spo")) {
c.tableOperations().delete("rya_spo");
}
c.tableOperations().create("rya_spo");
c.tableOperations().create("rya_prospects");
c.tableOperations().create("rya_selectivity");
ryaContext = RyaTripleContext.getInstance(new AccumuloRdfConfiguration(getConfig()));
}
示例15: init
import org.apache.accumulo.core.client.TableExistsException; //导入依赖的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();
res = new ProspectorServiceEvalStatsDAO(conn, arc);
arc.setTableLayoutStrategy(new TablePrefixLayoutStrategy());
arc.setMaxRangesForScanner(300);
}