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


Java Connector类代码示例

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


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

示例1: clearTablesResetConf

import org.apache.accumulo.core.client.Connector; //导入依赖的package包/类
@Before
public void clearTablesResetConf() throws Exception {
    Connector con = mac.getConnector(MAC_ROOT_USER, MAC_ROOT_PASSWORD);
    con.tableOperations().list().forEach(t -> {
        if (t.startsWith("qonduit")) {
            try {
                con.tableOperations().delete(t);
            } catch (Exception e) {
            }
        }
    });
    // Reset configuration
    conf = TestConfiguration.createMinimalConfigurationForTest();
    conf.getAccumulo().setInstanceName(mac.getInstanceName());
    conf.getAccumulo().setZookeepers(mac.getZooKeepers());
    conf.getSecurity().getSsl().setUseOpenssl(false);
    conf.getSecurity().getSsl().setUseGeneratedKeypair(true);
}
 
开发者ID:NationalSecurityAgency,项目名称:qonduit,代码行数:19,代码来源:MacITBase.java

示例2: SignedBatchWriter

import org.apache.accumulo.core.client.Connector; //导入依赖的package包/类
/**
 * Create an signed batch tableWriter.
 *
 * @param connector
 *          The connector for the Accumulo instance.
 * @param tableName
 *          Name of the table to write to.
 * @param batchConfig
 *          Configuration for a {@link BatchWriter}.
 * @param signatureConfig
 *          Configuration for the signatures.
 * @param keys
 *          Container with the keys to use for signatures.
 */
