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


Java AccumuloException类代码示例

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


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

示例1: getResult

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

示例2: install_alreadyExists

import org.apache.accumulo.core.client.AccumuloException; //导入依赖的package包/类
@Test(expected = DuplicateInstanceNameException.class)
public void install_alreadyExists() throws DuplicateInstanceNameException, RyaClientException, AccumuloException, AccumuloSecurityException {
    // Install an instance of Rya.
    final String instanceName = getRyaInstanceName();
    final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(
    		getUsername(),
    		getPassword().toCharArray(),
    		getInstanceName(),
    		getZookeepers());

    final RyaClient ryaClient = AccumuloRyaClientFactory.build(connectionDetails, getConnector());
    
    final InstallConfiguration installConfig = InstallConfiguration.builder().build();
    ryaClient.getInstall().install(instanceName, installConfig);

    // Install it again.
    ryaClient.getInstall().install(instanceName, installConfig);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:19,代码来源:AccumuloInstallIT.java

示例3: calcData

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

示例4: main

import org.apache.accumulo.core.client.AccumuloException; //导入依赖的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

示例5: execute

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

示例6: createEntries

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

示例7: readEntries

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

示例8: main

import org.apache.accumulo.core.client.AccumuloException; //导入依赖的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

示例9: loadBulkFiles

import org.apache.accumulo.core.client.AccumuloException; //导入依赖的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

示例10: setupRya

import org.apache.accumulo.core.client.AccumuloException; //导入依赖的package包/类
/**
 * Format a Mini Accumulo to be a Rya repository.
 *
 * @return The Rya repository sitting on top of the Mini Accumulo.
 */
private RyaSailRepository setupRya() throws AccumuloException, AccumuloSecurityException, RepositoryException {
    // Setup the Rya Repository that will be used to create Repository Connections.
    final RdfCloudTripleStore ryaStore = new RdfCloudTripleStore();
    final AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
    crdfdao.setConnector( cluster.getConnector() );

    // Setup Rya configuration values.
    final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix(getRyaInstanceName());
    conf.setDisplayQueryPlan(true);

    conf.setBoolean(USE_MOCK_INSTANCE, false);
    conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, getRyaInstanceName());
    conf.set(CLOUDBASE_USER, cluster.getUsername());
    conf.set(CLOUDBASE_PASSWORD, cluster.getPassword());
    conf.set(CLOUDBASE_INSTANCE, cluster.getInstanceName());

    crdfdao.setConf(conf);
    ryaStore.setRyaDAO(crdfdao);

    final RyaSailRepository ryaRepo = new RyaSailRepository(ryaStore);
    ryaRepo.initialize();

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

示例11: init

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

示例12: setUpRya

import org.apache.accumulo.core.client.AccumuloException; //导入依赖的package包/类
static void setUpRya() throws AccumuloException, AccumuloSecurityException, RyaDAOException {
    MockInstance mock = new MockInstance(INSTANCE_NAME);
    Connector conn = mock.getConnector(USERNAME, new PasswordToken(USERP));
    AccumuloRyaDAO dao = new AccumuloRyaDAO();
    dao.setConnector(conn);
    AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix(PREFIX);
    dao.setConf(conf);
    dao.init();
    String ns = "http://example.com/";
    dao.add(new RyaStatement(new RyaURI(ns+"s1"), new RyaURI(ns+"p1"), new RyaURI(ns+"o1")));
    dao.add(new RyaStatement(new RyaURI(ns+"s1"), new RyaURI(ns+"p2"), new RyaURI(ns+"o2")));
    dao.add(new RyaStatement(new RyaURI(ns+"s2"), new RyaURI(ns+"p1"), new RyaURI(ns+"o3"),
            new RyaURI(ns+"g1")));
    dao.add(new RyaStatement(new RyaURI(ns+"s3"), new RyaURI(ns+"p3"), new RyaURI(ns+"o3"),
            new RyaURI(ns+"g2")));
    dao.destroy();
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:19,代码来源:TextOutputExample.java

示例13: copyAuthorizations

import org.apache.accumulo.core.client.AccumuloException; //导入依赖的package包/类
protected void copyAuthorizations() throws IOException {
    try {
        final SecurityOperations parentSecOps = parentConnector.securityOperations();
        final SecurityOperations childSecOps = childConnector.securityOperations();

        final Authorizations parentAuths = parentSecOps.getUserAuthorizations(parentUser);
        final Authorizations childAuths = childSecOps.getUserAuthorizations(childUser);
        // Add any parent authorizations that the child doesn't have.
        if (!childAuths.equals(parentAuths)) {
            log.info("Adding the authorization, \"" + parentAuths.toString() + "\", to the child user, \"" + childUser + "\"");
            final Authorizations newChildAuths = AccumuloRyaUtils.addUserAuths(childUser, childSecOps, parentAuths);
            childSecOps.changeUserAuthorizations(childUser, newChildAuths);
        }
    } catch (AccumuloException | AccumuloSecurityException e) {
        throw new IOException(e);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:18,代码来源:BaseCopyToolMapper.java

示例14: initialize

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

示例15: ProspectorService

import org.apache.accumulo.core.client.AccumuloException; //导入依赖的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


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