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


Java TableOperations.create方法代码示例

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


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

示例1: 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{
        tableOpts.create(table);
    } catch(Exception e) {}

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

示例2: 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{
        tableOpts.create(table);
    } catch(Exception e) {}

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

示例3: exists_ryaDetailsTable

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

示例4: exists_dataTables

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

示例5: getDetails_instanceDoesNotHaveDetails

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

示例6: 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

示例7: 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

示例8: 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

示例9: createTable

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
/**
 * Creates a table and gives all users read-write access to that table.
 *
 * @param tableName
 *          name of the table.
 */
public static synchronized void createTable(String tableName) throws AccumuloException, AccumuloSecurityException, TableExistsException {
  Connector connector = getConnector();
  TableOperations tableOps = connector.tableOperations();
  tableOps.create(tableName);

  SecurityOperations secOps = connector.securityOperations();
  for (User user : User.getUsers().values()) {
    secOps.grantTablePermission(user.id, tableName, TablePermission.READ);
    secOps.grantTablePermission(user.id, tableName, TablePermission.WRITE);
    secOps.grantTablePermission(user.id, tableName, TablePermission.BULK_IMPORT);
  }
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:19,代码来源:AccumuloInstance.java

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: testTableOps

import org.apache.accumulo.core.client.admin.TableOperations; //导入方法依赖的package包/类
@Test
public void testTableOps() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
  TableOperations tops = connector.tableOperations();

  Assert.assertFalse(tops.exists(table));
  tops.create(table);
  Assert.assertTrue(tops.exists(table));
  tops.delete(table);
  Assert.assertFalse(tops.exists(table));
}
 
开发者ID:JHUAPL,项目名称:accumulo-proxy-instance,代码行数:11,代码来源:TableOpsTest.java

示例15: 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


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