当前位置: 首页>>代码示例>>Java>>正文


Java TableOperations.exists方法代码示例

本文整理汇总了Java中org.apache.accumulo.core.client.admin.TableOperations.exists方法的典型用法代码示例。如果您正苦于以下问题:Java TableOperations.exists方法的具体用法?Java TableOperations.exists怎么用?Java TableOperations.exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.accumulo.core.client.admin.TableOperations的用法示例。


在下文中一共展示了TableOperations.exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exists

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
@Override
public boolean exists(final String instanceName) throws RyaClientException {
    requireNonNull( instanceName );

    final TableOperations tableOps = getConnector().tableOperations();

    // Newer versions of Rya will have a Rya Details table.
    final String ryaDetailsTableName = instanceName + AccumuloRyaInstanceDetailsRepository.INSTANCE_DETAILS_TABLE_NAME;
    if(tableOps.exists(ryaDetailsTableName)) {
        return true;
    }

    // However, older versions only have the data tables.
    final String spoTableName = instanceName + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX;
    final String posTableName = instanceName + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX;
    final String ospTableName = instanceName + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX;
    if(tableOps.exists(spoTableName) && tableOps.exists(posTableName) && tableOps.exists(ospTableName)) {
        return true;
    }

    return false;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:23,代码来源:AccumuloInstanceExists.java

示例2: ProspectorService

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的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.
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:25,代码来源:ProspectorService.java

示例3: testCreateExistingTable

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的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));
  }
}
 
开发者ID:JHUAPL,项目名称:accumulo-proxy-instance,代码行数:23,代码来源:TableOpsTest.java

示例4: createTables

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
private void createTables(Connector connector) throws AccumuloException, AccumuloSecurityException {
    TableOperations tops = connector.tableOperations();

    try {
        if (!tops.exists(table)) {
            tops.create(table);
        }

        if (!tops.exists(indexTable)) {
            tops.create(indexTable);
        }
    } catch (TableExistsException e) {
        // shouldn't happen as we check for table existence prior to each create() call
        throw new AccumuloException(e);
    }
}
 
开发者ID:tequalsme,项目名称:accumulo-starter,代码行数:17,代码来源:MessageWriter.java

示例5: createBatchWriter

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
/**
 * creates a batchwriter to write data to accumulo
 *
 * @param table to write data into
 * @return a ready to user batch writer object
 * @throws AccumuloSecurityException
 * @throws AccumuloException
 * @throws TableNotFoundException
 */
private BatchWriter createBatchWriter(String table) throws AccumuloSecurityException, AccumuloException, TableNotFoundException, TableExistsException {
    final BatchWriterConfig bwConfig = new BatchWriterConfig();
    // buffer max 100kb ( 100 * 1024 = 102400)
    bwConfig.setMaxMemory(102400);
    // buffer max 10 seconds
    bwConfig.setMaxLatency(10, TimeUnit.SECONDS);
    // ensure persistance
    bwConfig.setDurability(Durability.SYNC);

    // build the accumulo connector
    Instance inst = new ZooKeeperInstance(cfg.accumuloInstanceName, cfg.accumuloZookeeper);
    conn = inst.getConnector(cfg.accumuloUser, new PasswordToken(cfg.accumuloPassword));
    Authorizations auths = new Authorizations(AccumuloIdentifiers.AUTHORIZATION.toString());

    // create the table if not already existent
    TableOperations tableOpts = conn.tableOperations();
    try{
        if(!tableOpts.exists(table)) {
            tableOpts.create(table);
            // create the presplits for the table
            TreeSet<Text> splits = new TreeSet<Text>();
            for (int i = 0; i <= 255; i++) {
                byte[] bytes = {(byte) i};
                splits.add(new Text(bytes));
            }
            tableOpts.addSplits(table, splits);
        }
    } catch(Exception e) {
        log.error(e);
    }

    // build and return the batchwriter
    return conn.createBatchWriter(table, bwConfig);
}
 
开发者ID:IIDP,项目名称:OSTMap,代码行数:44,代码来源:GeoTemporalIndexSink.java

