accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [5/6] git commit: ACCUMULO-1312 use Credentials object to avoid serializing as long as possible
Date Fri, 26 Jul 2013 23:58:53 GMT
ACCUMULO-1312 use Credentials object to avoid serializing as long as
possible


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/99da5641
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/99da5641
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/99da5641

Branch: refs/heads/master
Commit: 99da5641c28784c7b717cce6749673863c2ec8cf
Parents: 98b2a0b
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Thu Jul 25 19:59:26 2013 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Thu Jul 25 19:59:26 2013 -0400

----------------------------------------------------------------------
 .../accumulo/core/client/IteratorSetting.java   |   7 +-
 .../core/client/MutationsRejectedException.java |  11 +-
 .../accumulo/core/client/ZooKeeperInstance.java |   4 +-
 .../client/admin/InstanceOperationsImpl.java    |  23 +--
 .../client/admin/SecurityOperationsImpl.java    |  38 ++--
 .../core/client/admin/TableOperationsImpl.java  |  39 ++--
 .../core/client/impl/BatchWriterImpl.java       |   6 +-
 .../core/client/impl/ConditionalWriterImpl.java | 178 +++++++++----------
 .../core/client/impl/ConnectorImpl.java         |  10 +-
 .../client/impl/MultiTableBatchWriterImpl.java  |   6 +-
 .../core/client/impl/OfflineScanner.java        |  17 +-
 .../core/client/impl/RootTabletLocator.java     |  10 +-
 .../accumulo/core/client/impl/ScannerImpl.java  |  14 +-
 .../core/client/impl/ScannerIterator.java       |  13 +-
 .../core/client/impl/TabletLocator.java         |  10 +-
 .../core/client/impl/TabletLocatorImpl.java     |  48 ++---
 .../client/impl/TabletServerBatchDeleter.java   |   6 +-
 .../client/impl/TabletServerBatchReader.java    |   6 +-
 .../impl/TabletServerBatchReaderIterator.java   |  30 ++--
 .../client/impl/TabletServerBatchWriter.java    |  12 +-
 .../core/client/impl/ThriftScanner.java         |  27 +--
 .../core/client/impl/TimeoutTabletLocator.java  |  16 +-
 .../accumulo/core/client/impl/Writer.java       |  22 +--
 .../client/mapred/AccumuloOutputFormat.java     |  10 +-
 .../core/client/mapred/InputFormatBase.java     |  15 +-
 .../client/mapreduce/AccumuloOutputFormat.java  |   9 +-
 .../core/client/mapreduce/InputFormatBase.java  |  21 +--
 .../mapreduce/lib/util/ConfiguratorBase.java    |  15 +-
 .../mapreduce/lib/util/InputConfigurator.java   |   6 +-
 .../core/client/mock/MockTableOperations.java   |   2 +
 .../core/client/mock/MockTabletLocator.java     |  13 +-
 .../security/tokens/AuthenticationToken.java    | 111 +++++++++++-
 .../core/client/security/tokens/NullToken.java  |   7 +
 .../core/metadata/MetadataLocationObtainer.java |  14 +-
 .../core/metadata/MetadataServicer.java         |  10 +-
 .../core/metadata/ServicerForMetadataTable.java |   4 +-
 .../core/metadata/ServicerForRootTable.java     |   4 +-
 .../core/metadata/ServicerForUserTables.java    |   4 +-
 .../core/metadata/TableMetadataServicer.java    |  10 +-
 .../core/metadata/schema/MetadataSchema.java    |   4 +-
 .../accumulo/core/security/Authorizations.java  |   2 -
 .../core/security/CredentialHelper.java         |   9 +-
 .../accumulo/core/security/Credentials.java     |  67 ++++++-
 .../apache/accumulo/core/util/CreateToken.java  |   5 +-
 .../client/admin/TableOperationsHelperTest.java |   6 +-
 .../core/client/impl/TabletLocatorImplTest.java | 126 ++++++-------
 .../core/metadata/MetadataServicerTest.java     |   5 +-
 .../accumulo/core/security/CredentialsTest.java | 125 +++++++++++++
 .../minicluster/MiniAccumuloConfig.java         |  20 +--
 .../org/apache/accumulo/proxy/ProxyServer.java  |  41 ++---
 .../server/cli/ClientOnRequiredTable.java       |   2 +-
 .../accumulo/server/client/BulkImporter.java    |  50 +++---
 .../server/client/ClientServiceHandler.java     |  14 +-
 .../accumulo/server/client/HdfsZooInstance.java |   7 +-
 .../server/gc/GarbageCollectWriteAheadLogs.java |   4 +-
 .../server/gc/SimpleGarbageCollector.java       |  18 +-
 .../accumulo/server/master/LiveTServerSet.java  |  26 +--
 .../apache/accumulo/server/master/Master.java   |  13 +-
 .../server/master/TabletGroupWatcher.java       |  10 +-
 .../master/balancer/ChaoticLoadBalancer.java    |   4 +-
 .../server/master/balancer/TabletBalancer.java  |   3 +-
 .../server/master/state/MetaDataStateStore.java |  19 +-
 .../master/state/MetaDataTableScanner.java      |  19 +-
 .../master/state/RootTabletStateStore.java      |   8 +-
 .../server/master/tableOps/BulkImport.java      |   3 +-
 .../server/master/tableOps/CloneTable.java      |   9 +-
 .../server/master/tableOps/CreateTable.java     |   9 +-
 .../server/master/tableOps/DeleteTable.java     |   4 +-
 .../server/master/tableOps/ImportTable.java     |   6 +-
 .../apache/accumulo/server/monitor/Monitor.java |   4 +-
 .../monitor/servlets/TServersServlet.java       |   4 +-
 .../server/monitor/servlets/TablesServlet.java  |   4 +-
 .../accumulo/server/problems/ProblemReport.java |   4 +-
 .../server/problems/ProblemReports.java         |   2 +-
 .../security/AuditedSecurityOperation.java      |   5 +-
 .../server/security/SecurityOperation.java      |  14 +-
 .../server/security/SystemCredentials.java      |  15 +-
 .../accumulo/server/tabletserver/Tablet.java    |  42 +++--
 .../server/tabletserver/TabletServer.java       |  10 +-
 .../accumulo/server/trace/TraceFileSystem.java  |   1 +
 .../org/apache/accumulo/server/util/Admin.java  |  20 +--
 .../server/util/CheckForMetadataProblems.java   |   6 +-
 .../server/util/FindOfflineTablets.java         |   4 +-
 .../apache/accumulo/server/util/Initialize.java |   3 +-
 .../accumulo/server/util/MetadataTableUtil.java |  85 +++++----
 .../server/util/VerifyTabletAssignments.java    |   3 +-
 .../server/client/BulkImporterTest.java         |  15 +-
 .../accumulo/server/gc/TestConfirmDeletes.java  |  14 +-
 .../accumulo/server/master/TestMergeState.java  |   7 +-
 .../balancer/ChaoticLoadBalancerTest.java       |   4 +-
 .../server/security/SystemCredentialsTest.java  |   4 +-
 .../apache/accumulo/test/GetMasterStats.java    |  15 +-
 .../apache/accumulo/test/WrongTabletTest.java   |  11 +-
 .../continuous/ContinuousStatsCollector.java    |   2 +-
 .../test/functional/FunctionalTest.java         |   3 -
 .../test/functional/SplitRecoveryTest.java      |  24 +--
 .../performance/scan/CollectTabletStats.java    |  15 +-
 .../test/performance/thrift/NullTserver.java    |  11 +-
 .../apache/accumulo/test/randomwalk/State.java  |  11 +-
 .../test/randomwalk/concurrent/Shutdown.java    |   6 +-
 .../test/randomwalk/concurrent/StartAll.java    |   6 +-
 .../randomwalk/security/AlterTablePerm.java     |   9 +-
 .../test/randomwalk/security/Authenticate.java  |   4 +-
 .../test/randomwalk/security/ChangePass.java    |   4 +-
 .../test/randomwalk/security/DropTable.java     |   4 +-
 .../randomwalk/security/SecurityFixture.java    |   3 +-
 .../randomwalk/security/WalkingSecurity.java    |  14 +-
 .../accumulo/test/ConditionalWriterTest.java    | 169 +++++++++---------
 .../test/functional/DynamicThreadPoolsIT.java   |  13 +-
 .../test/functional/MetadataMaxFiles.java       |   8 +-
 110 files changed, 1169 insertions(+), 879 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java b/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
index 70a7e45..a6345a0 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
@@ -197,7 +197,7 @@ public class IteratorSetting implements Writable {
     this.properties = new HashMap<String,String>();
     this.readFields(din);
   }
