accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [3/6] ACCUMULO-1312 use Credentials object to avoid serializing as long as possible
Date Fri, 26 Jul 2013 23:58:51 GMT
http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
index fe2f09c..13350d5 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
@@ -51,7 +51,7 @@ 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.metadata.schema.MetadataSchema.TabletsSection;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.hadoop.io.Text;
 
@@ -59,7 +59,7 @@ public class TabletLocatorImplTest extends TestCase {
   
   private static final KeyExtent RTE = RootTable.EXTENT;
   private static final KeyExtent MTE = new KeyExtent(new Text(MetadataTable.ID), null, RTE.getEndRow());
-  private static TCredentials credential = null;
+  private static Credentials credentials = null;
   
   static KeyExtent nke(String t, String er, String per) {
     return new KeyExtent(new Text(t), er == null ? null : new Text(er), per == null ? null : new Text(per));
@@ -167,7 +167,7 @@ public class TabletLocatorImplTest extends TestCase {
       List<Range> efailures) throws Exception {
     
     Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
-    List<Range> f = tab1TabletCache.binRanges(ranges, binnedRanges, credential);
+    List<Range> f = tab1TabletCache.binRanges(credentials, ranges, binnedRanges);
     assertEquals(expected, binnedRanges);
     
     HashSet<Range> f1 = new HashSet<Range>(f);
@@ -221,7 +221,7 @@ public class TabletLocatorImplTest extends TestCase {
   private void runTest(TabletLocatorImpl metaCache, List<Mutation> ml, Map<String,Map<KeyExtent,List<String>>> emb, String... efailures) throws Exception {
     Map<String,TabletServerMutations<Mutation>> binnedMutations = new HashMap<String,TabletServerMutations<Mutation>>();
     List<Mutation> afailures = new ArrayList<Mutation>();
-    metaCache.binMutations(ml, binnedMutations, afailures, credential);
+    metaCache.binMutations(credentials, ml, binnedMutations, afailures);
     
     verify(emb, binnedMutations);
     
@@ -470,7 +470,7 @@ public class TabletLocatorImplTest extends TestCase {
     }
     
     @Override
-    public TabletLocations lookupTablet(TabletLocation src, Text row, Text stopRow, TabletLocator parent, TCredentials credentials)
+    public TabletLocations lookupTablet(Credentials credentials, TabletLocation src, Text row, Text stopRow, TabletLocator parent)
         throws AccumuloSecurityException {
       
       // System.out.println("lookupTablet("+src+","+row+","+stopRow+","+ parent+")");
@@ -510,7 +510,7 @@ public class TabletLocatorImplTest extends TestCase {
     }
     
     @Override
-    public List<TabletLocation> lookupTablets(String tserver, Map<KeyExtent,List<Range>> map, TabletLocator parent, TCredentials credentials)
+    public List<TabletLocation> lookupTablets(Credentials credentials, String tserver, Map<KeyExtent,List<Range>> map, TabletLocator parent)
         throws AccumuloSecurityException {
       
       ArrayList<TabletLocation> list = new ArrayList<TabletLocation>();
@@ -621,9 +621,9 @@ public class TabletLocatorImplTest extends TestCase {
     
   }
   
-  private void locateTabletTest(TabletLocatorImpl cache, String row, boolean skipRow, KeyExtent expected, String server, TCredentials credentials)
+  private void locateTabletTest(TabletLocatorImpl cache, String row, boolean skipRow, KeyExtent expected, String server, Credentials credentials)
       throws Exception {
-    TabletLocation tl = cache.locateTablet(new Text(row), skipRow, false, credentials);
+    TabletLocation tl = cache.locateTablet(credentials, new Text(row), skipRow, false);
     
     if (expected == null) {
       if (tl != null)
@@ -636,7 +636,7 @@ public class TabletLocatorImplTest extends TestCase {
     }
   }
   
-  private void locateTabletTest(TabletLocatorImpl cache, String row, KeyExtent expected, String server, TCredentials credentials) throws Exception {
+  private void locateTabletTest(TabletLocatorImpl cache, String row, KeyExtent expected, String server, Credentials credentials) throws Exception {
     locateTabletTest(cache, row, false, expected, server, credentials);
   }
   
@@ -649,15 +649,15 @@ public class TabletLocatorImplTest extends TestCase {
     TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(MetadataTable.ID), rtl, ttlo);
     TabletLocatorImpl tab1TabletCache = new TabletLocatorImpl(new Text("tab1"), rootTabletCache, ttlo);
     
-    locateTabletTest(tab1TabletCache, "r1", null, null, credential);
+    locateTabletTest(tab1TabletCache, "r1", null, null, credentials);
     
     KeyExtent tab1e = nke("tab1", null, null);
     
     setLocation(tservers, "tserver1", RTE, MTE, "tserver2");
     setLocation(tservers, "tserver2", MTE, tab1e, "tserver3");
     
-    locateTabletTest(tab1TabletCache, "r1", tab1e, "tserver3", credential);
-    locateTabletTest(tab1TabletCache, "r2", tab1e, "tserver3", credential);
+    locateTabletTest(tab1TabletCache, "r1", tab1e, "tserver3", credentials);
+    locateTabletTest(tab1TabletCache, "r2", tab1e, "tserver3", credentials);
     
     // simulate a split
     KeyExtent tab1e1 = nke("tab1", "g", null);
@@ -666,41 +666,41 @@ public class TabletLocatorImplTest extends TestCase {
     setLocation(tservers, "tserver2", MTE, tab1e1, "tserver4");
     setLocation(tservers, "tserver2", MTE, tab1e2, "tserver5");
     
-    locateTabletTest(tab1TabletCache, "r1", tab1e, "tserver3", credential);
+    locateTabletTest(tab1TabletCache, "r1", tab1e, "tserver3", credentials);
     tab1TabletCache.invalidateCache(tab1e);
-    locateTabletTest(tab1TabletCache, "r1", tab1e2, "tserver5", credential);
-    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4", credential);
-    locateTabletTest(tab1TabletCache, "a", true, tab1e1, "tserver4", credential);
-    locateTabletTest(tab1TabletCache, "g", tab1e1, "tserver4", credential);
-    locateTabletTest(tab1TabletCache, "g", true, tab1e2, "tserver5", credential);
+    locateTabletTest(tab1TabletCache, "r1", tab1e2, "tserver5", credentials);
+    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4", credentials);
+    locateTabletTest(tab1TabletCache, "a", true, tab1e1, "tserver4", credentials);
+    locateTabletTest(tab1TabletCache, "g", tab1e1, "tserver4", credentials);
+    locateTabletTest(tab1TabletCache, "g", true, tab1e2, "tserver5", credentials);
     
     // simulate a partial split
     KeyExtent tab1e22 = nke("tab1", null, "m");
     setLocation(tservers, "tserver2", MTE, tab1e22, "tserver6");
-    locateTabletTest(tab1TabletCache, "r1", tab1e2, "tserver5", credential);
+    locateTabletTest(tab1TabletCache, "r1", tab1e2, "tserver5", credentials);
     tab1TabletCache.invalidateCache(tab1e2);
-    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6", credential);
-    locateTabletTest(tab1TabletCache, "h", null, null, credential);
-    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4", credential);
+    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6", credentials);
+    locateTabletTest(tab1TabletCache, "h", null, null, credentials);
+    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4", credentials);
     KeyExtent tab1e21 = nke("tab1", "m", "g");
     setLocation(tservers, "tserver2", MTE, tab1e21, "tserver7");
-    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6", credential);
-    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver7", credential);
-    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4", credential);
+    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6", credentials);
+    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver7", credentials);
+    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4", credentials);
     
     // simulate a migration
     setLocation(tservers, "tserver2", MTE, tab1e21, "tserver8");
     tab1TabletCache.invalidateCache(tab1e21);
-    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6", credential);
-    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8", credential);
-    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4", credential);
+    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6", credentials);
+    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8", credentials);
+    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4", credentials);
     
     // simulate a server failure
     setLocation(tservers, "tserver2", MTE, tab1e21, "tserver9");
     tab1TabletCache.invalidateCache("tserver8");
-    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6", credential);
-    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver9", credential);
-    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4", credential);
+    locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6", credentials);
+    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver9", credentials);
+    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4", credentials);
     
     // simulate all servers failing
     deleteServer(tservers, "tserver1");
@@ -709,9 +709,9 @@ public class TabletLocatorImplTest extends TestCase {
     tab1TabletCache.invalidateCache("tserver6");
     tab1TabletCache.invalidateCache("tserver9");
     
-    locateTabletTest(tab1TabletCache, "r1", null, null, credential);
-    locateTabletTest(tab1TabletCache, "h", null, null, credential);
-    locateTabletTest(tab1TabletCache, "a", null, null, credential);
+    locateTabletTest(tab1TabletCache, "r1", null, null, credentials);
+    locateTabletTest(tab1TabletCache, "h", null, null, credentials);
+    locateTabletTest(tab1TabletCache, "a", null, null, credentials);
     
     testInstance.setRootTabletLocation("tserver4");
     setLocation(tservers, "tserver4", RTE, MTE, "tserver5");
@@ -719,9 +719,9 @@ public class TabletLocatorImplTest extends TestCase {
     setLocation(tservers, "tserver5", MTE, tab1e21, "tserver2");
     setLocation(tservers, "tserver5", MTE, tab1e22, "tserver3");
     
-    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver1", credential);
-    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver2", credential);
-    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver3", credential);
+    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver1", credentials);
+    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver2", credentials);
+    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver3", credentials);
     
     // simulate the !METADATA table splitting
     KeyExtent mte1 = new KeyExtent(new Text(MetadataTable.ID), tab1e21.getMetadataEntry(), RTE.getEndRow());
@@ -738,29 +738,29 @@ public class TabletLocatorImplTest extends TestCase {
     tab1TabletCache.invalidateCache(tab1e21);
     tab1TabletCache.invalidateCache(tab1e22);
     
-    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver7", credential);
-    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8", credential);
-    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credential);
+    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver7", credentials);
+    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8", credentials);
+    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credentials);
     
     // simulate metadata and regular server down and the reassigned
     deleteServer(tservers, "tserver5");
     tab1TabletCache.invalidateCache("tserver7");
-    locateTabletTest(tab1TabletCache, "a", null, null, credential);
-    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8", credential);
-    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credential);
+    locateTabletTest(tab1TabletCache, "a", null, null, credentials);
+    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8", credentials);
+    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credentials);
     
     setLocation(tservers, "tserver4", RTE, mte1, "tserver10");
     setLocation(tservers, "tserver10", mte1, tab1e1, "tserver7");
     setLocation(tservers, "tserver10", mte1, tab1e21, "tserver8");
     
-    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver7", credential);
-    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8", credential);
-    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credential);
+    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver7", credentials);
+    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8", credentials);
+    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credentials);
     tab1TabletCache.invalidateCache("tserver7");
     setLocation(tservers, "tserver10", mte1, tab1e1, "tserver2");
-    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver2", credential);
-    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8", credential);
-    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credential);
+    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver2", credentials);
+    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8", credentials);
+    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credentials);
     
     // simulate a hole in the !METADATA table, caused by a partial split
     KeyExtent mte11 = new KeyExtent(new Text(MetadataTable.ID), tab1e1.getMetadataEntry(), RTE.getEndRow());
@@ -772,16 +772,16 @@ public class TabletLocatorImplTest extends TestCase {
     // at this point should be no info in !METADATA about tab1e1
     tab1TabletCache.invalidateCache(tab1e1);
     tab1TabletCache.invalidateCache(tab1e21);
-    locateTabletTest(tab1TabletCache, "a", null, null, credential);
-    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver12", credential);
-    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credential);
+    locateTabletTest(tab1TabletCache, "a", null, null, credentials);
+    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver12", credentials);
+    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credentials);
     
     setLocation(tservers, "tserver4", RTE, mte11, "tserver5");
     setLocation(tservers, "tserver5", mte11, tab1e1, "tserver13");
     
-    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver13", credential);
-    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver12", credential);
-    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credential);
+    locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver13", credentials);
+    locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver12", credentials);
+    locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credentials);
   }
   
   public void test2() throws Exception {
@@ -794,13 +794,13 @@ public class TabletLocatorImplTest extends TestCase {
     setLocation(tservers, "tserver2", MTE, ke1, null);
     setLocation(tservers, "tserver2", MTE, ke2, "L1");
     
-    locateTabletTest(metaCache, "a", null, null, credential);
-    locateTabletTest(metaCache, "r", ke2, "L1", credential);
+    locateTabletTest(metaCache, "a", null, null, credentials);
+    locateTabletTest(metaCache, "r", ke2, "L1", credentials);
     
     setLocation(tservers, "tserver2", MTE, ke1, "L2");
     
-    locateTabletTest(metaCache, "a", ke1, "L2", credential);
-    locateTabletTest(metaCache, "r", ke2, "L1", credential);
+    locateTabletTest(metaCache, "a", ke1, "L2", credentials);
+    locateTabletTest(metaCache, "r", ke2, "L1", credentials);
   }
   
   public void testBinRanges1() throws Exception {
@@ -1192,7 +1192,7 @@ public class TabletLocatorImplTest extends TestCase {
     setLocation(tservers, "tserver3", mte2, ke2, "tserver5");
     
     // look up something that comes after the last entry in mte1
-    locateTabletTest(tab0TabletCache, "0bbff", ke2, "tserver5", credential);
+    locateTabletTest(tab0TabletCache, "0bbff", ke2, "tserver5", credentials);
   }
   
   public void testBug2() throws Exception {
@@ -1216,7 +1216,7 @@ public class TabletLocatorImplTest extends TestCase {
     ts3.put(mte2, new TreeMap<Key,Value>());
     tservers.tservers.put("tserver3", ts3);
     
-    assertNull(tab0TabletCache.locateTablet(new Text("row_0000000000"), false, false, credential));
+    assertNull(tab0TabletCache.locateTablet(credentials, new Text("row_0000000000"), false, false));
     
   }
   
@@ -1251,7 +1251,7 @@ public class TabletLocatorImplTest extends TestCase {
     createEmptyTablet(tservers, "tserver5", mte4);
     setLocation(tservers, "tserver6", mte5, ke1, "tserver7");
     
-    locateTabletTest(tab0TabletCache, "a", ke1, "tserver7", credential);
+    locateTabletTest(tab0TabletCache, "a", ke1, "tserver7", credentials);
     
   }
   
@@ -1267,7 +1267,7 @@ public class TabletLocatorImplTest extends TestCase {
     setLocation(tservers, "tserver2", MTE, ke1, "L2", "I2");
     
     try {
-      metaCache.locateTablet(new Text("a"), false, false, credential);
+      metaCache.locateTablet(credentials, new Text("a"), false, false);
       assertTrue(false);
     } catch (Exception e) {
       

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
index 63fe434..687e543 100644
--- a/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
@@ -28,8 +28,7 @@ import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 import org.junit.Test;
 
 public class MetadataServicerTest {
@@ -47,7 +46,7 @@ public class MetadataServicerTest {
     Connector connector = instance.getConnector("root", new PasswordToken(""));
     connector.tableOperations().create(userTableName);
     String userTableId = connector.tableOperations().tableIdMap().get(userTableName);
-    TCredentials credentials = CredentialHelper.createSquelchError("root", new PasswordToken(""), instance.getInstanceID());
+    Credentials credentials = new Credentials("root", new PasswordToken(""));
     
     MetadataServicer ms = MetadataServicer.forTableId(instance, credentials, RootTable.ID);
     assertTrue(ms instanceof ServicerForRootTable);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java b/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java
new file mode 100644
index 0000000..0ebdb06
--- /dev/null
+++ b/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.security;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Random;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
+import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer;
+import org.apache.accumulo.core.client.security.tokens.NullToken;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.commons.codec.binary.Base64;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class CredentialsTest {
+  
+  @Test
+  public void testSerializeDeserializeToken() throws AccumuloSecurityException, IOException {
+    Random random = new Random();
+    byte[] randomBytes = new byte[12];
+    random.nextBytes(randomBytes);
+    boolean allZero = true;
+    for (byte b : randomBytes)
+      allZero = allZero && b == 0;
+    assertFalse(allZero);
+    
+    byte[] serialized = AuthenticationTokenSerializer.serialize(new PasswordToken(randomBytes));
+    PasswordToken passwordToken = AuthenticationTokenSerializer.deserialize(PasswordToken.class, serialized);
+    assertArrayEquals(randomBytes, passwordToken.getPassword());
+    
+    serialized = AuthenticationTokenSerializer.serialize(new NullToken());
+    AuthenticationToken nullToken = AuthenticationTokenSerializer.deserialize(NullToken.class, serialized);
+    assertEquals(new NullToken(), nullToken);
+  }
+  
+  @Deprecated
+  @Test
+  public void testSameAsCredentialHelper() throws AccumuloSecurityException {
+    byte[] serialized = AuthenticationTokenSerializer.serialize(new PasswordToken("myPass"));
+    AuthenticationToken token = CredentialHelper.extractToken(PasswordToken.class.getName(), serialized);
+    assertTrue(token instanceof PasswordToken);
+    assertArrayEquals(serialized, Base64.decodeBase64(CredentialHelper.tokenAsBase64(new PasswordToken("myPass"))));
+    assertEquals("myPass", new String(((PasswordToken) token).getPassword(), Constants.UTF8));
+    
+    String expected = CredentialHelper.tokenAsBase64(token);
+    String result = Base64.encodeBase64String(AuthenticationTokenSerializer.serialize(token));
+    assertEquals(expected, result);
+  }
+  
+  @Test
+  public void testEqualsAndHashCode() {
+    Credentials nullNullCreds = new Credentials(null, null);
+    Credentials abcNullCreds = new Credentials("abc", new NullToken());
+    Credentials cbaNullCreds = new Credentials("cba", new NullToken());
+    Credentials abcBlahCreds = new Credentials("abc", new PasswordToken("blah"));
+    
+    // check hash codes
+    assertEquals(0, nullNullCreds.hashCode());
+    assertEquals("abc".hashCode(), abcNullCreds.hashCode());
+    assertEquals(abcNullCreds.hashCode(), abcBlahCreds.hashCode());
+    assertFalse(abcNullCreds.hashCode() == cbaNullCreds.hashCode());
+    
+    // identity
+    assertEquals(abcNullCreds, abcNullCreds);
+    assertEquals(new Credentials("abc", new NullToken()), abcNullCreds);
+    // equal, but different token constructors
+    assertEquals(new Credentials("abc", new PasswordToken("abc".getBytes(Constants.UTF8))), new Credentials("abc", new PasswordToken("abc")));
+    // test not equals
+    assertFalse(nullNullCreds.equals(abcBlahCreds));
+    assertFalse(nullNullCreds.equals(abcNullCreds));
+    assertFalse(abcNullCreds.equals(abcBlahCreds));
+  }
+  
+  @Test
+  public void testCredentialsSerialization() throws AccumuloSecurityException {
+    Credentials creds = new Credentials("a:b-c", new PasswordToken("d-e-f".getBytes(Constants.UTF8)));
+    String serialized = creds.serialize();
+    Credentials result = Credentials.deserialize(serialized);
+    assertEquals(creds, result);
+    assertEquals("a:b-c", result.getPrincipal());
+    assertEquals(new PasswordToken("d-e-f"), result.getToken());
+    
+    Credentials nullNullCreds = new Credentials(null, null);
+    serialized = nullNullCreds.serialize();
+    result = Credentials.deserialize(serialized);
+    assertEquals(null, result.getPrincipal());
+    assertEquals(null, result.getToken());
+  }
+  
+  @Test
+  public void testToString() {
+    Credentials creds = new Credentials(null, null);
+    assertEquals(Credentials.class.getName() + ":null:null:<hidden>", creds.toString());
+    creds = new Credentials("", new NullToken());
+    assertEquals(Credentials.class.getName() + "::" + NullToken.class.getName() + ":<hidden>", creds.toString());
+    creds = new Credentials("abc", null);
+    assertEquals(Credentials.class.getName() + ":abc:null:<hidden>", creds.toString());
+    creds = new Credentials("abc", new PasswordToken(""));
+    assertEquals(Credentials.class.getName() + ":abc:" + PasswordToken.class.getName() + ":<hidden>", creds.toString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java
index a95e0c4..2080108 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java
@@ -26,8 +26,7 @@ import org.apache.accumulo.core.util.StringUtil;
 import org.apache.accumulo.server.util.PortUtils;
 
 /**
- * Holds configuration for {@link org.apache.accumulo.server.mini.MiniAccumuloCluster}. Required configurations must be passed to constructor(s) and all other
- * configurations are optional.
+ * Holds configuration for {@link MiniAccumuloCluster}. Required configurations must be passed to constructor(s) and all other configurations are optional.
  * 
  * @since 1.5.0
  */
@@ -76,10 +75,10 @@ public class MiniAccumuloConfig {
    */
   MiniAccumuloConfig initialize() {
     
-    //Sanity checks
+    // Sanity checks
     if (this.getDir().exists() && !this.getDir().isDirectory())
       throw new IllegalArgumentException("Must pass in directory, " + this.getDir() + " is a file");
-
+    
     if (this.getDir().exists() && this.getDir().list().length != 0)
       throw new IllegalArgumentException("Directory " + this.getDir() + " is not empty");
     
@@ -91,16 +90,9 @@ public class MiniAccumuloConfig {
       logDir = new File(dir, "logs");
       walogDir = new File(dir, "walogs");
       
-      String[] paths = {
-          "$ACCUMULO_HOME/lib/.*.jar",
-          "$ZOOKEEPER_HOME/zookeeper[^.].*.jar",
-          "$HADOOP_PREFIX/[^.].*.jar",
-          "$HADOOP_PREFIX/lib/[^.].*.jar",
-          "$HADOOP_PREFIX/share/hadoop/common/.*.jar",
-          "$HADOOP_PREFIX/share/hadoop/common/lib/.*.jar",
-          "$HADOOP_PREFIX/share/hadoop/hdfs/.*.jar",
-          "$HADOOP_PREFIX/share/hadoop/mapreduce/.*.jar"
-      };
+      String[] paths = {"$ACCUMULO_HOME/lib/.*.jar", "$ZOOKEEPER_HOME/zookeeper[^.].*.jar", "$HADOOP_PREFIX/[^.].*.jar", "$HADOOP_PREFIX/lib/[^.].*.jar",
+          "$HADOOP_PREFIX/share/hadoop/common/.*.jar", "$HADOOP_PREFIX/share/hadoop/common/lib/.*.jar", "$HADOOP_PREFIX/share/hadoop/hdfs/.*.jar",
+          "$HADOOP_PREFIX/share/hadoop/mapreduce/.*.jar"};
       
       String classpath = StringUtil.join(Arrays.asList(paths), ",");
       

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
----------------------------------------------------------------------
diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
index 160dc0a..c356818 100644
--- a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
+++ b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
@@ -32,6 +32,7 @@ import java.util.TreeSet;
 import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchScanner;
@@ -65,10 +66,9 @@ import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
 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.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.ByteBufferUtil;
 import org.apache.accumulo.core.util.TextUtil;
 import org.apache.accumulo.proxy.thrift.AccumuloProxy;
@@ -172,11 +172,13 @@ public class ProxyServer implements AccumuloProxy.Iface {
   }
   
   protected Connector getConnector(ByteBuffer login) throws Exception {
-    TCredentials user = CredentialHelper.fromByteArray(ByteBufferUtil.toBytes(login));
-    if (user == null)
-      throw new org.apache.accumulo.proxy.thrift.AccumuloSecurityException("unknown user");
-    Connector connector = instance.getConnector(user.getPrincipal(), CredentialHelper.extractToken(user));
-    return connector;
+    String[] pair = new String(login.array(), Constants.UTF8).split(",", 2);
+    if (instance.getInstanceID().equals(pair[0])) {
+      Credentials creds = Credentials.deserialize(pair[1]);
+      return instance.getConnector(creds.getPrincipal(), creds.getToken());
+    } else {
+      throw new IllegalArgumentException("Instance ID doesn't match");
+    }
   }
   
   private void handleAccumuloException(AccumuloException e) throws org.apache.accumulo.proxy.thrift.TableNotFoundException,
@@ -196,7 +198,7 @@ public class ProxyServer implements AccumuloProxy.Iface {
       throw new org.apache.accumulo.proxy.thrift.TableNotFoundException(e.toString());
     throw new org.apache.accumulo.proxy.thrift.AccumuloSecurityException(e.toString());
   }
-
+  
   private void handleExceptionTNF(Exception ex) throws org.apache.accumulo.proxy.thrift.AccumuloException,
       org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, TException {
     try {
@@ -211,7 +213,7 @@ public class ProxyServer implements AccumuloProxy.Iface {
       throw new org.apache.accumulo.proxy.thrift.AccumuloException(e.toString());
     }
   }
-
+  
   private void handleExceptionTEE(Exception ex) throws org.apache.accumulo.proxy.thrift.AccumuloException,
       org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException,
       org.apache.accumulo.proxy.thrift.TableExistsException, TException {
@@ -260,7 +262,7 @@ public class ProxyServer implements AccumuloProxy.Iface {
       throw new org.apache.accumulo.proxy.thrift.AccumuloException(e.toString());
     }
   }
-
+  
   @Override
   public int addConstraint(ByteBuffer login, String tableName, String constraintClassName) throws org.apache.accumulo.proxy.thrift.AccumuloException,
       org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, TException {
@@ -306,7 +308,7 @@ public class ProxyServer implements AccumuloProxy.Iface {
       org.apache.accumulo.proxy.thrift.AccumuloException, TException {
     try {
       getConnector(login).tableOperations().compact(tableName, ByteBufferUtil.toText(startRow), ByteBufferUtil.toText(endRow), getIteratorSettings(iterators),
-              flush, wait);
+          flush, wait);
     } catch (Exception e) {
       handleExceptionTNF(e);
     }
@@ -582,21 +584,21 @@ public class ProxyServer implements AccumuloProxy.Iface {
       throw new TException(e);
     }
   }
-
+  
   @Override
   public List<DiskUsage> getDiskUsage(ByteBuffer login, Set<String> tables) throws org.apache.accumulo.proxy.thrift.AccumuloException,
-          org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, TException {
+      org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, TException {
     try {
       List<org.apache.accumulo.core.client.admin.DiskUsage> diskUsages = getConnector(login).tableOperations().getDiskUsage(tables);
       List<DiskUsage> retUsages = new ArrayList<DiskUsage>();
-      for(org.apache.accumulo.core.client.admin.DiskUsage diskUsage : diskUsages) {
+      for (org.apache.accumulo.core.client.admin.DiskUsage diskUsage : diskUsages) {
         DiskUsage usage = new DiskUsage();
         usage.setTables(new ArrayList<String>(diskUsage.getTables()));
         usage.setUsage(diskUsage.getUsage());
         retUsages.add(usage);
       }
       return retUsages;
-    } catch(Exception e) {
+    } catch (Exception e) {
       handleExceptionTNF(e);
       return null;
     }
@@ -1082,7 +1084,7 @@ public class ProxyServer implements AccumuloProxy.Iface {
       return ret;
     }
   }
-
+  
   @Override
   public void closeScanner(String scanner) throws UnknownScanner, TException {
     UUID uuid = null;
@@ -1091,7 +1093,7 @@ public class ProxyServer implements AccumuloProxy.Iface {
     } catch (IllegalArgumentException e) {
       throw new UnknownScanner(e.getMessage());
     }
-
+    
     try {
       if (scannerCache.asMap().remove(uuid) == null) {
         throw new UnknownScanner("Scanner never existed or no longer exists");
@@ -1220,7 +1222,7 @@ public class ProxyServer implements AccumuloProxy.Iface {
       throw new TException(e);
     }
   }
-
+  
   private BatchWriterPlusException getWriter(String writer) throws UnknownWriter {
     UUID uuid = null;
     try {
@@ -1453,8 +1455,7 @@ public class ProxyServer implements AccumuloProxy.Iface {
   public ByteBuffer login(String principal, Map<String,String> loginProperties) throws org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException {
     try {
       AuthenticationToken token = getToken(principal, loginProperties);
-      TCredentials credential = CredentialHelper.create(principal, token, instance.getInstanceID());
-      ByteBuffer login = ByteBuffer.wrap(CredentialHelper.asByteArray(credential));
+      ByteBuffer login = ByteBuffer.wrap((instance.getInstanceID() + "," + new Credentials(principal, token).serialize()).getBytes(Constants.UTF8));
       getConnector(login); // check to make sure user exists
       return login;
     } catch (AccumuloSecurityException e) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/cli/ClientOnRequiredTable.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/cli/ClientOnRequiredTable.java b/server/src/main/java/org/apache/accumulo/server/cli/ClientOnRequiredTable.java
index 0d6f148..e9e9bf1 100644
--- a/server/src/main/java/org/apache/accumulo/server/cli/ClientOnRequiredTable.java
+++ b/server/src/main/java/org/apache/accumulo/server/cli/ClientOnRequiredTable.java
@@ -25,7 +25,7 @@ public class ClientOnRequiredTable extends org.apache.accumulo.core.cli.ClientOn
   {
     principal = "root";
   }
-
+  
   @Override
   synchronized public Instance getInstance() {
     if (cachedInstance != null)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java b/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
index b1bb894..a04765f 100644
--- a/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
+++ b/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
@@ -52,7 +52,7 @@ import org.apache.accumulo.core.file.FileOperations;
 import org.apache.accumulo.core.file.FileSKVIterator;
 import org.apache.accumulo.core.file.FileUtil;
 import org.apache.accumulo.core.metadata.MetadataTable;
-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.util.CachedConfiguration;
 import org.apache.accumulo.core.util.LoggingRunnable;
@@ -69,12 +69,11 @@ import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
 import org.apache.thrift.TServiceClient;
 
-
 public class BulkImporter {
   
   private static final Logger log = Logger.getLogger(BulkImporter.class);
   
-  public static List<String> bulkLoad(AccumuloConfiguration conf, Instance instance, TCredentials creds, long tid, String tableId, List<String> files,
+  public static List<String> bulkLoad(AccumuloConfiguration conf, Instance instance, Credentials creds, long tid, String tableId, List<String> files,
       String errorDir, boolean setTime) throws IOException, AccumuloException, AccumuloSecurityException, ThriftTableOperationException {
     AssignmentStats stats = new BulkImporter(conf, instance, creds, tid, tableId, setTime).importFiles(files, new Path(errorDir));
     List<String> result = new ArrayList<String>();
@@ -91,13 +90,13 @@ public class BulkImporter {
   }
   
   private Instance instance;
-  private TCredentials credentials;
+  private Credentials credentials;
   private String tableId;
   private long tid;
   private AccumuloConfiguration acuConf;
   private boolean setTime;
   
-  public BulkImporter(AccumuloConfiguration conf, Instance instance, TCredentials credentials, long tid, String tableId, boolean setTime) {
+  public BulkImporter(AccumuloConfiguration conf, Instance instance, Credentials credentials, long tid, String tableId, boolean setTime) {
     this.instance = instance;
     this.credentials = credentials;
     this.tid = tid;
@@ -143,6 +142,7 @@ public class BulkImporter {
       for (Path path : paths) {
         final Path mapFile = path;
         Runnable getAssignments = new Runnable() {
+          @Override
           public void run() {
             List<TabletLocation> tabletsToAssignMapFileTo = Collections.emptyList();
             try {
@@ -180,9 +180,9 @@ public class BulkImporter {
       for (Entry<Path,List<KeyExtent>> entry : assignmentFailures.entrySet())
         failureCount.put(entry.getKey(), 1);
       
-      long sleepTime = 2*1000;
+      long sleepTime = 2 * 1000;
       while (assignmentFailures.size() > 0) {
-        sleepTime = Math.min(sleepTime*2, 60*1000);
+        sleepTime = Math.min(sleepTime * 2, 60 * 1000);
         locator.invalidateCache();
         // assumption about assignment failures is that it caused by a split
         // happening or a missing location
@@ -309,7 +309,7 @@ public class BulkImporter {
       for (KeyExtent keyExtent : extents)
         log.debug("\t" + entry.getKey() + " -> " + keyExtent);
     }
-
+    
     return Collections.emptySet();
   }
   
@@ -361,6 +361,7 @@ public class BulkImporter {
       }
       
       Runnable estimationTask = new Runnable() {
+        @Override
         public void run() {
           Map<KeyExtent,Long> estimatedSizes = null;
           
@@ -418,8 +419,8 @@ public class BulkImporter {
     return result;
   }
   
-  private Map<Path,List<KeyExtent>> assignMapFiles(AccumuloConfiguration acuConf, Instance instance, Configuration conf, TCredentials credentials, FileSystem fs,
-      String tableId, Map<Path,List<TabletLocation>> assignments, Collection<Path> paths, int numThreads, int numMapThreads) {
+  private Map<Path,List<KeyExtent>> assignMapFiles(AccumuloConfiguration acuConf, Instance instance, Configuration conf, Credentials credentials,
+      FileSystem fs, String tableId, Map<Path,List<TabletLocation>> assignments, Collection<Path> paths, int numThreads, int numMapThreads) {
     timer.start(Timers.EXAMINE_MAP_FILES);
     Map<Path,List<AssignmentInfo>> assignInfo = estimateSizes(acuConf, conf, fs, assignments, paths, numMapThreads);
     timer.stop(Timers.EXAMINE_MAP_FILES);
@@ -436,10 +437,10 @@ public class BulkImporter {
   private class AssignmentTask implements Runnable {
     final Map<Path,List<KeyExtent>> assignmentFailures;
     String location;
-    TCredentials credentials;
+    Credentials credentials;
     private Map<KeyExtent,List<PathSize>> assignmentsPerTablet;
     
-    public AssignmentTask(TCredentials credentials, Map<Path,List<KeyExtent>> assignmentFailures, String tableName, String location,
+    public AssignmentTask(Credentials credentials, Map<Path,List<KeyExtent>> assignmentFailures, String tableName, String location,
         Map<KeyExtent,List<PathSize>> assignmentsPerTablet) {
       this.assignmentFailures = assignmentFailures;
       this.location = location;
@@ -466,6 +467,7 @@ public class BulkImporter {
       }
     }
     
+    @Override
     public void run() {
       HashSet<Path> uniqMapFiles = new HashSet<Path>();
       for (List<PathSize> mapFiles : assignmentsPerTablet.values())
@@ -495,12 +497,13 @@ public class BulkImporter {
     Path path;
     long estSize;
     
+    @Override
     public String toString() {
       return path + " " + estSize;
     }
   }
   
-  private Map<Path,List<KeyExtent>> assignMapFiles(TCredentials credentials, String tableName, Map<Path,List<AssignmentInfo>> assignments,
+  private Map<Path,List<KeyExtent>> assignMapFiles(Credentials credentials, String tableName, Map<Path,List<AssignmentInfo>> assignments,
       Map<KeyExtent,String> locations, int numThreads) {
     
     // group assignments by tablet
@@ -578,8 +581,8 @@ public class BulkImporter {
     return assignmentFailures;
   }
   
-  private List<KeyExtent> assignMapFiles(TCredentials credentials, String location, Map<KeyExtent,List<PathSize>> assignmentsPerTablet) throws AccumuloException,
-      AccumuloSecurityException {
+  private List<KeyExtent> assignMapFiles(Credentials credentials, String location, Map<KeyExtent,List<PathSize>> assignmentsPerTablet)
+      throws AccumuloException, AccumuloSecurityException {
     try {
       long timeInMillis = instance.getConfiguration().getTimeInMillis(Property.TSERV_BULK_TIMEOUT);
       TabletClientService.Iface client = ThriftUtil.getTServerClient(location, timeInMillis);
@@ -596,7 +599,8 @@ public class BulkImporter {
         }
         
         log.debug("Asking " + location + " to bulk load " + files);
-        List<TKeyExtent> failures = client.bulkImport(Tracer.traceInfo(), credentials, tid, Translator.translate(files, Translator.KET), setTime);
+        List<TKeyExtent> failures = client.bulkImport(Tracer.traceInfo(), credentials.toThrift(instance), tid, Translator.translate(files, Translator.KET),
+            setTime);
         
         return Translator.translate(failures, Translator.TKET);
       } finally {
@@ -610,12 +614,13 @@ public class BulkImporter {
     }
   }
   
-  public static List<TabletLocation> findOverlappingTablets(AccumuloConfiguration acuConf, FileSystem fs, TabletLocator locator, Path file, TCredentials credentials) throws Exception {
+  public static List<TabletLocation> findOverlappingTablets(AccumuloConfiguration acuConf, FileSystem fs, TabletLocator locator, Path file,
+      Credentials credentials) throws Exception {
     return findOverlappingTablets(acuConf, fs, locator, file, null, null, credentials);
   }
   
-  public static List<TabletLocation> findOverlappingTablets(AccumuloConfiguration acuConf, FileSystem fs, TabletLocator locator, Path file, KeyExtent failed, TCredentials credentials)
-      throws Exception {
+  public static List<TabletLocation> findOverlappingTablets(AccumuloConfiguration acuConf, FileSystem fs, TabletLocator locator, Path file, KeyExtent failed,
+      Credentials credentials) throws Exception {
     locator.invalidateCache(failed);
     Text start = failed.getPrevEndRow();
     if (start != null)
@@ -624,9 +629,9 @@ public class BulkImporter {
   }
   
   final static byte[] byte0 = {0};
-
+  
   public static List<TabletLocation> findOverlappingTablets(AccumuloConfiguration acuConf, FileSystem fs, TabletLocator locator, Path file, Text startRow,
-      Text endRow, TCredentials credentials) throws Exception {
+      Text endRow, Credentials credentials) throws Exception {
     List<TabletLocation> result = new ArrayList<TabletLocation>();
     Collection<ByteSequence> columnFamilies = Collections.emptyList();
     String filename = file.toString();
@@ -644,7 +649,7 @@ public class BulkImporter {
           break;
         }
         row = reader.getTopKey().getRow();
-        TabletLocation tabletLocation = locator.locateTablet(row, false, true, credentials);
+        TabletLocation tabletLocation = locator.locateTablet(credentials, row, false, true);
         // log.debug(filename + " found row " + row + " at location " + tabletLocation);
         result.add(tabletLocation);
         row = tabletLocation.tablet_extent.getEndRow();
@@ -720,6 +725,7 @@ public class BulkImporter {
       this.failedFailures = failedFailures;
     }
     
+    @Override
     public String toString() {
       StringBuilder sb = new StringBuilder();
       int totalAssignments = 0;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java b/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
index 6fd6a65..1a3a379 100644
--- a/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
+++ b/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
@@ -42,12 +42,14 @@ import org.apache.accumulo.core.client.impl.thrift.TableOperation;
 import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType;
 import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
 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.AuthenticationToken.AuthenticationTokenSerializer;
 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.file.FileUtil;
 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;
@@ -135,14 +137,14 @@ public class ClientServiceHandler implements ClientService.Iface {
   @Override
   public void changeLocalUserPassword(TInfo tinfo, TCredentials credentials, String principal, ByteBuffer password) throws ThriftSecurityException {
     PasswordToken token = new PasswordToken(password);
-    TCredentials toChange = CredentialHelper.createSquelchError(principal, token, credentials.getInstanceId());
+    Credentials toChange = new Credentials(principal, token);
     security.changePassword(credentials, toChange);
   }
   
   @Override
   public void createLocalUser(TInfo tinfo, TCredentials credentials, String principal, ByteBuffer password) throws ThriftSecurityException {
     PasswordToken token = new PasswordToken(password);
-    TCredentials newUser = CredentialHelper.createSquelchError(principal, token, credentials.getInstanceId());
+    Credentials newUser = new Credentials(principal, token);
     security.createUser(credentials, newUser, new Authorizations());
   }
   
@@ -238,7 +240,8 @@ public class ClientServiceHandler implements ClientService.Iface {
       return transactionWatcher.run(Constants.BULK_ARBITRATOR_TYPE, tid, new Callable<List<String>>() {
         @Override
         public List<String> call() throws Exception {
-          return BulkImporter.bulkLoad(new ServerConfiguration(instance).getConfiguration(), instance, credentials, tid, tableId, files, errorDir, setTime);
+          return BulkImporter.bulkLoad(new ServerConfiguration(instance).getConfiguration(), instance, new Credentials(credentials.getPrincipal(),
+              AuthenticationTokenSerializer.deserialize(credentials.getTokenClassName(), credentials.getToken())), tid, tableId, files, errorDir, setTime);
         }
       });
     } catch (AccumuloSecurityException e) {
@@ -317,7 +320,8 @@ public class ClientServiceHandler implements ClientService.Iface {
   @Override
   public List<TDiskUsage> getDiskUsage(Set<String> tables, TCredentials credentials) throws ThriftTableOperationException, ThriftSecurityException, TException {
     try {
-      Connector conn = instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials));
+      AuthenticationToken token = AuthenticationTokenSerializer.deserialize(credentials.getTokenClassName(), credentials.getToken());
+      Connector conn = instance.getConnector(credentials.getPrincipal(), token);
       
       HashSet<String> tableIds = new HashSet<String>();
       

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java b/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
index 2ad81cf..c0a3e2b 100644
--- a/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
+++ b/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
@@ -33,7 +33,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.ByteBufferUtil;
 import org.apache.accumulo.core.util.OpTimer;
 import org.apache.accumulo.core.util.StringUtil;
@@ -144,19 +144,22 @@ public class HdfsZooInstance 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));
   }
   
+  @Deprecated
   @Override
   public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
     return getConnector(user, new PasswordToken(pass));
   }
   
+  @Deprecated
   @Override
   public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException {
     return getConnector(user, ByteBufferUtil.toBytes(pass));
   }
   
+  @Deprecated
   @Override
   public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException {
     return getConnector(user, TextUtil.getBytes(new Text(pass.toString())));

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java b/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
index d6738fe..6548339 100644
--- a/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
+++ b/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
@@ -165,7 +165,7 @@ public class GarbageCollectWriteAheadLogs {
           Client tserver = null;
           try {
             tserver = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf);
-            tserver.removeLogs(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), paths2strings(entry.getValue()));
+            tserver.removeLogs(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), paths2strings(entry.getValue()));
             log.debug("deleted " + entry.getValue() + " from " + entry.getKey());
             status.currentLog.deleted += entry.getValue().size();
           } catch (TException e) {
@@ -223,7 +223,7 @@ public class GarbageCollectWriteAheadLogs {
   private static int removeMetadataEntries(Map<Path,String> fileToServerMap, Set<Path> sortedWALogs, GCStatus status) throws IOException, KeeperException,
       InterruptedException {
     int count = 0;
-    Iterator<LogEntry> iterator = MetadataTableUtil.getLogEntries(SystemCredentials.get().getAsThrift());
+    Iterator<LogEntry> iterator = MetadataTableUtil.getLogEntries(SystemCredentials.get());
     while (iterator.hasNext()) {
       for (String filename : iterator.next().logSet) {
         Path path;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java b/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
index 4387755..45df0d4 100644
--- a/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
+++ b/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
@@ -67,7 +67,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.metadata.schema.MetadataSchema.TabletsSection.ScanFileColumnFamily;
 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.SecurityUtil;
 import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.core.util.NamingThreadFactory;
@@ -78,8 +78,8 @@ import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.fate.zookeeper.ZooLock.LockLossReason;
 import org.apache.accumulo.fate.zookeeper.ZooLock.LockWatcher;
 import org.apache.accumulo.server.Accumulo;
-import org.apache.accumulo.server.ServerOpts;
 import org.apache.accumulo.server.ServerConstants;
+import org.apache.accumulo.server.ServerOpts;
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.fs.VolumeManager;
@@ -123,7 +123,7 @@ public class SimpleGarbageCollector implements Iface {
   
   private static final Logger log = Logger.getLogger(SimpleGarbageCollector.class);
   
-  private TCredentials credentials;
+  private Credentials credentials;
   private long gcStartDelay;
   private boolean checkForBulkProcessingFiles;
   private VolumeManager fs;
@@ -148,7 +148,7 @@ public class SimpleGarbageCollector implements Iface {
     opts.parseArgs("gc", args);
     SimpleGarbageCollector gc = new SimpleGarbageCollector(opts);
     
-    gc.init(fs, instance, SystemCredentials.get().getAsThrift(), serverConf.getConfiguration().getBoolean(Property.GC_TRASH_IGNORE));
+    gc.init(fs, instance, SystemCredentials.get(), serverConf.getConfiguration().getBoolean(Property.GC_TRASH_IGNORE));
     Accumulo.enableTracing(opts.getAddress(), "gc");
     gc.run();
   }
@@ -157,7 +157,7 @@ public class SimpleGarbageCollector implements Iface {
     this.opts = opts;
   }
   
-  public void init(VolumeManager fs, Instance instance, TCredentials credentials, boolean noTrash) throws IOException {
+  public void init(VolumeManager fs, Instance instance, Credentials credentials, boolean noTrash) throws IOException {
     this.fs = fs;
     this.credentials = credentials;
     this.instance = instance;
@@ -283,7 +283,7 @@ public class SimpleGarbageCollector implements Iface {
       
       // we just made a lot of changes to the !METADATA table: flush them out
       try {
-        Connector connector = instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials));
+        Connector connector = instance.getConnector(credentials.getPrincipal(), credentials.getToken());
         connector.tableOperations().compact(MetadataTable.NAME, null, null, true, true);
         connector.tableOperations().compact(RootTable.NAME, null, null, true, true);
       } catch (Exception e) {
@@ -458,8 +458,7 @@ public class SimpleGarbageCollector implements Iface {
       continueKey = null;
     }
     
-    Scanner scanner = instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials)).createScanner(tableName,
-        Authorizations.EMPTY);
+    Scanner scanner = instance.getConnector(credentials.getPrincipal(), credentials.getToken()).createScanner(tableName, Authorizations.EMPTY);
     scanner.setRange(range);
     List<String> result = new ArrayList<String>();
     // find candidates for deletion; chop off the prefix
@@ -504,8 +503,7 @@ public class SimpleGarbageCollector implements Iface {
       // }
     } else {
       try {
-        scanner = new IsolatedScanner(instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials)).createScanner(tableName,
-            Authorizations.EMPTY));
+        scanner = new IsolatedScanner(instance.getConnector(credentials.getPrincipal(), credentials.getToken()).createScanner(tableName, Authorizations.EMPTY));
       } catch (AccumuloSecurityException ex) {
         throw new AccumuloException(ex);
       } catch (TableNotFoundException ex) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java b/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
index 8c654fb..ad8f656 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
@@ -84,7 +84,7 @@ public class LiveTServerSet implements Watcher {
     public void assignTablet(ZooLock lock, KeyExtent extent) throws TException {
       TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf);
       try {
-        client.loadTablet(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), lockString(lock), extent.toThrift());
+        client.loadTablet(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), lockString(lock), extent.toThrift());
       } finally {
         ThriftUtil.returnClient(client);
       }
@@ -93,7 +93,7 @@ public class LiveTServerSet implements Watcher {
     public void unloadTablet(ZooLock lock, KeyExtent extent, boolean save) throws TException {
       TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf);
       try {
-        client.unloadTablet(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), lockString(lock), extent.toThrift(), save);
+        client.unloadTablet(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), lockString(lock), extent.toThrift(), save);
       } finally {
         ThriftUtil.returnClient(client);
       }
@@ -108,7 +108,7 @@ public class LiveTServerSet implements Watcher {
       
       try {
         TabletClientService.Client client = ThriftUtil.createClient(new TabletClientService.Client.Factory(), transport);
-        return client.getTabletServerStatus(Tracer.traceInfo(), SystemCredentials.get().getAsThrift());
+        return client.getTabletServerStatus(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance));
       } finally {
         if (transport != null)
           transport.close();
@@ -118,7 +118,7 @@ public class LiveTServerSet implements Watcher {
     public void halt(ZooLock lock) throws TException, ThriftSecurityException {
       TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf);
       try {
-        client.halt(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), lockString(lock));
+        client.halt(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), lockString(lock));
       } finally {
         ThriftUtil.returnClient(client);
       }
@@ -127,7 +127,7 @@ public class LiveTServerSet implements Watcher {
     public void fastHalt(ZooLock lock) throws TException {
       TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf);
       try {
-        client.fastHalt(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), lockString(lock));
+        client.fastHalt(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), lockString(lock));
       } finally {
         ThriftUtil.returnClient(client);
       }
@@ -136,8 +136,8 @@ public class LiveTServerSet implements Watcher {
     public void flush(ZooLock lock, String tableId, byte[] startRow, byte[] endRow) throws TException {
       TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf);
       try {
-        client.flush(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), lockString(lock), tableId, startRow == null ? null : ByteBuffer.wrap(startRow),
-            endRow == null ? null : ByteBuffer.wrap(endRow));
+        client.flush(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), lockString(lock), tableId,
+            startRow == null ? null : ByteBuffer.wrap(startRow), endRow == null ? null : ByteBuffer.wrap(endRow));
       } finally {
         ThriftUtil.returnClient(client);
       }
@@ -146,7 +146,7 @@ public class LiveTServerSet implements Watcher {
     public void chop(ZooLock lock, KeyExtent extent) throws TException {
       TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf);
       try {
-        client.chop(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), lockString(lock), extent.toThrift());
+        client.chop(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), lockString(lock), extent.toThrift());
       } finally {
         ThriftUtil.returnClient(client);
       }
@@ -155,7 +155,7 @@ public class LiveTServerSet implements Watcher {
     public void splitTablet(ZooLock lock, KeyExtent extent, Text splitPoint) throws TException, ThriftSecurityException, NotServingTabletException {
       TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf);
       try {
-        client.splitTablet(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), extent.toThrift(),
+        client.splitTablet(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), extent.toThrift(),
             ByteBuffer.wrap(splitPoint.getBytes(), 0, splitPoint.getLength()));
       } finally {
         ThriftUtil.returnClient(client);
@@ -165,7 +165,7 @@ public class LiveTServerSet implements Watcher {
     public void flushTablet(ZooLock lock, KeyExtent extent) throws TException {
       TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf);
       try {
-        client.flushTablet(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), lockString(lock), extent.toThrift());
+        client.flushTablet(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), lockString(lock), extent.toThrift());
       } finally {
         ThriftUtil.returnClient(client);
       }
@@ -174,7 +174,7 @@ public class LiveTServerSet implements Watcher {
     public void compact(ZooLock lock, String tableId, byte[] startRow, byte[] endRow) throws TException {
       TabletClientService.Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), address, conf);
       try {
-        client.compact(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), lockString(lock), tableId,
+        client.compact(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance), lockString(lock), tableId,
             startRow == null ? null : ByteBuffer.wrap(startRow), endRow == null ? null : ByteBuffer.wrap(endRow));
       } finally {
         ThriftUtil.returnClient(client);
@@ -205,7 +205,7 @@ public class LiveTServerSet implements Watcher {
   // The set of active tservers with locks, indexed by their name in zookeeper
   private Map<String,TServerInfo> current = new HashMap<String,TServerInfo>();
   // as above, indexed by TServerInstance
-  private Map<TServerInstance, TServerInfo> currentInstances = new HashMap<TServerInstance, TServerInfo>();
+  private Map<TServerInstance,TServerInfo> currentInstances = new HashMap<TServerInstance,TServerInfo>();
   
   // The set of entries in zookeeper without locks, and the first time each was noticed
   private Map<String,Long> locklessServers = new HashMap<String,Long>();
@@ -286,7 +286,7 @@ public class LiveTServerSet implements Watcher {
       Long firstSeen = locklessServers.get(zPath);
       if (firstSeen == null) {
         locklessServers.put(zPath, System.currentTimeMillis());
-      } else if (System.currentTimeMillis() - firstSeen > 10*60*1000) {
+      } else if (System.currentTimeMillis() - firstSeen > 10 * 60 * 1000) {
         deleteServerNode(path + "/" + zPath);
         locklessServers.remove(zPath);
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/master/Master.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/Master.java b/server/src/main/java/org/apache/accumulo/server/master/Master.java
index e15202b..dd86b7b 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/Master.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/Master.java
@@ -73,6 +73,7 @@ import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.LogColumnFamily;
 import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.security.SecurityUtil;
 import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.core.util.ByteBufferUtil;
@@ -290,7 +291,7 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
           @Override
           public void run() {
             try {
-              MetadataTableUtil.moveMetaDeleteMarkers(instance, SystemCredentials.get().getAsThrift());
+              MetadataTableUtil.moveMetaDeleteMarkers(instance, SystemCredentials.get());
               Accumulo.updateAccumuloVersion(fs);
               
               log.info("Upgrade complete");
@@ -1500,17 +1501,17 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
       }
     });
     
-    TCredentials systemAuths = SystemCredentials.get().getAsThrift();
-    watchers.add(new TabletGroupWatcher(this, new MetaDataStateStore(instance, systemAuths, this), null));
-    watchers.add(new TabletGroupWatcher(this, new RootTabletStateStore(instance, systemAuths, this), watchers.get(0)));
+    Credentials systemCreds = SystemCredentials.get();
+    watchers.add(new TabletGroupWatcher(this, new MetaDataStateStore(instance, systemCreds, this), null));
+    watchers.add(new TabletGroupWatcher(this, new RootTabletStateStore(instance, systemCreds, this), watchers.get(0)));
     watchers.add(new TabletGroupWatcher(this, new ZooTabletStateStore(new ZooStore(zroot)), watchers.get(1)));
     for (TabletGroupWatcher watcher : watchers) {
       watcher.start();
     }
     
     Processor<Iface> processor = new Processor<Iface>(TraceWrap.service(new MasterClientServiceHandler()));
-    clientService = TServerUtils.startServer(getSystemConfiguration(), hostname, Property.MASTER_CLIENTPORT, processor, "Master", "Master Client Service Handler", null,
-        Property.MASTER_MINTHREADS, Property.MASTER_THREADCHECK, Property.GENERAL_MAX_MESSAGE_SIZE).server;
+    clientService = TServerUtils.startServer(getSystemConfiguration(), hostname, Property.MASTER_CLIENTPORT, processor, "Master",
+        "Master Client Service Handler", null, Property.MASTER_MINTHREADS, Property.MASTER_THREADCHECK, Property.GENERAL_MAX_MESSAGE_SIZE).server;
     
     while (!clientService.isServing()) {
       UtilWaitThread.sleep(100);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/master/TabletGroupWatcher.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/TabletGroupWatcher.java b/server/src/main/java/org/apache/accumulo/server/master/TabletGroupWatcher.java
index fb905c9..6c416a5 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/TabletGroupWatcher.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/TabletGroupWatcher.java
@@ -410,7 +410,7 @@ class TabletGroupWatcher extends Daemon {
         if (key.compareColumnFamily(DataFileColumnFamily.NAME) == 0) {
           datafiles.add(new FileRef(this.master.fs, key));
           if (datafiles.size() > 1000) {
-            MetadataTableUtil.addDeleteEntries(extent, datafiles, SystemCredentials.get().getAsThrift());
+            MetadataTableUtil.addDeleteEntries(extent, datafiles, SystemCredentials.get());
             datafiles.clear();
           }
         } else if (TabletsSection.ServerColumnFamily.TIME_COLUMN.hasColumns(key)) {
@@ -420,12 +420,12 @@ class TabletGroupWatcher extends Daemon {
         } else if (TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.hasColumns(key)) {
           datafiles.add(new FileRef(this.master.fs, key));
           if (datafiles.size() > 1000) {
-            MetadataTableUtil.addDeleteEntries(extent, datafiles, SystemCredentials.get().getAsThrift());
+            MetadataTableUtil.addDeleteEntries(extent, datafiles, SystemCredentials.get());
             datafiles.clear();
           }
         }
       }
-      MetadataTableUtil.addDeleteEntries(extent, datafiles, SystemCredentials.get().getAsThrift());
+      MetadataTableUtil.addDeleteEntries(extent, datafiles, SystemCredentials.get());
       BatchWriter bw = conn.createBatchWriter(targetSystemTable, new BatchWriterConfig());
       try {
         deleteTablets(info, deleteRange, bw, conn);
@@ -448,8 +448,8 @@ class TabletGroupWatcher extends Daemon {
       } else {
         // Recreate the default tablet to hold the end of the table
         Master.log.debug("Recreating the last tablet to point to " + extent.getPrevEndRow());
-        MetadataTableUtil.addTablet(new KeyExtent(extent.getTableId(), null, extent.getPrevEndRow()), Constants.DEFAULT_TABLET_LOCATION, SystemCredentials
-            .get().getAsThrift(), timeType, this.master.masterLock);
+        MetadataTableUtil.addTablet(new KeyExtent(extent.getTableId(), null, extent.getPrevEndRow()), Constants.DEFAULT_TABLET_LOCATION,
+            SystemCredentials.get(), timeType, this.master.masterLock);
       }
     } catch (Exception ex) {
       throw new AccumuloException(ex);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java b/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
index 22fb17b..ec3371c 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
@@ -136,6 +136,8 @@ public class ChaoticLoadBalancer extends TabletBalancer {
   }
   
   @Override
-  public void init(ServerConfiguration conf) {}
+  public void init(ServerConfiguration conf) {
+    super.init(conf);
+  }
   
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/master/balancer/TabletBalancer.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/balancer/TabletBalancer.java b/server/src/main/java/org/apache/accumulo/server/master/balancer/TabletBalancer.java
index 625fa40..fd76ce2 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/balancer/TabletBalancer.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/balancer/TabletBalancer.java
@@ -98,7 +98,8 @@ public abstract class TabletBalancer {
     log.debug("Scanning tablet server " + tserver + " for table " + tableId);
     Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), tserver.getLocation(), configuration.getConfiguration());
     try {
-      List<TabletStats> onlineTabletsForTable = client.getTabletStats(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), tableId);
+      List<TabletStats> onlineTabletsForTable = client.getTabletStats(Tracer.traceInfo(), SystemCredentials.get().toThrift(configuration.getInstance()),
+          tableId);
       return onlineTabletsForTable;
     } catch (TTransportException e) {
       log.error("Unable to connect to " + tserver + ": " + e);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java b/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
index 5cb7b0c..57d38eb 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
@@ -29,8 +29,7 @@ import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
-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.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.security.SystemCredentials;
 import org.apache.hadoop.io.Text;
@@ -44,22 +43,22 @@ public class MetaDataStateStore extends TabletStateStore {
   
   final protected Instance instance;
   final protected CurrentState state;
-  final protected TCredentials auths;
+  final protected Credentials credentials;
   final private String targetTableName;
   
-  protected MetaDataStateStore(Instance instance, TCredentials auths, CurrentState state, String targetTableName) {
+  protected MetaDataStateStore(Instance instance, Credentials credentials, CurrentState state, String targetTableName) {
     this.instance = instance;
     this.state = state;
-    this.auths = auths;
+    this.credentials = credentials;
     this.targetTableName = targetTableName;
   }
   
-  public MetaDataStateStore(Instance instance, TCredentials auths, CurrentState state) {
-    this(instance, auths, state, MetadataTable.NAME);
+  public MetaDataStateStore(Instance instance, Credentials credentials, CurrentState state) {
+    this(instance, credentials, state, MetadataTable.NAME);
   }
   
   protected MetaDataStateStore(String tableName) {
-    this(HdfsZooInstance.getInstance(), SystemCredentials.get().getAsThrift(), null, tableName);
+    this(HdfsZooInstance.getInstance(), SystemCredentials.get(), null, tableName);
   }
   
   public MetaDataStateStore() {
@@ -68,7 +67,7 @@ public class MetaDataStateStore extends TabletStateStore {
   
   @Override
   public Iterator<TabletLocationState> iterator() {
-    return new MetaDataTableScanner(instance, auths, MetadataSchema.TabletsSection.getRange(), state);
+    return new MetaDataTableScanner(instance, credentials, MetadataSchema.TabletsSection.getRange(), state);
   }
   
   @Override
@@ -95,7 +94,7 @@ public class MetaDataStateStore extends TabletStateStore {
   
   BatchWriter createBatchWriter() {
     try {
-      return instance.getConnector(auths.getPrincipal(), CredentialHelper.extractToken(auths)).createBatchWriter(targetTableName,
+      return instance.getConnector(credentials.getPrincipal(), credentials.getToken()).createBatchWriter(targetTableName,
           new BatchWriterConfig().setMaxMemory(MAX_MEMORY).setMaxLatency(LATENCY, TimeUnit.MILLISECONDS).setMaxWriteThreads(THREADS));
     } catch (TableNotFoundException e) {
       // ya, I don't think so

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java b/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
index 8ca79a8..cec0bcf 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
@@ -41,8 +41,7 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ChoppedColumnFamily;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.LogColumnFamily;
 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.server.master.state.TabletLocationState.BadLocationStateException;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
@@ -53,14 +52,14 @@ public class MetaDataTableScanner implements Iterator<TabletLocationState> {
   BatchScanner mdScanner;
   Iterator<Entry<Key,Value>> iter;
   
-  public MetaDataTableScanner(Instance instance, TCredentials auths, Range range, CurrentState state) {
-    this(instance, auths, range, state, MetadataTable.NAME);
+  public MetaDataTableScanner(Instance instance, Credentials credentials, Range range, CurrentState state) {
+    this(instance, credentials, range, state, MetadataTable.NAME);
   }
   
-  MetaDataTableScanner(Instance instance, TCredentials auths, Range range, CurrentState state, String tableName) {
+  MetaDataTableScanner(Instance instance, Credentials credentials, Range range, CurrentState state, String tableName) {
     // scan over metadata table, looking for tablets in the wrong state based on the live servers and online tables
     try {
-      Connector connector = instance.getConnector(auths.getPrincipal(), CredentialHelper.extractToken(auths));
+      Connector connector = instance.getConnector(credentials.getPrincipal(), credentials.getToken());
       mdScanner = connector.createBatchScanner(tableName, Authorizations.EMPTY, 8);
       configureScanner(mdScanner, state);
       mdScanner.setRanges(Collections.singletonList(range));
@@ -87,12 +86,12 @@ public class MetaDataTableScanner implements Iterator<TabletLocationState> {
     scanner.addScanIterator(tabletChange);
   }
   
-  public MetaDataTableScanner(Instance instance, TCredentials auths, Range range) {
-    this(instance, auths, range, MetadataTable.NAME);
+  public MetaDataTableScanner(Instance instance, Credentials credentials, Range range) {
+    this(instance, credentials, range, MetadataTable.NAME);
   }
   
-  public MetaDataTableScanner(Instance instance, TCredentials auths, Range range, String tableName) {
-    this(instance, auths, range, null, tableName);
+  public MetaDataTableScanner(Instance instance, Credentials credentials, Range range, String tableName) {
+    this(instance, credentials, range, null, tableName);
   }
   
   public void close() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/master/state/RootTabletStateStore.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/RootTabletStateStore.java b/server/src/main/java/org/apache/accumulo/server/master/state/RootTabletStateStore.java
index 1aa4b4e..e1e6424 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/RootTabletStateStore.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/RootTabletStateStore.java
@@ -21,12 +21,12 @@ import java.util.Iterator;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema;
-import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.Credentials;
 
 public class RootTabletStateStore extends MetaDataStateStore {
   
-  public RootTabletStateStore(Instance instance, TCredentials auths, CurrentState state) {
-    super(instance, auths, state, RootTable.NAME);
+  public RootTabletStateStore(Instance instance, Credentials credentials, CurrentState state) {
+    super(instance, credentials, state, RootTable.NAME);
   }
   
   public RootTabletStateStore() {
@@ -35,7 +35,7 @@ public class RootTabletStateStore extends MetaDataStateStore {
   
   @Override
   public Iterator<TabletLocationState> iterator() {
-    return new MetaDataTableScanner(instance, auths, MetadataSchema.TabletsSection.getRange(), state, RootTable.NAME);
+    return new MetaDataTableScanner(instance, credentials, MetadataSchema.TabletsSection.getRange(), state, RootTable.NAME);
   }
   
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java b/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
index cfbdc97..8839304 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
@@ -557,7 +557,8 @@ class LoadFiles extends MasterRepo {
               server = pair.getFirst();
               List<String> attempt = Collections.singletonList(file);
               log.debug("Asking " + pair.getFirst() + " to bulk import " + file);
-              List<String> fail = client.bulkImportFiles(Tracer.traceInfo(), SystemCredentials.get().getAsThrift(), tid, tableId, attempt, errorDir, setTime);
+              List<String> fail = client.bulkImportFiles(Tracer.traceInfo(), SystemCredentials.get().toThrift(master.getInstance()), tid, tableId, attempt,
+                  errorDir, setTime);
               if (fail.isEmpty()) {
                 loaded.add(file);
               } else {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/server/src/main/java/org/apache/accumulo/server/master/tableOps/CloneTable.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/tableOps/CloneTable.java b/server/src/main/java/org/apache/accumulo/server/master/tableOps/CloneTable.java
index 3534a78..16d401c 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/tableOps/CloneTable.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/tableOps/CloneTable.java
@@ -108,14 +108,14 @@ class CloneMetadata extends MasterRepo {
     Instance instance = HdfsZooInstance.getInstance();
     // need to clear out any metadata entries for tableId just in case this
     // died before and is executing again
-    MetadataTableUtil.deleteTable(cloneInfo.tableId, false, SystemCredentials.get().getAsThrift(), environment.getMasterLock());
+    MetadataTableUtil.deleteTable(cloneInfo.tableId, false, SystemCredentials.get(), environment.getMasterLock());
     MetadataTableUtil.cloneTable(instance, cloneInfo.srcTableId, cloneInfo.tableId);
     return new FinishCloneTable(cloneInfo);
   }
   
   @Override
   public void undo(long tid, Master environment) throws Exception {
-    MetadataTableUtil.deleteTable(cloneInfo.tableId, false, SystemCredentials.get().getAsThrift(), environment.getMasterLock());
+    MetadataTableUtil.deleteTable(cloneInfo.tableId, false, SystemCredentials.get(), environment.getMasterLock());
   }
   
 }
@@ -183,7 +183,8 @@ class ClonePermissions extends MasterRepo {
     // give all table permissions to the creator
     for (TablePermission permission : TablePermission.values()) {
       try {
-        AuditedSecurityOperation.getInstance().grantTablePermission(SystemCredentials.get().getAsThrift(), cloneInfo.user, cloneInfo.tableId, permission);
+        AuditedSecurityOperation.getInstance().grantTablePermission(SystemCredentials.get().toThrift(environment.getInstance()), cloneInfo.user,
+            cloneInfo.tableId, permission);
       } catch (ThriftSecurityException e) {
         Logger.getLogger(FinishCloneTable.class).error(e.getMessage(), e);
         throw e;
@@ -198,7 +199,7 @@ class ClonePermissions extends MasterRepo {
   
   @Override
   public void undo(long tid, Master environment) throws Exception {
-    AuditedSecurityOperation.getInstance().deleteTable(SystemCredentials.get().getAsThrift(), cloneInfo.tableId);
+    AuditedSecurityOperation.getInstance().deleteTable(SystemCredentials.get().toThrift(environment.getInstance()), cloneInfo.tableId);
   }
 }
 


Mime
View raw message