public SignedBatchWriter(Connector connector, String tableName, BatchWriterConfig batchConfig, SignatureConfig signatureConfig, SignatureKeyContainer keys)
    throws TableNotFoundException {
  checkArgument(connector != null, "connector is null");
  checkArgument(tableName != null, "tableName is null");
  checkArgument(signatureConfig != null, "signatureConfig is null");
  checkArgument(keys != null, "keys is null");

  this.tableWriter = connector.createBatchWriter(tableName, batchConfig);
  this.signer = new EntrySigner(signatureConfig, keys);
  this.signatureConfig = signatureConfig;

  if (signatureConfig.destination == SignatureConfig.Destination.SEPARATE_TABLE) {
    this.signatureTableWriter = connector.createBatchWriter(signatureConfig.destinationTable, batchConfig);
  } else {
    this.signatureTableWriter = null;
  }
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:32,代码来源:SignedBatchWriter.java

示例3: SignedScanner

import org.apache.accumulo.core.client.Connector; //导入依赖的package包/类
/**
 * Create an signed scanner.
 *
 * @param connector
 *          The connector for the Accumulo instance.
 * @param tableName
 *          Name of the table to write to.
 * @param authorizations
 *          The authorizations this user has for querying Accumulo.
 * @param signatureConfig
 *          Configuration for the verification.
 * @param keys
 *          Container with the keys to use for signatures.
 */
public SignedScanner(Connector connector, String tableName, Authorizations authorizations, SignatureConfig signatureConfig, SignatureKeyContainer keys)
    throws TableNotFoundException {
  checkArgument(connector != null, "connection is null");
  checkArgument(tableName != null, "tableName is null");
  checkArgument(authorizations != null, "authorizations is null");
  checkArgument(signatureConfig != null, "config is null");
  checkArgument(keys != null, "keys is null");

  this.valueScanner = connector.createScanner(tableName, authorizations);
  this.verifier = new EntrySigner(signatureConfig, keys);

  if (signatureConfig.destination == SignatureConfig.Destination.SEPARATE_TABLE) {
    this.signatureScanner = connector.createScanner(signatureConfig.destinationTable, authorizations);
  } else {
    this.signatureScanner = null;
  }
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:32,代码来源:SignedScanner.java

示例4: SignedBatchScanner

import org.apache.accumulo.core.client.Connector; //导入依赖的package包/类
/**
 * Create an encrypted batch scanner.
 *
 * @param connector
 *          The connector for the Accumulo instance.
 * @param tableName
 *          Name of the table to write to.
 * @param authorizations
 *          The authorizations this user has for querying Accumulo.
 * @param numQueryThreads
 *          Maximimum number of query threads to use for this scanner.
 * @param signatureConfig
 *          Configuration for the decryption.
 * @param keys
 *          Container with the keys to use for decryption.
 */
public SignedBatchScanner(Connector connector, String tableName, Authorizations authorizations, int numQueryThreads, SignatureConfig signatureConfig,
    SignatureKeyContainer keys) throws TableNotFoundException {
  checkArgument(connector != null, "connection is null");
  checkArgument(tableName != null, "tableName is null");
  checkArgument(authorizations != null, "authorizations is null");
  checkArgument(signatureConfig != null, "config is null");
  checkArgument(keys != null, "keys is null");

  this.valueScanner = connector.createBatchScanner(tableName, authorizations, numQueryThreads);
  this.verifier = new EntrySigner(signatureConfig, keys);

  if (signatureConfig.destination == SignatureConfig.Destination.SEPARATE_TABLE) {
    this.signatureScanner = connector.createBatchScanner(signatureConfig.destinationTable, authorizations, numQueryThreads);
  } else {
    this.signatureScanner = null;
  }
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:34,代码来源:SignedBatchScanner.java

示例5: main

import org.apache.accumulo.core.client.Connector; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

        try (ConfigurableApplicationContext ctx = new SpringApplicationBuilder(SpringBootstrap.class)
                .bannerMode(Mode.OFF).web(false).run(args)) {
            Configuration conf = ctx.getBean(Configuration.class);

            final BaseConfiguration apacheConf = new BaseConfiguration();
            Configuration.Accumulo accumuloConf = conf.getAccumulo();
            apacheConf.setProperty("instance.name", accumuloConf.getInstanceName());
            apacheConf.setProperty("instance.zookeeper.host", accumuloConf.getZookeepers());
            final ClientConfiguration aconf = new ClientConfiguration(Collections.singletonList(apacheConf));
            final Instance instance = new ZooKeeperInstance(aconf);
            Connector con = instance.getConnector(accumuloConf.getUsername(),
                    new PasswordToken(accumuloConf.getPassword()));
            Scanner s = con.createScanner(conf.getMetaTable(),
                    con.securityOperations().getUserAuthorizations(con.whoami()));
            try {
                s.setRange(new Range(Meta.METRIC_PREFIX, true, Meta.TAG_PREFIX, false));
                for (Entry<Key, Value> e : s) {
                    System.out.println(e.getKey().getRow().toString().substring(Meta.METRIC_PREFIX.length()));
                }
            } finally {
                s.close();
            }
        }
    }
 
开发者ID:NationalSecurityAgency,项目名称:timely,代码行数:27,代码来源:GetMetricTableSplitPoints.java

示例6: clearTablesResetConf

import org.apache.accumulo.core.client.Connector; //导入依赖的package包/类
@Before
public void clearTablesResetConf() throws Exception {
    Connector con = mac.getConnector(MAC_ROOT_USER, MAC_ROOT_PASSWORD);
    con.tableOperations().list().forEach(t -> {
        if (t.startsWith("timely")) {
            try {
                con.tableOperations().delete(t);
            } catch (Exception e) {
            }
        }
    });
    // Reset configuration
    conf = TestConfiguration.createMinimalConfigurationForTest();
    conf.getAccumulo().setInstanceName(mac.getInstanceName());
    conf.getAccumulo().setZookeepers(mac.getZooKeepers());
    conf.getSecurity().getSsl().setUseOpenssl(false);
    conf.getSecurity().getSsl().setUseGeneratedKeypair(true);
    conf.getWebsocket().setFlushIntervalSeconds(TestConfiguration.WAIT_SECONDS);
    HashMap<String, Integer> ageOffSettings = new HashMap<>();
    ageOffSettings.put(MetricAgeOffIterator.DEFAULT_AGEOFF_KEY, 7);
    conf.setMetricAgeOffDays(ageOffSettings);
}
 
开发者ID:NationalSecurityAgency,项目名称:timely,代码行数:23,代码来源:MacITBase.java

示例7: main

import org.apache.accumulo.core.client.Connector; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  Opts opts = new Opts();
  BatchWriterOpts bwOpts = new BatchWriterOpts();
  opts.parseArgs(FileDataIngest.class.getName(), args, bwOpts);

  Connector conn = opts.getConnector();
  if (!conn.tableOperations().exists(opts.getTableName())) {
    conn.tableOperations().create(opts.getTableName());
    conn.tableOperations().attachIterator(opts.getTableName(), new IteratorSetting(1, ChunkCombiner.class));
  }
  BatchWriter bw = conn.createBatchWriter(opts.getTableName(), bwOpts.getBatchWriterConfig());
  FileDataIngest fdi = new FileDataIngest(opts.chunkSize, opts.visibility);
  for (String filename : opts.files) {
    fdi.insertFileData(filename, bw);
  }
  bw.close();
  //TODO
  //opts.stopTracing();
}
 
开发者ID:apache,项目名称:accumulo-examples,代码行数:20,代码来源:FileDataIngest.java

示例8: main

import org.apache.accumulo.core.client.Connector; //导入依赖的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();
}
 
开发者ID:apache,项目名称:accumulo-examples,代码行数:27,代码来源:InsertWithBatchWriter.java

示例9: main

import org.apache.accumulo.core.client.Connector; //导入依赖的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();
}
 
开发者ID:apache,项目名称:accumulo-examples,代码行数:21,代码来源:SequentialBatchWriter.java

示例10: main