-
+  
   /**
    * Add another option to the iterator.
    * 
@@ -277,9 +277,6 @@ public class IteratorSetting implements Writable {
     return result;
   }
   
-  /**
-   * @see java.lang.Object#equals()
-   */
   @Override
   public boolean equals(Object obj) {
     if (this == obj)
@@ -308,7 +305,7 @@ public class IteratorSetting implements Writable {
       return false;
     return true;
   }
-
+  
   /**
    * @see java.lang.Object#toString()
    */

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java b/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
index 0610251..bfa62d3 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
@@ -35,7 +35,7 @@ import org.apache.accumulo.core.data.KeyExtent;
  */
 public class MutationsRejectedException extends AccumuloException {
   private static final long serialVersionUID = 1L;
-   
+  
   private List<ConstraintViolationSummary> cvsl;
   private Map<KeyExtent,Set<SecurityErrorCode>> af;
   private Collection<String> es;
@@ -62,12 +62,12 @@ public class MutationsRejectedException extends AccumuloException {
   }
   
   private static String format(HashMap<KeyExtent,Set<SecurityErrorCode>> hashMap, Instance instance) {
-    Map<String, Set<SecurityErrorCode>> errorMap = new HashMap<String,Set<SecurityErrorCode>>();
+    Map<String,Set<SecurityErrorCode>> errorMap = new HashMap<String,Set<SecurityErrorCode>>();
     
-    for(KeyExtent ke : hashMap.keySet()) {
+    for (KeyExtent ke : hashMap.keySet()) {
       String tableInfo = Tables.getPrintableTableInfoFromId(instance, ke.getTableId().toString());
       
-      if(!errorMap.containsKey(tableInfo)) {
+      if (!errorMap.containsKey(tableInfo)) {
         errorMap.put(tableInfo, new HashSet<SecurityErrorCode>());
       }
       
@@ -76,7 +76,7 @@ public class MutationsRejectedException extends AccumuloException {
     
     return errorMap.toString();
   }
-    
+  
   /**
    * @return the internal list of constraint violations
    */
@@ -88,6 +88,7 @@ public class MutationsRejectedException extends AccumuloException {
    * @return the internal list of authorization failures
    * @deprecated since 1.5, see {@link #getAuthorizationFailuresMap()}
    */
+  @Deprecated
   public List<KeyExtent> getAuthorizationFailures() {
     return new ArrayList<KeyExtent>(af.keySet());
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
index 07f5fd4..ba8c094 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
@@ -28,7 +28,7 @@ import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.metadata.RootTable;
-import org.apache.accumulo.core.security.CredentialHelper;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.core.util.OpTimer;
@@ -212,7 +212,7 @@ public class ZooKeeperInstance implements Instance {
   
   @Override
   public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
-    return new ConnectorImpl(this, CredentialHelper.create(principal, token, getInstanceID()));
+    return new ConnectorImpl(this, new Credentials(principal, token));
   }
   
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
index 8752f33..a131b66 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
@@ -34,7 +34,7 @@ import org.apache.accumulo.core.client.impl.thrift.ClientService;
 import org.apache.accumulo.core.client.impl.thrift.ConfigurationType;
 import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
 import org.apache.accumulo.core.master.thrift.MasterClientService;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client;
 import org.apache.accumulo.core.util.AddressUtil;
@@ -52,7 +52,7 @@ import org.apache.thrift.transport.TTransportException;
  */
 public class InstanceOperationsImpl implements InstanceOperations {
   private Instance instance;
-  private TCredentials credentials;
+  private Credentials credentials;
   
   /**
    * @param instance
@@ -60,7 +60,7 @@ public class InstanceOperationsImpl implements InstanceOperations {
    * @param credentials
    *          the Credential, containing principal and Authentication Token
    */
-  public InstanceOperationsImpl(Instance instance, TCredentials credentials) {
+  public InstanceOperationsImpl(Instance instance, Credentials credentials) {
     ArgumentChecker.notNull(instance, credentials);
     this.instance = instance;
     this.credentials = credentials;
@@ -72,7 +72,7 @@ public class InstanceOperationsImpl implements InstanceOperations {
     MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
       @Override
       public void execute(MasterClientService.Client client) throws Exception {
-        client.setSystemProperty(Tracer.traceInfo(), credentials, property, value);
+        client.setSystemProperty(Tracer.traceInfo(), credentials.toThrift(instance), property, value);
       }
     });
   }
@@ -83,7 +83,7 @@ public class InstanceOperationsImpl implements InstanceOperations {
     MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
       @Override
       public void execute(MasterClientService.Client client) throws Exception {
-        client.removeSystemProperty(Tracer.traceInfo(), credentials, property);
+        client.removeSystemProperty(Tracer.traceInfo(), credentials.toThrift(instance), property);
       }
     });
   }
@@ -93,7 +93,7 @@ public class InstanceOperationsImpl implements InstanceOperations {
     return ServerClient.execute(instance, new ClientExecReturn<Map<String,String>,ClientService.Client>() {
       @Override
       public Map<String,String> execute(ClientService.Client client) throws Exception {
-        return client.getConfiguration(Tracer.traceInfo(), credentials, ConfigurationType.CURRENT);
+        return client.getConfiguration(Tracer.traceInfo(), credentials.toThrift(instance), ConfigurationType.CURRENT);
       }
     });
   }
@@ -103,7 +103,7 @@ public class InstanceOperationsImpl implements InstanceOperations {
     return ServerClient.execute(instance, new ClientExecReturn<Map<String,String>,ClientService.Client>() {
       @Override
       public Map<String,String> execute(ClientService.Client client) throws Exception {
-        return client.getConfiguration(Tracer.traceInfo(), credentials, ConfigurationType.SITE);
+        return client.getConfiguration(Tracer.traceInfo(), credentials.toThrift(instance), ConfigurationType.SITE);
       }
     });
   }
@@ -134,7 +134,7 @@ public class InstanceOperationsImpl implements InstanceOperations {
       client = ThriftUtil.getTServerClient(tserver, instance.getConfiguration());
       
       List<ActiveScan> as = new ArrayList<ActiveScan>();
-      for (org.apache.accumulo.core.tabletserver.thrift.ActiveScan activeScan : client.getActiveScans(Tracer.traceInfo(), credentials)) {
+      for (org.apache.accumulo.core.tabletserver.thrift.ActiveScan activeScan : client.getActiveScans(Tracer.traceInfo(), credentials.toThrift(instance))) {
         try {
           as.add(new ActiveScan(instance, activeScan));
         } catch (TableNotFoundException e) {
@@ -159,7 +159,7 @@ public class InstanceOperationsImpl implements InstanceOperations {
     return ServerClient.execute(instance, new ClientExecReturn<Boolean,ClientService.Client>() {
       @Override
       public Boolean execute(ClientService.Client client) throws Exception {
-        return client.checkClass(Tracer.traceInfo(), credentials, className, asTypeName);
+        return client.checkClass(Tracer.traceInfo(), credentials.toThrift(instance), className, asTypeName);
       }
     });
   }
@@ -171,7 +171,8 @@ public class InstanceOperationsImpl implements InstanceOperations {
       client = ThriftUtil.getTServerClient(tserver, instance.getConfiguration());
       
       List<ActiveCompaction> as = new ArrayList<ActiveCompaction>();
-      for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction activeCompaction : client.getActiveCompactions(Tracer.traceInfo(), credentials)) {
+      for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction activeCompaction : client.getActiveCompactions(Tracer.traceInfo(),
+          credentials.toThrift(instance))) {
         as.add(new ActiveCompaction(instance, activeCompaction));
       }
       return as;
@@ -193,7 +194,7 @@ public class InstanceOperationsImpl implements InstanceOperations {
     try {
       transport = ThriftUtil.createTransport(AddressUtil.parseAddress(tserver), instance.getConfiguration());
       TabletClientService.Client client = ThriftUtil.createClient(new TabletClientService.Client.Factory(), transport);
-      client.getTabletServerStatus(Tracer.traceInfo(), credentials);
+      client.getTabletServerStatus(Tracer.traceInfo(), credentials.toThrift(instance));
     } catch (TTransportException e) {
       throw new AccumuloException(e);
     } catch (ThriftSecurityException e) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
index d5e1d8b..0f0e998 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
@@ -33,10 +33,9 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.CredentialHelper;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.security.SystemPermission;
 import org.apache.accumulo.core.security.TablePermission;
-import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.trace.instrument.Tracer;
@@ -44,7 +43,7 @@ import org.apache.accumulo.trace.instrument.Tracer;
 public class SecurityOperationsImpl implements SecurityOperations {
   
   private Instance instance;
-  private TCredentials credentials;
+  private Credentials credentials;
   
   private void execute(ClientExec<ClientService.Client> exec) throws AccumuloException, AccumuloSecurityException {
     try {
@@ -82,7 +81,7 @@ public class SecurityOperationsImpl implements SecurityOperations {
     }
   }
   
-  public SecurityOperationsImpl(Instance instance, TCredentials credentials) {
+  public SecurityOperationsImpl(Instance instance, Credentials credentials) {
     ArgumentChecker.notNull(instance, credentials);
     this.instance = instance;
     this.credentials = credentials;
@@ -101,7 +100,7 @@ public class SecurityOperationsImpl implements SecurityOperations {
     execute(new ClientExec<ClientService.Client>() {
       @Override
       public void execute(ClientService.Client client) throws Exception {
-        client.createLocalUser(Tracer.traceInfo(), credentials, principal, ByteBuffer.wrap(password.getPassword()));
+        client.createLocalUser(Tracer.traceInfo(), credentials.toThrift(instance), principal, ByteBuffer.wrap(password.getPassword()));
       }
     });
   }
@@ -118,7 +117,7 @@ public class SecurityOperationsImpl implements SecurityOperations {
     execute(new ClientExec<ClientService.Client>() {
       @Override
       public void execute(ClientService.Client client) throws Exception {
-        client.dropLocalUser(Tracer.traceInfo(), credentials, principal);
+        client.dropLocalUser(Tracer.traceInfo(), credentials.toThrift(instance), principal);
       }
     });
   }
@@ -132,11 +131,11 @@ public class SecurityOperationsImpl implements SecurityOperations {
   @Override
   public boolean authenticateUser(final String principal, final AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
     ArgumentChecker.notNull(principal, token);
-    final TCredentials toAuth = CredentialHelper.create(principal, token, instance.getInstanceID());
+    final Credentials toAuth = new Credentials(principal, token);
     return execute(new ClientExecReturn<Boolean,ClientService.Client>() {
       @Override
       public Boolean execute(ClientService.Client client) throws Exception {
-        return client.authenticateUser(Tracer.traceInfo(), credentials, toAuth);
+        return client.authenticateUser(Tracer.traceInfo(), credentials.toThrift(instance), toAuth.toThrift(instance));
       }
     });
   }
@@ -150,11 +149,11 @@ public class SecurityOperationsImpl implements SecurityOperations {
   @Override
   public void changeLocalUserPassword(final String principal, final PasswordToken token) throws AccumuloException, AccumuloSecurityException {
     ArgumentChecker.notNull(principal, token);
-    final TCredentials toChange = CredentialHelper.create(principal, token, instance.getInstanceID());
+    final Credentials toChange = new Credentials(principal, token);
     execute(new ClientExec<ClientService.Client>() {
       @Override
       public void execute(ClientService.Client client) throws Exception {
-        client.changeLocalUserPassword(Tracer.traceInfo(), credentials, principal, ByteBuffer.wrap(token.getPassword()));
+        client.changeLocalUserPassword(Tracer.traceInfo(), credentials.toThrift(instance), principal, ByteBuffer.wrap(token.getPassword()));
       }
     });
     if (this.credentials.getPrincipal().equals(principal)) {
@@ -168,7 +167,8 @@ public class SecurityOperationsImpl implements SecurityOperations {
     execute(new ClientExec<ClientService.Client>() {
       @Override
       public void execute(ClientService.Client client) throws Exception {
-        client.changeAuthorizations(Tracer.traceInfo(), credentials, principal, ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()));
+        client.changeAuthorizations(Tracer.traceInfo(), credentials.toThrift(instance), principal,
+            ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()));
       }
     });
   }
@@ -179,7 +179,7 @@ public class SecurityOperationsImpl implements SecurityOperations {
     return execute(new ClientExecReturn<Authorizations,ClientService.Client>() {
       @Override
       public Authorizations execute(ClientService.Client client) throws Exception {
-        return new Authorizations(client.getUserAuthorizations(Tracer.traceInfo(), credentials, principal));
+        return new Authorizations(client.getUserAuthorizations(Tracer.traceInfo(), credentials.toThrift(instance), principal));
       }
     });
   }
@@ -190,7 +190,7 @@ public class SecurityOperationsImpl implements SecurityOperations {
     return execute(new ClientExecReturn<Boolean,ClientService.Client>() {
       @Override
       public Boolean execute(ClientService.Client client) throws Exception {
-        return client.hasSystemPermission(Tracer.traceInfo(), credentials, principal, perm.getId());
+        return client.hasSystemPermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, perm.getId());
       }
     });
   }
@@ -201,7 +201,7 @@ public class SecurityOperationsImpl implements SecurityOperations {
     return execute(new ClientExecReturn<Boolean,ClientService.Client>() {
       @Override
       public Boolean execute(ClientService.Client client) throws Exception {
-        return client.hasTablePermission(Tracer.traceInfo(), credentials, principal, table, perm.getId());
+        return client.hasTablePermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, table, perm.getId());
       }
     });
   }
@@ -212,7 +212,7 @@ public class SecurityOperationsImpl implements SecurityOperations {
     execute(new ClientExec<ClientService.Client>() {
       @Override
       public void execute(ClientService.Client client) throws Exception {
-        client.grantSystemPermission(Tracer.traceInfo(), credentials, principal, permission.getId());
+        client.grantSystemPermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, permission.getId());
       }
     });
   }
@@ -224,7 +224,7 @@ public class SecurityOperationsImpl implements SecurityOperations {
     execute(new ClientExec<ClientService.Client>() {
       @Override
       public void execute(ClientService.Client client) throws Exception {
-        client.grantTablePermission(Tracer.traceInfo(), credentials, principal, table, permission.getId());
+        client.grantTablePermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, table, permission.getId());
       }
     });
   }
@@ -235,7 +235,7 @@ public class SecurityOperationsImpl implements SecurityOperations {
     execute(new ClientExec<ClientService.Client>() {
       @Override
       public void execute(ClientService.Client client) throws Exception {
-        client.revokeSystemPermission(Tracer.traceInfo(), credentials, principal, permission.getId());
+        client.revokeSystemPermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, permission.getId());
       }
     });
   }
@@ -247,7 +247,7 @@ public class SecurityOperationsImpl implements SecurityOperations {
     execute(new ClientExec<ClientService.Client>() {
       @Override
       public void execute(ClientService.Client client) throws Exception {
-        client.revokeTablePermission(Tracer.traceInfo(), credentials, principal, table, permission.getId());
+        client.revokeTablePermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, table, permission.getId());
       }
     });
   }
@@ -263,7 +263,7 @@ public class SecurityOperationsImpl implements SecurityOperations {
     return execute(new ClientExecReturn<Set<String>,ClientService.Client>() {
       @Override
       public Set<String> execute(ClientService.Client client) throws Exception {
-        return client.listLocalUsers(Tracer.traceInfo(), credentials);
+        return client.listLocalUsers(Tracer.traceInfo(), credentials.toThrift(instance));
       }
     });
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
index 3ad4217..1a60fb7 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
@@ -85,8 +85,7 @@ import org.apache.accumulo.core.metadata.MetadataServicer;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 import org.apache.accumulo.core.util.ArgumentChecker;
@@ -117,7 +116,7 @@ import org.apache.thrift.transport.TTransportException;
  */
 public class TableOperationsImpl extends TableOperationsHelper {
   private Instance instance;
-  private TCredentials credentials;
+  private Credentials credentials;
   
   private static final Logger log = Logger.getLogger(TableOperations.class);
   
@@ -127,7 +126,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
    * @param credentials
    *          the username/password for this connection
    */
-  public TableOperationsImpl(Instance instance, TCredentials credentials) {
+  public TableOperationsImpl(Instance instance, Credentials credentials) {
     ArgumentChecker.notNull(instance, credentials);
     this.instance = instance;
     this.credentials = credentials;
@@ -222,7 +221,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
       MasterClientService.Iface client = null;
       try {
         client = MasterClient.getConnectionWithRetry(instance);
-        return client.beginTableOperation(Tracer.traceInfo(), credentials);
+        return client.beginTableOperation(Tracer.traceInfo(), credentials.toThrift(instance));
       } catch (TTransportException tte) {
         log.debug("Failed to call beginTableOperation(), retrying ... ", tte);
         UtilWaitThread.sleep(100);
@@ -238,7 +237,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
       MasterClientService.Iface client = null;
       try {
         client = MasterClient.getConnectionWithRetry(instance);
-        client.executeTableOperation(Tracer.traceInfo(), credentials, opid, op, args, opts, autoCleanUp);
+        client.executeTableOperation(Tracer.traceInfo(), credentials.toThrift(instance), opid, op, args, opts, autoCleanUp);
         break;
       } catch (TTransportException tte) {
         log.debug("Failed to call executeTableOperation(), retrying ... ", tte);
@@ -254,7 +253,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
       MasterClientService.Iface client = null;
       try {
         client = MasterClient.getConnectionWithRetry(instance);
-        return client.waitForTableOperation(Tracer.traceInfo(), credentials, opid);
+        return client.waitForTableOperation(Tracer.traceInfo(), credentials.toThrift(instance), opid);
       } catch (TTransportException tte) {
         log.debug("Failed to call waitForTableOperation(), retrying ... ", tte);
         UtilWaitThread.sleep(100);
@@ -269,7 +268,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
       MasterClientService.Iface client = null;
       try {
         client = MasterClient.getConnectionWithRetry(instance);
-        client.finishTableOperation(Tracer.traceInfo(), credentials, opid);
+        client.finishTableOperation(Tracer.traceInfo(), credentials.toThrift(instance), opid);
         break;
       } catch (TTransportException tte) {
         log.debug("Failed to call finishTableOperation(), retrying ... ", tte);
@@ -450,7 +449,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
         
         attempt++;
         
-        TabletLocation tl = tabLocator.locateTablet(split, false, false, credentials);
+        TabletLocation tl = tabLocator.locateTablet(credentials, split, false, false);
         
         if (tl == null) {
           if (!Tables.exists(instance, tableId))
@@ -467,7 +466,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
             if (log.isTraceEnabled())
               opTimer = new OpTimer(log, Level.TRACE).start("Splitting tablet " + tl.tablet_extent + " on " + tl.tablet_location + " at " + split);
             
-            client.splitTablet(Tracer.traceInfo(), credentials, tl.tablet_extent.toThrift(), TextUtil.getByteBuffer(split));
+            client.splitTablet(Tracer.traceInfo(), credentials.toThrift(instance), tl.tablet_extent.toThrift(), TextUtil.getByteBuffer(split));
             
             // just split it, might as well invalidate it in the cache
             tabLocator.invalidateCache(tl.tablet_extent);
@@ -578,6 +577,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
     return endRows;
   }
   
+  @Deprecated
   @Override
   public Collection<Text> getSplits(String tableName) throws TableNotFoundException {
     try {
@@ -620,6 +620,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
     return subset;
   }
   
+  @Deprecated
   @Override
   public Collection<Text> getSplits(String tableName, int maxSplits) throws TableNotFoundException {
     try {
@@ -800,7 +801,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
         MasterClientService.Iface client = null;
         try {
           client = MasterClient.getConnectionWithRetry(instance);
-          flushID = client.initiateFlush(Tracer.traceInfo(), credentials, tableId);
+          flushID = client.initiateFlush(Tracer.traceInfo(), credentials.toThrift(instance), tableId);
           break;
         } catch (TTransportException tte) {
           log.debug("Failed to call initiateFlush, retrying ... ", tte);
@@ -814,7 +815,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
         MasterClientService.Iface client = null;
         try {
           client = MasterClient.getConnectionWithRetry(instance);
-          client.waitForFlush(Tracer.traceInfo(), credentials, tableId, TextUtil.getByteBuffer(start), TextUtil.getByteBuffer(end), flushID,
+          client.waitForFlush(Tracer.traceInfo(), credentials.toThrift(instance), tableId, TextUtil.getByteBuffer(start), TextUtil.getByteBuffer(end), flushID,
               wait ? Long.MAX_VALUE : 1);
           break;
         } catch (TTransportException tte) {
@@ -863,7 +864,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
     MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
       @Override
       public void execute(MasterClientService.Client client) throws Exception {
-        client.setTableProperty(Tracer.traceInfo(), credentials, tableName, property, value);
+        client.setTableProperty(Tracer.traceInfo(), credentials.toThrift(instance), tableName, property, value);
       }
     });
   }
@@ -886,7 +887,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
     MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
       @Override
       public void execute(MasterClientService.Client client) throws Exception {
-        client.removeTableProperty(Tracer.traceInfo(), credentials, tableName, property);
+        client.removeTableProperty(Tracer.traceInfo(), credentials.toThrift(instance), tableName, property);
       }
     });
   }
@@ -907,7 +908,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
       return ServerClient.executeRaw(instance, new ClientExecReturn<Map<String,String>,ClientService.Client>() {
         @Override
         public Map<String,String> execute(ClientService.Client client) throws Exception {
-          return client.getTableConfiguration(Tracer.traceInfo(), credentials, tableName);
+          return client.getTableConfiguration(Tracer.traceInfo(), credentials.toThrift(instance), tableName);
         }
       }).entrySet();
     } catch (ThriftTableOperationException e) {
@@ -1039,7 +1040,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
     TabletLocator tl = TabletLocator.getLocator(instance, new Text(tableId));
     // its possible that the cache could contain complete, but old information about a tables tablets... so clear it
     tl.invalidateCache();
-    while (!tl.binRanges(Collections.singletonList(range), binnedRanges, credentials).isEmpty()) {
+    while (!tl.binRanges(credentials, Collections.singletonList(range), binnedRanges).isEmpty()) {
       if (!Tables.exists(instance, tableId))
         throw new TableDeletedException(tableId);
       if (Tables.getTableState(instance, tableId) == TableState.OFFLINE)
@@ -1196,7 +1197,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
   public Text getMaxRow(String tableName, Authorizations auths, Text startRow, boolean startInclusive, Text endRow, boolean endInclusive)
       throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
     ArgumentChecker.notNull(tableName, auths);
-    Scanner scanner = instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials)).createScanner(tableName, auths);
+    Scanner scanner = instance.getConnector(credentials.getPrincipal(), credentials.getToken()).createScanner(tableName, auths);
     return FindMax.findMax(scanner, startRow, startInclusive, endRow, endInclusive);
   }
   
@@ -1210,7 +1211,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
         // this operation may us a lot of memory... its likely that connections to tabletservers hosting metadata tablets will be cached, so do not use cached
         // connections
         pair = ServerClient.getConnection(instance, false);
-        diskUsages = pair.getSecond().getDiskUsage(tableNames, credentials);
+        diskUsages = pair.getSecond().getDiskUsage(tableNames, credentials.toThrift(instance));
       } catch (ThriftTableOperationException e) {
         switch (e.getType()) {
           case NOTFOUND:
@@ -1324,7 +1325,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
       return ServerClient.executeRaw(instance, new ClientExecReturn<Boolean,ClientService.Client>() {
         @Override
         public Boolean execute(ClientService.Client client) throws Exception {
-          return client.checkTableClass(Tracer.traceInfo(), credentials, tableName, className, asTypeName);
+          return client.checkTableClass(Tracer.traceInfo(), credentials.toThrift(instance), tableName, className, asTypeName);
         }
       });
     } catch (ThriftTableOperationException e) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java
index c884416..829a987 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java
@@ -21,7 +21,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.MutationsRejectedException;
 import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.ArgumentChecker;
 
 public class BatchWriterImpl implements BatchWriter {
@@ -29,10 +29,10 @@ public class BatchWriterImpl implements BatchWriter {
   private String table;
   private TabletServerBatchWriter bw;
   
-  public BatchWriterImpl(Instance instance, TCredentials credentials, String table, BatchWriterConfig config) {
+  public BatchWriterImpl(Instance instance, Credentials credentials, String table, BatchWriterConfig config) {
     ArgumentChecker.notNull(instance, credentials, table);
     if (config == null)
-      config= new BatchWriterConfig();
+      config = new BatchWriterConfig();
     this.table = table;
     this.bw = new TabletServerBatchWriter(instance, credentials, config);
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
index 9d7e257..ab56b4b 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
@@ -62,9 +62,9 @@ import org.apache.accumulo.core.data.thrift.TMutation;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.security.VisibilityEvaluator;
 import org.apache.accumulo.core.security.VisibilityParseException;
-import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 import org.apache.accumulo.core.util.BadArgumentException;
@@ -86,7 +86,6 @@ import org.apache.thrift.TException;
 import org.apache.thrift.TServiceClient;
 import org.apache.thrift.transport.TTransportException;
 
-
 class ConditionalWriterImpl implements ConditionalWriter {
   
   private static ThreadPoolExecutor cleanupThreadPool = new ThreadPoolExecutor(1, 1, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
@@ -94,21 +93,21 @@ class ConditionalWriterImpl implements ConditionalWriter {
   static {
     cleanupThreadPool.allowCoreThreadTimeOut(true);
   }
-
+  
   private static final Logger log = Logger.getLogger(ConditionalWriterImpl.class);
-
+  
   private static final int MAX_SLEEP = 30000;
-
+  
   private Authorizations auths;
   private VisibilityEvaluator ve;
   @SuppressWarnings("unchecked")
   private Map<Text,Boolean> cache = Collections.synchronizedMap(new LRUMap(1000));
   private Instance instance;
-  private TCredentials credentials;
+  private Credentials credentials;
   private TabletLocator locator;
   private String tableId;
   private long timeout;
-
+  
   private static class ServerQueue {
     BlockingQueue<TabletServerMutations<QCMutation>> queue = new LinkedBlockingQueue<TabletServerMutations<QCMutation>>();
     boolean taskQueued = false;
@@ -137,7 +136,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
     public Result next() {
       if (count <= 0)
         throw new NoSuchElementException();
-
+      
       try {
         Result result = rq.poll(1, TimeUnit.SECONDS);
         while (result == null) {
@@ -161,7 +160,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
     }
     
   }
-
+  
   private static class QCMutation extends ConditionalMutation implements Delayed {
     private BlockingQueue<Result> resultQueue;
     private long resetTime;
@@ -173,7 +172,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
       this.resultQueue = resultQueue;
       this.entryTime = entryTime;
     }
-
+    
     @Override
     public int compareTo(Delayed o) {
       QCMutation oqcm = (QCMutation) o;
@@ -198,7 +197,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
   private ServerQueue getServerQueue(String location) {
     ServerQueue serverQueue;
     synchronized (serverQueues) {
-       serverQueue = serverQueues.get(location);
+      serverQueue = serverQueues.get(location);
       if (serverQueue == null) {
         
         serverQueue = new ServerQueue();
@@ -227,15 +226,14 @@ class ConditionalWriterImpl implements ConditionalWriter {
         try {
           client = getClient(sid.location);
           client.closeConditionalUpdate(tinfo, sid.sessionID);
-        } catch (Exception e) {
-        } finally {
+        } catch (Exception e) {} finally {
           ThriftUtil.returnClient((TServiceClient) client);
         }
-
+        
       }
     }
   }
-
+  
   private void queueRetry(List<QCMutation> mutations, String server) {
     
     if (timeout < Long.MAX_VALUE) {
@@ -243,7 +241,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
       long time = System.currentTimeMillis();
       
       ArrayList<QCMutation> mutations2 = new ArrayList<ConditionalWriterImpl.QCMutation>(mutations.size());
-
+      
       for (QCMutation qcm : mutations) {
         qcm.resetDelay();
         if (time + qcm.getDelay(TimeUnit.MILLISECONDS) > qcm.entryTime + timeout) {
@@ -261,27 +259,27 @@ class ConditionalWriterImpl implements ConditionalWriter {
       
       if (mutations2.size() > 0)
         failedMutations.addAll(mutations2);
-
+      
     } else {
       for (QCMutation qcm : mutations)
         qcm.resetDelay();
       failedMutations.addAll(mutations);
     }
   }
-
+  
   private void queue(List<QCMutation> mutations) {
     List<QCMutation> failures = new ArrayList<QCMutation>();
     Map<String,TabletServerMutations<QCMutation>> binnedMutations = new HashMap<String,TabletLocator.TabletServerMutations<QCMutation>>();
     
     try {
-      locator.binMutations(mutations, binnedMutations, failures, credentials);
+      locator.binMutations(credentials, mutations, binnedMutations, failures);
       
       if (failures.size() == mutations.size())
         if (!Tables.exists(instance, tableId))
           throw new TableDeletedException(tableId);
         else if (Tables.getTableState(instance, tableId) == TableState.OFFLINE)
           throw new TableOfflineException(instance, tableId);
-
+      
     } catch (Exception e) {
       for (QCMutation qcm : mutations)
         qcm.queueResult(new Result(e, qcm, null));
@@ -293,14 +291,13 @@ class ConditionalWriterImpl implements ConditionalWriter {
     
     if (failures.size() > 0)
       queueRetry(failures, null);
-
+    
     for (Entry<String,TabletServerMutations<QCMutation>> entry : binnedMutations.entrySet()) {
       queue(entry.getKey(), entry.getValue());
     }
-
-
+    
   }
-
+  
   private void queue(String location, TabletServerMutations<QCMutation> mutations) {
     
     ServerQueue serverQueue = getServerQueue(location);
@@ -308,15 +305,15 @@ class ConditionalWriterImpl implements ConditionalWriter {
     synchronized (serverQueue) {
       serverQueue.queue.add(mutations);
       // never execute more than one task per server
-      if(!serverQueue.taskQueued){
+      if (!serverQueue.taskQueued) {
         threadPool.execute(new LoggingRunnable(log, new SendTask(location)));
         serverQueue.taskQueued = true;
       }
     }
-   
+    
   }
-
-  private void reschedule(SendTask task){
+  
+  private void reschedule(SendTask task) {
     ServerQueue serverQueue = getServerQueue(task.location);
     // just finished processing work for this server, could reschedule if it has more work or immediately process the work
     // this code reschedules the the server for processing later... there may be other queues with
@@ -325,7 +322,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
     // in bigger batches and less RPC overhead
     
     synchronized (serverQueue) {
-      if(serverQueue.queue.size() > 0)
+      if (serverQueue.queue.size() > 0)
         threadPool.execute(new LoggingRunnable(log, task));
       else
         serverQueue.taskQueued = false;
@@ -363,8 +360,8 @@ class ConditionalWriterImpl implements ConditionalWriter {
       return tsm;
     }
   }
-
-  ConditionalWriterImpl(Instance instance, TCredentials credentials, String tableId, ConditionalWriterConfig config) {
+  
+  ConditionalWriterImpl(Instance instance, Credentials credentials, String tableId, ConditionalWriterConfig config) {
     this.instance = instance;
     this.credentials = credentials;
     this.auths = config.getAuthorizations();
@@ -375,14 +372,14 @@ class ConditionalWriterImpl implements ConditionalWriter {
     this.serverQueues = new HashMap<String,ServerQueue>();
     this.tableId = tableId;
     this.timeout = config.getTimeout(TimeUnit.MILLISECONDS);
-
+    
     Runnable failureHandler = new Runnable() {
       
       @Override
       public void run() {
-          List<QCMutation> mutations = new ArrayList<QCMutation>();
-          failedMutations.drainTo(mutations);
-          queue(mutations);
+        List<QCMutation> mutations = new ArrayList<QCMutation>();
+        failedMutations.drainTo(mutations);
+        queue(mutations);
       }
     };
     
@@ -390,46 +387,46 @@ class ConditionalWriterImpl implements ConditionalWriter {
     
     threadPool.scheduleAtFixedRate(failureHandler, 250, 250, TimeUnit.MILLISECONDS);
   }
-
+  
+  @Override
   public Iterator<Result> write(Iterator<ConditionalMutation> mutations) {
-
+    
     BlockingQueue<Result> resultQueue = new LinkedBlockingQueue<Result>();
-
+    
     List<QCMutation> mutationList = new ArrayList<QCMutation>();
-
+    
     int count = 0;
-
+    
     long entryTime = System.currentTimeMillis();
-
+    
     mloop: while (mutations.hasNext()) {
       ConditionalMutation mut = mutations.next();
       count++;
-
+      
       for (Condition cond : mut.getConditions()) {
         if (!isVisible(cond.getVisibility())) {
           resultQueue.add(new Result(Status.INVISIBLE_VISIBILITY, mut, null));
           continue mloop;
         }
       }
-
+      
       // copy the mutations so that even if caller changes it, it will not matter
       mutationList.add(new QCMutation(mut, resultQueue, entryTime));
     }
-
+    
     queue(mutationList);
-
+    
     return new RQIterator(resultQueue, count);
-
+    
   }
-
+  
   private class SendTask implements Runnable {
     
-
     String location;
     
     public SendTask(String location) {
       this.location = location;
-
+      
     }
     
     @Override
@@ -445,7 +442,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
   }
   
   private static class CMK {
-
+    
     QCMutation cm;
     KeyExtent ke;
     
@@ -454,7 +451,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
       this.cm = cm;
     }
   }
-
+  
   private static class SessionID {
     String location;
     String lockId;
@@ -468,10 +465,10 @@ class ConditionalWriterImpl implements ConditionalWriter {
     }
   }
   
-  private HashMap<String, SessionID> cachedSessionIDs = new HashMap<String, SessionID>();
+  private HashMap<String,SessionID> cachedSessionIDs = new HashMap<String,SessionID>();
   
   private SessionID reserveSessionID(String location, TabletClientService.Iface client, TInfo tinfo) throws ThriftSecurityException, TException {
-    //avoid cost of repeatedly making RPC to create sessions, reuse sessions
+    // avoid cost of repeatedly making RPC to create sessions, reuse sessions
     synchronized (cachedSessionIDs) {
       SessionID sid = cachedSessionIDs.get(location);
       if (sid != null) {
@@ -487,7 +484,8 @@ class ConditionalWriterImpl implements ConditionalWriter {
       }
     }
     
-    TConditionalSession tcs = client.startConditionalUpdate(tinfo, credentials, ByteBufferUtil.toByteBuffers(auths.getAuthorizations()), tableId);
+    TConditionalSession tcs = client.startConditionalUpdate(tinfo, credentials.toThrift(instance), ByteBufferUtil.toByteBuffers(auths.getAuthorizations()),
+        tableId);
     
     synchronized (cachedSessionIDs) {
       SessionID sid = new SessionID();
@@ -498,7 +496,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
       sid.location = location;
       if (cachedSessionIDs.put(location, sid) != null)
         throw new IllegalStateException();
-
+      
       return sid;
     }
     
@@ -511,7 +509,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
     
   }
   
-  private void unreserveSessionID(String location){
+  private void unreserveSessionID(String location) {
     synchronized (cachedSessionIDs) {
       SessionID sid = cachedSessionIDs.get(location);
       if (sid != null) {
@@ -530,7 +528,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
         activeSessions.add(sid);
     return activeSessions;
   }
-
+  
   private TabletClientService.Iface getClient(String location) throws TTransportException {
     TabletClientService.Iface client;
     if (timeout < instance.getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT))
@@ -539,23 +537,23 @@ class ConditionalWriterImpl implements ConditionalWriter {
       client = ThriftUtil.getTServerClient(location, instance.getConfiguration());
     return client;
   }
-
+  
   private void sendToServer(String location, TabletServerMutations<QCMutation> mutations) {
     TabletClientService.Iface client = null;
     
     TInfo tinfo = Tracer.traceInfo();
-
+    
     Map<Long,CMK> cmidToCm = new HashMap<Long,CMK>();
     MutableLong cmid = new MutableLong(0);
-
+    
     SessionID sessionId = null;
     
     try {
       
       client = getClient(location);
-
+      
       Map<TKeyExtent,List<TConditionalMutation>> tmutations = new HashMap<TKeyExtent,List<TConditionalMutation>>();
-
+      
       CompressedIterators compressedIters = new CompressedIterators();
       convertMutations(mutations, cmidToCm, cmid, tmutations, compressedIters);
       
@@ -571,9 +569,9 @@ class ConditionalWriterImpl implements ConditionalWriter {
       }
       
       HashSet<KeyExtent> extentsToInvalidate = new HashSet<KeyExtent>();
-
+      
       ArrayList<QCMutation> ignored = new ArrayList<QCMutation>();
-
+      
       for (TCMResult tcmResult : tresults) {
         if (tcmResult.status == TCMStatus.IGNORED) {
           CMK cmk = cmidToCm.get(tcmResult.cmid);
@@ -584,13 +582,13 @@ class ConditionalWriterImpl implements ConditionalWriter {
           qcm.queueResult(new Result(fromThrift(tcmResult.status), qcm, location));
         }
       }
-
+      
       for (KeyExtent ke : extentsToInvalidate) {
         locator.invalidateCache(ke);
       }
-
+      
       queueRetry(ignored, location);
-
+      
     } catch (ThriftSecurityException tse) {
       AccumuloSecurityException ase = new AccumuloSecurityException(credentials.getPrincipal(), tse.getCode(), Tables.getPrintableTableInfoFromId(instance,
           tableId), tse);
@@ -610,29 +608,28 @@ class ConditionalWriterImpl implements ConditionalWriter {
       ThriftUtil.returnClient((TServiceClient) client);
     }
   }
-
-
+  
   private void queueRetry(Map<Long,CMK> cmidToCm, String location) {
     ArrayList<QCMutation> ignored = new ArrayList<QCMutation>();
     for (CMK cmk : cmidToCm.values())
-    	ignored.add(cmk.cm);
+      ignored.add(cmk.cm);
     queueRetry(ignored, location);
   }
-
+  
   private void queueException(String location, Map<Long,CMK> cmidToCm, Exception e) {
     for (CMK cmk : cmidToCm.values())
       cmk.cm.queueResult(new Result(e, cmk.cm, location));
   }
-
+  
   private void invalidateSession(String location, TabletServerMutations<QCMutation> mutations, Map<Long,CMK> cmidToCm, SessionID sessionId) {
-    if(sessionId == null){
+    if (sessionId == null) {
       queueRetry(cmidToCm, location);
-    }else{
+    } else {
       try {
         invalidateSession(sessionId, location, mutations);
         for (CMK cmk : cmidToCm.values())
           cmk.cm.queueResult(new Result(Status.UNKNOWN, cmk.cm, location));
-      }catch(Exception e2){
+      } catch (Exception e2) {
         queueException(location, cmidToCm, e2);
       }
     }
@@ -654,11 +651,11 @@ class ConditionalWriterImpl implements ConditionalWriter {
     }
     
     long sleepTime = 50;
-
+    
     long startTime = System.currentTimeMillis();
-
+    
     LockID lid = new LockID(ZooUtil.getRoot(instance) + Constants.ZTSERVERS, sessionId.lockId);
-
+    
     while (true) {
       if (!ZooLock.isLockHeld(ServerClient.getZooCache(instance), lid)) {
         // TODO if ACCUMULO-1152 adds a tserver lock check to the tablet location cache, then this invalidation would prevent future attempts to contact the
@@ -670,7 +667,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
       try {
         // if the mutation is currently processing, this method will block until its done or times out
         invalidateSession(sessionId.sessionID, location);
-
+        
         return;
       } catch (TApplicationException tae) {
         throw new AccumuloServerException(location, tae);
@@ -680,12 +677,12 @@ class ConditionalWriterImpl implements ConditionalWriter {
       
       if ((System.currentTimeMillis() - startTime) + sleepTime > timeout)
         throw new TimedOutException(Collections.singleton(location));
-
+      
       UtilWaitThread.sleep(sleepTime);
       sleepTime = Math.min(2 * sleepTime, MAX_SLEEP);
-
+      
     }
-	
+    
   }
   
   private void invalidateSession(long sessionId, String location) throws TException {
@@ -700,7 +697,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
       ThriftUtil.returnClient((TServiceClient) client);
     }
   }
-
+  
   private Status fromThrift(TCMStatus status) {
     switch (status) {
       case ACCEPTED:
@@ -713,10 +710,10 @@ class ConditionalWriterImpl implements ConditionalWriter {
         throw new IllegalArgumentException(status.toString());
     }
   }
-
+  
   private void convertMutations(TabletServerMutations<QCMutation> mutations, Map<Long,CMK> cmidToCm, MutableLong cmid,
       Map<TKeyExtent,List<TConditionalMutation>> tmutations, CompressedIterators compressedIters) {
-
+    
     for (Entry<KeyExtent,List<QCMutation>> entry : mutations.getMutations().entrySet()) {
       TKeyExtent tke = entry.getKey().toThrift();
       ArrayList<TConditionalMutation> tcondMutaions = new ArrayList<TConditionalMutation>();
@@ -725,9 +722,9 @@ class ConditionalWriterImpl implements ConditionalWriter {
       
       for (QCMutation cm : condMutations) {
         TMutation tm = cm.toThrift();
-
+        
         List<TCondition> conditions = convertConditions(cm, compressedIters);
-
+        
         cmidToCm.put(cmid.longValue(), new CMK(entry.getKey(), cm));
         TConditionalMutation tcm = new TConditionalMutation(conditions, tm, cmid.longValue());
         cmid.increment();
@@ -737,7 +734,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
       tmutations.put(tke, tcondMutaions);
     }
   }
-
+  
   private List<TCondition> convertConditions(ConditionalMutation cm, CompressedIterators compressedIters) {
     List<TCondition> conditions = new ArrayList<TCondition>(cm.getConditions().size());
     
@@ -760,7 +757,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
     
     return conditions;
   }
-
+  
   private boolean isVisible(ByteSequence cv) {
     Text testVis = new Text(cv.toArray());
     if (testVis.getLength() == 0)
@@ -780,7 +777,8 @@ class ConditionalWriterImpl implements ConditionalWriter {
       return false;
     }
   }
-
+  
+  @Override
   public Result write(ConditionalMutation mutation) {
     return write(Collections.singleton(mutation).iterator()).next();
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
index 57e36fd..14df55f 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
@@ -42,29 +42,29 @@ import org.apache.accumulo.core.client.impl.thrift.ClientService;
 import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.accumulo.trace.instrument.Tracer;
 
 public class ConnectorImpl extends Connector {
   private final Instance instance;
-  private final TCredentials credentials;
+  private final Credentials credentials;
   private SecurityOperations secops = null;
   private TableOperations tableops = null;
   private InstanceOperations instanceops = null;
   
-  public ConnectorImpl(Instance instance, TCredentials cred) throws AccumuloException, AccumuloSecurityException {
+  public ConnectorImpl(final Instance instance, Credentials cred) throws AccumuloException, AccumuloSecurityException {
     ArgumentChecker.notNull(instance, cred);
     this.instance = instance;
     
     this.credentials = cred;
     
     // Skip fail fast for system services; string literal for class name, to avoid
-    if (!"org.apache.accumulo.server.security.SystemCredentials$SystemToken".equals(cred.getTokenClassName())) {
+    if (!"org.apache.accumulo.server.security.SystemCredentials$SystemToken".equals(cred.getToken().getClass().getName())) {
       ServerClient.execute(instance, new ClientExec<ClientService.Client>() {
         @Override
         public void execute(ClientService.Client iface) throws Exception {
-          if (!iface.authenticate(Tracer.traceInfo(), credentials))
+          if (!iface.authenticate(Tracer.traceInfo(), credentials.toThrift(instance)))
             throw new AccumuloSecurityException("Authentication failed, access denied", SecurityErrorCode.BAD_CREDENTIALS);
         }
       });

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
index 4537ae8..0d2d44d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
@@ -29,7 +29,7 @@ import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.TableOfflineException;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.master.state.tables.TableState;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.log4j.Logger;
 
@@ -72,7 +72,7 @@ public class MultiTableBatchWriterImpl implements MultiTableBatchWriter {
   private HashMap<String,BatchWriter> tableWriters;
   private Instance instance;
   
-  public MultiTableBatchWriterImpl(Instance instance, TCredentials credentials, BatchWriterConfig config) {
+  public MultiTableBatchWriterImpl(Instance instance, Credentials credentials, BatchWriterConfig config) {
     ArgumentChecker.notNull(instance, credentials);
     this.instance = instance;
     this.bw = new TabletServerBatchWriter(instance, credentials, config);
@@ -80,10 +80,12 @@ public class MultiTableBatchWriterImpl implements MultiTableBatchWriter {
     this.closed = false;
   }
   
+  @Override
   public boolean isClosed() {
     return this.closed;
   }
   
+  @Override
   public void close() throws MutationsRejectedException {
     bw.close();
     this.closed = true;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java b/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
index 3dc19cd..385a1cc 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
@@ -58,8 +58,7 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.ColumnVisibility;
-import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.LocalityGroupUtil;
@@ -119,13 +118,7 @@ class OfflineIterator implements Iterator<Entry<Key,Value>> {
   private ScannerOptions options;
   private ArrayList<SortedKeyValueIterator<Key,Value>> readers;
   
-  /**
-   * @param instance
-   * @param credentials
-   * @param authorizations
-   * @param table
-   */
-  public OfflineIterator(ScannerOptions options, Instance instance, TCredentials credentials, Authorizations authorizations, Text table, Range range) {
+  public OfflineIterator(ScannerOptions options, Instance instance, Credentials credentials, Authorizations authorizations, Text table, Range range) {
     this.options = new ScannerOptions(options);
     this.instance = instance;
     this.range = range;
@@ -139,7 +132,7 @@ class OfflineIterator implements Iterator<Entry<Key,Value>> {
     this.readers = new ArrayList<SortedKeyValueIterator<Key,Value>>();
     
     try {
-      conn = instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials));
+      conn = instance.getConnector(credentials.getPrincipal(), credentials.getToken());
       nextTablet();
       
       while (iter != null && !iter.hasTop())
@@ -357,11 +350,11 @@ public class OfflineScanner extends ScannerOptions implements Scanner {
   private Range range;
   
   private Instance instance;
-  private TCredentials credentials;
+  private Credentials credentials;
   private Authorizations authorizations;
   private Text tableId;
   
-  public OfflineScanner(Instance instance, TCredentials credentials, String tableId, Authorizations authorizations) {
+  public OfflineScanner(Instance instance, Credentials credentials, String tableId, Authorizations authorizations) {
     ArgumentChecker.notNull(instance, credentials, tableId, authorizations);
     this.instance = instance;
     this.credentials = credentials;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java
index 88e5c3a..0a96bab 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java
@@ -29,7 +29,7 @@ import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.metadata.RootTable;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.hadoop.io.Text;
 
@@ -42,8 +42,8 @@ public class RootTabletLocator extends TabletLocator {
   }
   
   @Override
-  public <T extends Mutation> void binMutations(List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures,
-      TCredentials credentials) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+  public <T extends Mutation> void binMutations(Credentials credentials, List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures)
+      throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
     String rootTabletLocation = instance.getRootTabletLocation();
     if (rootTabletLocation != null) {
       TabletServerMutations<T> tsm = new TabletServerMutations<T>();
@@ -57,7 +57,7 @@ public class RootTabletLocator extends TabletLocator {
   }
   
   @Override
-  public List<Range> binRanges(List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges, TCredentials credentials) throws AccumuloException,
+  public List<Range> binRanges(Credentials credentials, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges) throws AccumuloException,
       AccumuloSecurityException, TableNotFoundException {
     
     String rootTabletLocation = instance.getRootTabletLocation();
@@ -83,7 +83,7 @@ public class RootTabletLocator extends TabletLocator {
   public void invalidateCache() {}
   
   @Override
-  public TabletLocation locateTablet(Text row, boolean skipRow, boolean retry, TCredentials credentials) throws AccumuloException, AccumuloSecurityException,
+  public TabletLocation locateTablet(Credentials credentials, Text row, boolean skipRow, boolean retry) throws AccumuloException, AccumuloSecurityException,
       TableNotFoundException {
     String location = instance.getRootTabletLocation();
     // Always retry when finding the root tablet

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java
index e757da5..5f845cc 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java
@@ -27,18 +27,16 @@ import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.hadoop.io.Text;
 
 /**
  * provides scanner functionality
  * 
- * "Clients can iterate over multiple column families, and there are several 
- * mechanisms for limiting the rows, columns, and timestamps traversed by a 
- * scan. For example, we could restrict [a] scan ... to only produce anchors 
- * whose columns match [a] regular expression ..., or to only produce 
- * anchors whose timestamps fall within ten days of the current time."
+ * "Clients can iterate over multiple column families, and there are several mechanisms for limiting the rows, columns, and timestamps traversed by a scan. For
+ * example, we could restrict [a] scan ... to only produce anchors whose columns match [a] regular expression ..., or to only produce anchors whose timestamps
+ * fall within ten days of the current time."
  * 
  */
 public class ScannerImpl extends ScannerOptions implements Scanner {
@@ -49,7 +47,7 @@ public class ScannerImpl extends ScannerOptions implements Scanner {
   // and just query for the next highest row from the tablet server
   
   private Instance instance;
-  private TCredentials credentials;
+  private Credentials credentials;
   private Authorizations authorizations;
   private Text table;
   
@@ -58,7 +56,7 @@ public class ScannerImpl extends ScannerOptions implements Scanner {
   private Range range;
   private boolean isolated = false;
   
-  public ScannerImpl(Instance instance, TCredentials credentials, String table, Authorizations authorizations) {
+  public ScannerImpl(Instance instance, Credentials credentials, String table, Authorizations authorizations) {
     ArgumentChecker.notNull(instance, credentials, table, authorizations);
     this.instance = instance;
     this.credentials = credentials;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
index 9d282e2..f81759d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
@@ -39,7 +39,7 @@ import org.apache.accumulo.core.data.KeyValue;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.NamingThreadFactory;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
@@ -55,7 +55,7 @@ public class ScannerIterator implements Iterator<Entry<Key,Value>> {
   // scanner state
   private Iterator<KeyValue> iter;
   private ScanState scanState;
-  private TCredentials credentials;
+  private Credentials credentials;
   private Instance instance;
   
   private ScannerOptions options;
@@ -71,7 +71,7 @@ public class ScannerIterator implements Iterator<Entry<Key,Value>> {
   
   private static ThreadPoolExecutor readaheadPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 3l, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
       new NamingThreadFactory("Accumulo scanner read ahead thread"));
-
+  
   private class Reader implements Runnable {
     
     @Override
@@ -121,7 +121,7 @@ public class ScannerIterator implements Iterator<Entry<Key,Value>> {
     
   }
   
-  ScannerIterator(Instance instance, TCredentials credentials, Text table, Authorizations authorizations, Range range, int size, int timeOut,
+  ScannerIterator(Instance instance, Credentials credentials, Text table, Authorizations authorizations, Range range, int size, int timeOut,
       ScannerOptions options, boolean isolated) {
     this.instance = instance;
     this.tableId = new Text(table);
@@ -136,7 +136,7 @@ public class ScannerIterator implements Iterator<Entry<Key,Value>> {
       range = range.bound(this.options.fetchedColumns.first(), this.options.fetchedColumns.last());
     }
     
-    scanState = new ScanState(credentials, tableId, authorizations, new Range(range), options.fetchedColumns, size, options.serverSideIteratorList,
+    scanState = new ScanState(instance, credentials, tableId, authorizations, new Range(range), options.fetchedColumns, size, options.serverSideIteratorList,
         options.serverSideIteratorOptions, isolated);
     readaheadInProgress = false;
     iter = null;
@@ -147,6 +147,7 @@ public class ScannerIterator implements Iterator<Entry<Key,Value>> {
     readaheadPool.execute(new Reader());
   }
   
+  @Override
   @SuppressWarnings("unchecked")
   public boolean hasNext() {
     if (finished)
@@ -196,6 +197,7 @@ public class ScannerIterator implements Iterator<Entry<Key,Value>> {
     return true;
   }
   
+  @Override
   public Entry<Key,Value> next() {
     if (hasNext())
       return iter.next();
@@ -204,6 +206,7 @@ public class ScannerIterator implements Iterator<Entry<Key,Value>> {
   
   // just here to satisfy the interface
   // could make this actually delete things from the database
+  @Override
   public void remove() {
     throw new UnsupportedOperationException("remove is not supported in Scanner");
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
index f9110b2..294d702 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
@@ -34,19 +34,19 @@ import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.metadata.MetadataLocationObtainer;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.RootTable;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.hadoop.io.Text;
 
 public abstract class TabletLocator {
   
-  public abstract TabletLocation locateTablet(Text row, boolean skipRow, boolean retry, TCredentials credentials) throws AccumuloException,
+  public abstract TabletLocation locateTablet(Credentials credentials, Text row, boolean skipRow, boolean retry) throws AccumuloException,
       AccumuloSecurityException, TableNotFoundException;
   
-  public abstract <T extends Mutation> void binMutations(List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures,
-      TCredentials credentials) throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
+  public abstract <T extends Mutation> void binMutations(Credentials credentials, List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations,
+      List<T> failures) throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
   
-  public abstract List<Range> binRanges(List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges, TCredentials credentials)
+  public abstract List<Range> binRanges(Credentials credentials, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges)
       throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
   
   public abstract void invalidateCache(KeyExtent failedExtent);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
index 4b2e1d3..d8873e6 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
@@ -39,7 +39,7 @@ import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.PartialKey;
 import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.OpTimer;
 import org.apache.accumulo.core.util.TextUtil;
 import org.apache.accumulo.core.util.UtilWaitThread;
@@ -96,10 +96,10 @@ public class TabletLocatorImpl extends TabletLocator {
     /**
      * @return null when unable to read information successfully
      */
-    TabletLocations lookupTablet(TabletLocation src, Text row, Text stopRow, TabletLocator parent, TCredentials credentials) throws AccumuloSecurityException,
+    TabletLocations lookupTablet(Credentials credentials, TabletLocation src, Text row, Text stopRow, TabletLocator parent) throws AccumuloSecurityException,
         AccumuloException;
     
-    List<TabletLocation> lookupTablets(String tserver, Map<KeyExtent,List<Range>> map, TabletLocator parent, TCredentials credentials)
+    List<TabletLocation> lookupTablets(Credentials credentials, String tserver, Map<KeyExtent,List<Range>> map, TabletLocator parent)
         throws AccumuloSecurityException, AccumuloException;
   }
   
@@ -113,8 +113,8 @@ public class TabletLocatorImpl extends TabletLocator {
   }
   
   @Override
-  public <T extends Mutation> void binMutations(List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures,
-      TCredentials credentials) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+  public <T extends Mutation> void binMutations(Credentials credentials, List<T> mutations, Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures)
+      throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
     
     OpTimer opTimer = null;
     if (log.isTraceEnabled())
@@ -167,7 +167,7 @@ public class TabletLocatorImpl extends TabletLocator {
           
           row.set(mutation.getRow());
           
-          TabletLocation tl = _locateTablet(row, false, false, false, credentials);
+          TabletLocation tl = _locateTablet(credentials, row, false, false, false);
           
           if (tl == null) {
             failures.add(mutation);
@@ -196,7 +196,7 @@ public class TabletLocatorImpl extends TabletLocator {
     tsm.addMutation(tl.tablet_extent, mutation);
   }
   
-  private List<Range> binRanges(List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges, boolean useCache, TCredentials credentials)
+  private List<Range> binRanges(Credentials credentials, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges, boolean useCache)
       throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
     List<Range> failures = new ArrayList<Range>();
     List<TabletLocation> tabletLocations = new ArrayList<TabletLocation>();
@@ -218,7 +218,7 @@ public class TabletLocatorImpl extends TabletLocator {
       if (useCache)
         tl = locateTabletInCache(startRow);
       else if (!lookupFailed)
-        tl = _locateTablet(startRow, false, false, false, credentials);
+        tl = _locateTablet(credentials, startRow, false, false, false);
       
       if (tl == null) {
         failures.add(range);
@@ -235,7 +235,7 @@ public class TabletLocatorImpl extends TabletLocator {
           row.append(new byte[] {0}, 0, 1);
           tl = locateTabletInCache(row);
         } else {
-          tl = _locateTablet(tl.tablet_extent.getEndRow(), true, false, false, credentials);
+          tl = _locateTablet(credentials, tl.tablet_extent.getEndRow(), true, false, false);
         }
         
         if (tl == null) {
@@ -257,7 +257,7 @@ public class TabletLocatorImpl extends TabletLocator {
   }
   
   @Override
-  public List<Range> binRanges(List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges, TCredentials credentials) throws AccumuloException,
+  public List<Range> binRanges(Credentials credentials, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges) throws AccumuloException,
       AccumuloSecurityException, TableNotFoundException {
     
     /*
@@ -279,7 +279,7 @@ public class TabletLocatorImpl extends TabletLocator {
       // sort ranges... therefore try binning ranges using only the cache
       // and sort whatever fails and retry
       
-      failures = binRanges(ranges, binnedRanges, true, credentials);
+      failures = binRanges(credentials, ranges, binnedRanges, true);
     } finally {
       rLock.unlock();
     }
@@ -291,7 +291,7 @@ public class TabletLocatorImpl extends TabletLocator {
       // try lookups again
       wLock.lock();
       try {
-        failures = binRanges(failures, binnedRanges, false, credentials);
+        failures = binRanges(credentials, failures, binnedRanges, false);
       } finally {
         wLock.unlock();
       }
@@ -362,7 +362,7 @@ public class TabletLocatorImpl extends TabletLocator {
   }
   
   @Override
-  public TabletLocation locateTablet(Text row, boolean skipRow, boolean retry, TCredentials credentials) throws AccumuloException, AccumuloSecurityException,
+  public TabletLocation locateTablet(Credentials credentials, Text row, boolean skipRow, boolean retry) throws AccumuloException, AccumuloSecurityException,
       TableNotFoundException {
     
     OpTimer opTimer = null;
@@ -374,7 +374,7 @@ public class TabletLocatorImpl extends TabletLocator {
       
       TabletLocation tl;
       
-      tl = _locateTablet(row, skipRow, retry, true, credentials);
+      tl = _locateTablet(credentials, row, skipRow, retry, true);
       
       if (retry && tl == null) {
         UtilWaitThread.sleep(100);
@@ -390,23 +390,23 @@ public class TabletLocatorImpl extends TabletLocator {
     }
   }
   
-  private void lookupTabletLocation(Text row, boolean retry, TCredentials credentials) throws AccumuloException, AccumuloSecurityException,
+  private void lookupTabletLocation(Credentials credentials, Text row, boolean retry) throws AccumuloException, AccumuloSecurityException,
       TableNotFoundException {
     Text metadataRow = new Text(tableId);
     metadataRow.append(new byte[] {';'}, 0, 1);
     metadataRow.append(row.getBytes(), 0, row.getLength());
-    TabletLocation ptl = parent.locateTablet(metadataRow, false, retry, credentials);
+    TabletLocation ptl = parent.locateTablet(credentials, metadataRow, false, retry);
     
     if (ptl != null) {
-      TabletLocations locations = locationObtainer.lookupTablet(ptl, metadataRow, lastTabletRow, parent, credentials);
+      TabletLocations locations = locationObtainer.lookupTablet(credentials, ptl, metadataRow, lastTabletRow, parent);
       while (locations != null && locations.getLocations().isEmpty() && locations.getLocationless().isEmpty()) {
         // try the next tablet, the current tablet does not have any tablets that overlap the row
         Text er = ptl.tablet_extent.getEndRow();
         if (er != null && er.compareTo(lastTabletRow) < 0) {
           // System.out.println("er "+er+"  ltr "+lastTabletRow);
-          ptl = parent.locateTablet(er, true, retry, credentials);
+          ptl = parent.locateTablet(credentials, er, true, retry);
           if (ptl != null)
-            locations = locationObtainer.lookupTablet(ptl, metadataRow, lastTabletRow, parent, credentials);
+            locations = locationObtainer.lookupTablet(credentials, ptl, metadataRow, lastTabletRow, parent);
           else
             break;
         } else {
@@ -523,7 +523,7 @@ public class TabletLocatorImpl extends TabletLocator {
     return null;
   }
   
-  protected TabletLocation _locateTablet(Text row, boolean skipRow, boolean retry, boolean lock, TCredentials credentials) throws AccumuloException,
+  protected TabletLocation _locateTablet(Credentials credentials, Text row, boolean skipRow, boolean retry, boolean lock) throws AccumuloException,
       AccumuloSecurityException, TableNotFoundException {
     
     if (skipRow) {
@@ -548,7 +548,7 @@ public class TabletLocatorImpl extends TabletLocator {
         wLock.lock();
       try {
         // not in cache, so obtain info
-        lookupTabletLocation(row, retry, credentials);
+        lookupTabletLocation(credentials, row, retry);
         
         tl = locateTabletInCache(row);
       } finally {
@@ -560,7 +560,7 @@ public class TabletLocatorImpl extends TabletLocator {
     return tl;
   }
   
-  private void processInvalidated(TCredentials credentials) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
+  private void processInvalidated(Credentials credentials) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
     
     if (badExtents.size() == 0)
       return;
@@ -585,14 +585,14 @@ public class TabletLocatorImpl extends TabletLocator {
       
       Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
       
-      parent.binRanges(lookups, binnedRanges, credentials);
+      parent.binRanges(credentials, lookups, binnedRanges);
       
       // randomize server order
       ArrayList<String> tabletServers = new ArrayList<String>(binnedRanges.keySet());
       Collections.shuffle(tabletServers);
       
       for (String tserver : tabletServers) {
-        List<TabletLocation> locations = locationObtainer.lookupTablets(tserver, binnedRanges.get(tserver), parent, credentials);
+        List<TabletLocation> locations = locationObtainer.lookupTablets(credentials, tserver, binnedRanges.get(tserver), parent);
         
         for (TabletLocation tabletLocation : locations) {
           updateCache(tabletLocation);


Mime
View raw message