示例6: createTable

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
public static void createTable()
{
  TableOperations tableoper = con.tableOperations();
  if (!tableoper.exists("tab1")) {
    try {
      tableoper.create("tab1");
    } catch (Exception e) {
      logger.error("error in test helper");
      DTThrowable.rethrow(e);
    }

  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:14,代码来源:AccumuloTestHelper.java

示例7: createTableIfNotExist

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
public static void createTableIfNotExist(TableOperations tableOperations, String tableName) throws AccumuloException, AccumuloSecurityException, TableExistsException {
    boolean tableExists = tableOperations.exists(tableName);
    if (!tableExists) {
        logger.debug("Creating accumulo table: " + tableName);
        tableOperations.create(tableName);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:8,代码来源:AccumuloRdfUtils.java

示例8: createTableIfNotExists

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
/**
 * @param conf
 * @param tablename
 * @return if the table was created
 * @throws AccumuloException
 * @throws AccumuloSecurityException
 * @throws TableExistsException
 */
public static boolean createTableIfNotExists(final Configuration conf, final String tablename)
        throws AccumuloException, AccumuloSecurityException, TableExistsException {
    final TableOperations tops = getConnector(conf).tableOperations();
    if (!tops.exists(tablename)) {
        logger.info("Creating table: " + tablename);
        tops.create(tablename);
        return true;
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:19,代码来源:ConfigUtils.java

示例9: tearDown

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@After
public void tearDown() throws Exception {
	String indexTableName = tIndexer.getTableName();
    tIndexer.close();
    TableOperations tableOps = ConfigUtils.getConnector(conf).tableOperations();

    if (tableOps.exists(indexTableName))
        tableOps.delete(indexTableName);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:13,代码来源:AccumuloTemporalIndexerTest.java

示例10: destroyTable

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
private static void destroyTable(Configuration conf, String tablename) throws AccumuloException, AccumuloSecurityException,
        TableNotFoundException, TableExistsException {
    TableOperations tableOps = ConfigUtils.getConnector(conf).tableOperations();
    if (tableOps.exists(tablename)) {
        tableOps.delete(tablename);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:8,代码来源:AccumuloFreeTextIndexerTest.java

示例11: init

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
@Before
public void init() throws AccumuloException, AccumuloSecurityException,
    RyaDAOException, RepositoryException, TableNotFoundException,
    InferenceEngineException, NumberFormatException, UnknownHostException, SailException {
    accumuloConn = ConfigUtils.getConnector(conf);
    final TableOperations ops = accumuloConn.tableOperations();
    if(ops.exists(prefix+"INDEX_"+ "testPcj")) {
        ops.delete(prefix+"INDEX_"+ "testPcj");
    }
    ryaRepo = new RyaSailRepository(RyaSailFactory.getInstance(conf));
    ryaConn = ryaRepo.getConnection();
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:13,代码来源:AccumuloIndexSetTest.java

示例12: deleteCoreRyaTables

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
public static void deleteCoreRyaTables(final Connector accCon, final String prefix)
        throws AccumuloException, AccumuloSecurityException,
        TableNotFoundException {
    final TableOperations ops = accCon.tableOperations();
    if (ops.exists(prefix + "spo")) {
        ops.delete(prefix + "spo");
    }
    if (ops.exists(prefix + "po")) {
        ops.delete(prefix + "po");
    }
    if (ops.exists(prefix + "osp")) {
        ops.delete(prefix + "osp");
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:15,代码来源:PcjIntegrationTestingUtil.java

示例13: deleteIndexTables

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
public static void deleteIndexTables(final Connector accCon, final int tableNum,
        final String prefix) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException {
    final TableOperations ops = accCon.tableOperations();
    final String tablename = prefix + "INDEX_";
    for (int i = 1; i < tableNum + 1; i++) {
        if (ops.exists(tablename + i)) {
            ops.delete(tablename + i);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:12,代码来源:PcjIntegrationTestingUtil.java

示例14: clear

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
/**
 * Clear out this graph. This drops and recreates the backing tables.
 */
public void clear() {
  shutdown();

  try {
    TableOperations tableOps = globals.getConfig()
        .getConnector().tableOperations();
    for (Index<? extends Element> index : getIndices()) {
      tableOps.delete(((AccumuloIndex<? extends Element>)
          index).getTableName());
    }

    for (String table : globals.getConfig().getTableNames()) {
      if (tableOps.exists(table)) {
        tableOps.delete(table);
        tableOps.create(table);

        SortedSet<Text> splits = globals.getConfig().getSplits();
        if (splits != null) {
          tableOps.addSplits(table, splits);
        }
      }
    }
  } catch (Exception e) {
    throw new AccumuloGraphException(e);
  }
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:30,代码来源:AccumuloGraph.java

示例15: createTableIfNotExists

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
public void createTableIfNotExists() throws AccumuloException, AccumuloSecurityException {
  TableOperations tableOps = getConnector().tableOperations();
  try {
    if (! tableOps.exists(config.table)) {
      tableOps.create(config.table);
    }
  } catch (TableExistsException e) {
    logger.warn("table came into existence between calls: {}",
      e.getMessage());
  }
}
 
开发者ID:hltcoe,项目名称:concrete-java,代码行数:12,代码来源:SimpleAccumulo.java


注:本文中的org.apache.accumulo.core.client.admin.TableOperations.exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。