Package org.apache.accumulo.core.security

Examples of org.apache.accumulo.core.security.Credentials


    UtilWaitThread.sleep(30 * 1000);
    checkBalance(c);
  }

  private void checkBalance(Connector c) throws Exception {
    Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));

    MasterMonitorInfo stats = null;
    int unassignedTablets = 1;
    for (int i = 0; unassignedTablets > 0 && i < 10; i++) {
      MasterClientService.Iface client = null;
      try {
        client = MasterClient.getConnectionWithRetry(c.getInstance());
        stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
      } finally {
        if (client != null)
          MasterClient.close(client);
      }
      unassignedTablets = stats.getUnassignedTablets();
View Full Code Here


    TestIngest.Opts opts = new TestIngest.Opts();
    opts.rows = 200000;
    TestIngest.ingest(c, opts, new BatchWriterOpts());
    c.tableOperations().flush("test_ingest", null, null, false);
    UtilWaitThread.sleep(45 * 1000);
    Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));

    MasterMonitorInfo stats = null;
    int unassignedTablets = 1;
    for (int i = 0; unassignedTablets > 0 && i < 10; i++) {
      MasterClientService.Iface client = null;
      try {
        client = MasterClient.getConnectionWithRetry(c.getInstance());
        stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
      } finally {
        if (client != null)
          MasterClient.close(client);
      }
      unassignedTablets = stats.getUnassignedTablets();
View Full Code Here

    assertNotNull(online.current);
    assertEquals(online.current, online.last);
  }

  private TabletLocationState getTabletLocationState(Connector c, String tableId) {
    Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
    MetaDataTableScanner s = new MetaDataTableScanner(c.getInstance(), creds, new Range(KeyExtent.getMetadataEntry(new Text(tableId), null)));
    TabletLocationState tlState = s.next();
    s.close();
    return tlState;
  }
View Full Code Here

      if (extent.isRootTablet()) {
        throw new IllegalArgumentException("Can not import files to root tablet");
      }

      synchronized (bulkFileImportLock) {
        Credentials creds = SystemCredentials.get();
        Connector conn;
        try {
          conn = HdfsZooInstance.getInstance().getConnector(creds.getPrincipal(), creds.getToken());
        } catch (Exception ex) {
          throw new IOException(ex);
        }
        // Remove any bulk files we've previously loaded and compacted away
        List<FileRef> files = MetadataTableUtil.getBulkFilesLoaded(conn, extent, tid);
View Full Code Here

        } else
          initiateMinor = true;
      }

      if (updateMetadata) {
        Credentials creds = SystemCredentials.get();
        // if multiple threads were allowed to update this outside of a sync block, then it would be
        // a race condition
        MetadataTableUtil.updateTabletFlushID(extent, tableFlushID, creds, tabletServer.getLock());
      } else if (initiateMinor)
        initiateMinorCompaction(tableFlushID, MinorCompactionReason.USER);
View Full Code Here

    return getConnector(user, ByteBufferUtil.toBytes(pass));
  }

  @Override
  public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
    return new ConnectorImpl(this, new Credentials(principal, token));
  }
View Full Code Here

    connector = getConnector();
    mtbw = getMultiTableBatchWriter(60);
  }

  public MultiTableBatchWriter getMultiTableBatchWriter(long cacheTimeoutInSeconds) {
    return new MultiTableBatchWriterImpl(connector.getInstance(), new Credentials("root", new PasswordToken(ROOT_PASSWORD)),
        new BatchWriterConfig(), cacheTimeoutInSeconds, TimeUnit.SECONDS);
  }
View Full Code Here

  @Test(timeout = 30 * 1000, expected = ConstraintViolationException.class)
  public void test() throws Exception {

    getConnector().securityOperations().grantTablePermission("root", MetadataTable.NAME, TablePermission.WRITE);

    Credentials credentials = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
    Writer w = new Writer(super.getConnector().getInstance(), credentials, MetadataTable.ID);
    KeyExtent extent = new KeyExtent(new Text("5"), null, null);


    Mutation m = new Mutation(extent.getMetadataEntry());
View Full Code Here

    return (int) ServerConfiguration.getSiteConfiguration().getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT);
  }

  @Override
  public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
    return new ConnectorImpl(this, new Credentials(principal, token));
  }
View Full Code Here

    bw.addMutation(defaultTablet);
    bw.close();

    // Read out the TabletLocationStates
    MockCurrentState state = new MockCurrentState(new MergeInfo(new KeyExtent(tableId, new Text("p"), new Text("e")), MergeInfo.Operation.MERGE));
    Credentials credentials = new Credentials("root", new PasswordToken(new byte[0]));

    // Verify the tablet state: hosted, and count
    MetaDataStateStore metaDataStateStore = new MetaDataStateStore(instance, credentials, state);
    int count = 0;
    for (TabletLocationState tss : metaDataStateStore) {
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.security.Credentials

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.