import org.apache.accumulo.core.client.Connector; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  Opts opts = new Opts();
  BatchScannerOpts bsOpts = new BatchScannerOpts();
  opts.parseArgs(Query.class.getName(), args, bsOpts);
  Connector conn = opts.getConnector();
  BatchScanner bs = conn.createBatchScanner(opts.getTableName(), opts.auths, bsOpts.scanThreads);
  bs.setTimeout(bsOpts.scanTimeout, TimeUnit.MILLISECONDS);
  if (opts.useSample) {
    SamplerConfiguration samplerConfig = conn.tableOperations().getSamplerConfiguration(opts.getTableName());
    CutoffIntersectingIterator.validateSamplerConfig(conn.tableOperations().getSamplerConfiguration(opts.getTableName()));
    bs.setSamplerConfiguration(samplerConfig);
  }
  for (String entry : query(bs, opts.terms, opts.sampleCutoff))
    System.out.println("  " + entry);

  bs.close();
}
 
开发者ID:apache,项目名称:accumulo-examples,代码行数:18,代码来源:Query.java

示例11: main

import org.apache.accumulo.core.client.Connector; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  Opts opts = new Opts();
  ScannerOpts scanOpts = new ScannerOpts();
  BatchWriterOpts bwOpts = new BatchWriterOpts();
  opts.parseArgs(Reverse.class.getName(), args, scanOpts, bwOpts);

  Connector conn = opts.getConnector();

  Scanner scanner = conn.createScanner(opts.shardTable, opts.auths);
  scanner.setBatchSize(scanOpts.scanBatchSize);
  BatchWriter bw = conn.createBatchWriter(opts.doc2TermTable, bwOpts.getBatchWriterConfig());

  for (Entry<Key,Value> entry : scanner) {
    Key key = entry.getKey();
    Mutation m = new Mutation(key.getColumnQualifier());
    m.put(key.getColumnFamily(), new Text(), new Value(new byte[0]));
    bw.addMutation(m);
  }

  bw.close();

}
 
开发者ID:apache,项目名称:accumulo-examples,代码行数:23,代码来源:Reverse.java

示例12: content

import org.apache.accumulo.core.client.Connector; //导入依赖的package包/类
public Results content(String query, String auths) {
  log.info("Content query: " + query);
  Connector connector = null;
  if (null == instanceName || null == zooKeepers || null == username || null == password)
    throw new EJBException("Required parameters not set. [instanceName = " + this.instanceName + ", zookeepers = " + this.zooKeepers + ", username = "
        + this.username + (password==null?", password = null":"") + "]. Check values in ejb-jar.xml");
  Instance instance = new ZooKeeperInstance(this.instanceName, this.zooKeepers);
  try {
    log.info("Connecting to [instanceName = " + this.instanceName + ", zookeepers = " + this.zooKeepers + ", username = " + this.username + "].");
    connector = instance.getConnector(this.username, new PasswordToken(this.password.getBytes()));
  } catch (Exception e) {
    throw new EJBException("Error getting connector from instance", e);
  }
  
  // Create list of auths
  List<String> authorizations = new ArrayList<String>();
  if (auths != null && auths.length() > 0)
    for (String a : auths.split(","))
      authorizations.add(a);
  ContentLogic table = new ContentLogic();
  table.setTableName(tableName);
  return table.runQuery(connector, query, authorizations);
  
}
 
开发者ID:apache,项目名称:accumulo-wikisearch,代码行数:25,代码来源:Query.java

示例13: loadBulkFiles

import org.apache.accumulo.core.client.Connector; //导入依赖的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;
}
 
开发者ID:apache,项目名称:accumulo-wikisearch,代码行数:24,代码来源:WikipediaPartitionedIngester.java

示例14: compactTransient

import org.apache.accumulo.core.client.Connector; //导入依赖的package包/类
/**
 * Compact all transient regions that were registered using {@link TransientRegistry}
 */
public static void compactTransient(FluoConfiguration fluoConfig) throws Exception {
  Connector conn = getConnector(fluoConfig);

  try (FluoClient client = FluoFactory.newClient(fluoConfig)) {
    SimpleConfiguration appConfig = client.getAppConfiguration();

    TransientRegistry transientRegistry = new TransientRegistry(appConfig);
    List<RowRange> ranges = transientRegistry.getTransientRanges();

    for (RowRange r : ranges) {
      long t1 = System.currentTimeMillis();
      conn.tableOperations().compact(fluoConfig.getAccumuloTable(),
          new Text(r.getStart().toArray()), new Text(r.getEnd().toArray()), true, true);
      long t2 = System.currentTimeMillis();
      logger.info("Compacted {} in {}ms", r, (t2 - t1));
    }
  }
}
 
开发者ID:apache,项目名称:fluo-recipes,代码行数:22,代码来源:TableOperations.java

示例15: removeIterators

import org.apache.accumulo.core.client.Connector; //导入依赖的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));
}
 
开发者ID:ngageoint,项目名称:geowave-benchmark,代码行数:21,代码来源:FeatureCollectionDataAdapterBenchmark.java


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