You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by bu...@apache.org on 2014/04/26 01:12:40 UTC

[11/17] git commit: Merge branch '1.6.0-SNAPSHOT'

Merge branch '1.6.0-SNAPSHOT'

Conflicts:
	core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
	core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
	core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java
	core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
	shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java


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

Branch: refs/heads/master
Commit: 592c8b062404da9f4f2faa333d8c393b2f6187f1
Parents: 6ac5c5f 9bdad26
Author: Sean Busbey <bu...@cloudera.com>
Authored: Fri Apr 25 12:10:46 2014 -0500
Committer: Sean Busbey <bu...@cloudera.com>
Committed: Fri Apr 25 14:47:15 2014 -0500

----------------------------------------------------------------------
 .../core/client/admin/ActiveCompaction.java     |   79 +-
 .../accumulo/core/client/admin/ActiveScan.java  |  112 +-
 .../client/admin/InstanceOperationsImpl.java    |   27 +-
 .../client/admin/NamespaceOperationsHelper.java |  214 ---
 .../client/admin/NamespaceOperationsImpl.java   |  254 ---
 .../client/admin/SecurityOperationsImpl.java    |   78 +-
 .../core/client/admin/TableOperations.java      |   15 +-
 .../client/admin/TableOperationsHelper.java     |    6 +-
 .../core/client/admin/TableOperationsImpl.java  |   59 +-
 .../core/client/impl/ActiveCompactionImpl.java  |  109 ++
 .../core/client/impl/ActiveScanImpl.java        |  146 ++
 .../core/client/impl/ConnectorImpl.java         |    8 +-
 .../client/impl/InstanceOperationsImpl.java     |  209 +++
 .../client/impl/NamespaceOperationsHelper.java  |  214 +++
 .../client/impl/NamespaceOperationsImpl.java    |  250 +++
 .../client/impl/SecurityOperationsImpl.java     |  331 ++++
 .../core/client/impl/TableOperationsHelper.java |  199 +++
 .../core/client/impl/TableOperationsImpl.java   | 1589 ++++++++++++++++++
 .../core/client/mock/MockConnector.java         |    6 +-
 .../client/mock/MockInstanceOperations.java     |   70 +-
 .../client/mock/MockInstanceOperationsImpl.java |   87 +
 .../client/mock/MockNamespaceOperations.java    |    4 +-
 .../client/mock/MockSecurityOperations.java     |  209 +--
 .../client/mock/MockSecurityOperationsImpl.java |  225 +++
 .../core/client/mock/MockTableOperations.java   |  431 +----
 .../client/mock/MockTableOperationsImpl.java    |  447 +++++
 .../core/client/mock/MockTabletLocator.java     |   45 +-
 .../client/mock/impl/MockTabletLocator.java     |   70 +
 .../client/admin/TableOperationsHelperTest.java |   90 +-
 .../client/impl/TableOperationsHelperTest.java  |  305 ++++
 .../mapreduce/lib/impl/InputConfigurator.java   |    2 +-
 .../server/security/SecurityOperation.java      |    2 +-
 .../accumulo/master/FateServiceHandler.java     |    2 +-
 .../accumulo/master/tableOps/ImportTable.java   |    2 +-
 .../apache/accumulo/shell/mock/MockShell.java   |   41 +-
 .../japi-compliance/japi-accumulo-1.5.xml       |    1 -
 .../japi-compliance/japi-accumulo-1.6.xml       |    3 +-
 37 files changed, 4351 insertions(+), 1590 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/592c8b06/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
index df2bb55,11e389f..d3a6285
--- 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
@@@ -16,39 -16,9 +16,30 @@@
   */
  package org.apache.accumulo.core.client.admin;
  
 +import static com.google.common.base.Preconditions.checkArgument;
 +
 +import java.nio.charset.StandardCharsets;
 +import java.util.ArrayList;
 +import java.util.Collections;
 +import java.util.List;
 +import java.util.Map;
 +
 +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.Instance;
- import org.apache.accumulo.core.client.TableNotFoundException;
- import org.apache.accumulo.core.client.impl.ClientExec;
- import org.apache.accumulo.core.client.impl.ClientExecReturn;
- import org.apache.accumulo.core.client.impl.MasterClient;
- import org.apache.accumulo.core.client.impl.ServerClient;
- import org.apache.accumulo.core.client.impl.ServerConfigurationUtil;
- 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.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;
 +import org.apache.accumulo.core.util.ThriftUtil;
 +import org.apache.accumulo.core.zookeeper.ZooUtil;
 +import org.apache.accumulo.fate.zookeeper.ZooCache;
 +import org.apache.accumulo.trace.instrument.Tracer;
 +import org.apache.thrift.TException;
 +import org.apache.thrift.transport.TTransport;
 +import org.apache.thrift.transport.TTransportException;
+ import org.apache.accumulo.core.security.thrift.TCredentials;
  
  /**
   * Provides a class for administering the accumulo instance
@@@ -63,153 -33,17 +54,163 @@@ public class InstanceOperationsImpl ext
     * @param credentials
     *          the Credential, containing principal and Authentication Token
     */
 -  private InstanceOperationsImpl(Instance instance, Credentials credentials) {
 -    super(instance, credentials);
 +  public InstanceOperationsImpl(Instance instance, Credentials credentials) {
 +    checkArgument(instance != null, "instance is null");
 +    checkArgument(credentials != null, "credentials is null");
 +    this.instance = instance;
 +    this.credentials = credentials;
 +  }
 +  
 +  @Override
 +  public void setProperty(final String property, final String value) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(property != null, "property is null");
 +    checkArgument(value != null, "value is null");
 +    MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
 +      @Override
 +      public void execute(MasterClientService.Client client) throws Exception {
 +        client.setSystemProperty(Tracer.traceInfo(), credentials.toThrift(instance), property, value);
 +      }
 +    });
 +  }
 +  
 +  @Override
 +  public void removeProperty(final String property) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(property != null, "property is null");
 +    MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
 +      @Override
 +      public void execute(MasterClientService.Client client) throws Exception {
 +        client.removeSystemProperty(Tracer.traceInfo(), credentials.toThrift(instance), property);
 +      }
 +    });
 +  }
 +  
 +  @Override
 +  public Map<String,String> getSystemConfiguration() throws AccumuloException, AccumuloSecurityException {
 +    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.toThrift(instance), ConfigurationType.CURRENT);
 +      }
 +    });
 +  }
 +  
 +  @Override
 +  public Map<String,String> getSiteConfiguration() throws AccumuloException, AccumuloSecurityException {
 +    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.toThrift(instance), ConfigurationType.SITE);
 +      }
 +    });
 +  }
 +  
 +  @Override
 +  public List<String> getTabletServers() {
 +    ZooCache cache = ZooCache.getInstance(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
 +    String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
 +    List<String> results = new ArrayList<String>();
 +    for (String candidate : cache.getChildren(path)) {
 +      List<String> children = cache.getChildren(path + "/" + candidate);
 +      if (children != null && children.size() > 0) {
 +        List<String> copy = new ArrayList<String>(children);
 +        Collections.sort(copy);
 +        byte[] data = cache.get(path + "/" + candidate + "/" + copy.get(0));
 +        if (data != null && !"master".equals(new String(data, StandardCharsets.UTF_8))) {
 +          results.add(candidate);
 +        }
 +      }
 +    }
 +    return results;
 +  }
 +  
 +  @Override
 +  public List<ActiveScan> getActiveScans(String tserver) throws AccumuloException, AccumuloSecurityException {
 +    Client client = null;
 +    try {
 +      client = ThriftUtil.getTServerClient(tserver, ServerConfigurationUtil.getConfiguration(instance));
 +      
 +      List<ActiveScan> as = new ArrayList<ActiveScan>();
 +      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) {
 +          throw new AccumuloException(e);
 +        }
 +      }
 +      return as;
 +    } catch (TTransportException e) {
 +      throw new AccumuloException(e);
 +    } catch (ThriftSecurityException e) {
 +      throw new AccumuloSecurityException(e.user, e.code, e);
 +    } catch (TException e) {
 +      throw new AccumuloException(e);
 +    } finally {
 +      if (client != null)
 +        ThriftUtil.returnClient(client);
 +    }
 +  }
 +  
 +  @Override
 +  public boolean testClassLoad(final String className, final String asTypeName) throws AccumuloException, AccumuloSecurityException {
 +    return ServerClient.execute(instance, new ClientExecReturn<Boolean,ClientService.Client>() {
 +      @Override
 +      public Boolean execute(ClientService.Client client) throws Exception {
 +        return client.checkClass(Tracer.traceInfo(), credentials.toThrift(instance), className, asTypeName);
 +      }
 +    });
 +  }
 +  
 +  @Override
 +  public List<ActiveCompaction> getActiveCompactions(String tserver) throws AccumuloException, AccumuloSecurityException {
 +    Client client = null;
 +    try {
 +      client = ThriftUtil.getTServerClient(tserver, ServerConfigurationUtil.getConfiguration(instance));
 +      
 +      List<ActiveCompaction> as = new ArrayList<ActiveCompaction>();
 +      for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction activeCompaction : client.getActiveCompactions(Tracer.traceInfo(),
 +          credentials.toThrift(instance))) {
 +        as.add(new ActiveCompaction(instance, activeCompaction));
 +      }
 +      return as;
 +    } catch (TTransportException e) {
 +      throw new AccumuloException(e);
 +    } catch (ThriftSecurityException e) {
 +      throw new AccumuloSecurityException(e.user, e.code, e);
 +    } catch (TException e) {
 +      throw new AccumuloException(e);
 +    } finally {
 +      if (client != null)
 +        ThriftUtil.returnClient(client);
 +    }
 +  }
 +  
 +  @Override
 +  public void ping(String tserver) throws AccumuloException {
 +    TTransport transport = null;
 +    try {
 +      transport = ThriftUtil.createTransport(AddressUtil.parseAddress(tserver, false), ServerConfigurationUtil.getConfiguration(instance));
 +      TabletClientService.Client client = ThriftUtil.createClient(new TabletClientService.Client.Factory(), transport);
 +      client.getTabletServerStatus(Tracer.traceInfo(), credentials.toThrift(instance));
 +    } catch (TTransportException e) {
 +      throw new AccumuloException(e);
 +    } catch (ThriftSecurityException e) {
 +      throw new AccumuloException(e);
 +    } catch (TException e) {
 +      throw new AccumuloException(e);
 +    } finally {
 +      if (transport != null) {
 +        transport.close();
 +      }
 +    }
    }
+   
+   /**
+    * @param instance
+    *          the connection information for this instance
+    * @param credentials
+    *          the Credential, containing principal and Authentication Token
+    */
+   public InstanceOperationsImpl(Instance instance, TCredentials credentials) {
+     this(instance, Credentials.fromThrift(credentials));
+   }
  }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/592c8b06/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
index 20c3768,875cc72..3d647a0
--- 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
@@@ -16,338 -16,21 +16,276 @@@
   */
  package org.apache.accumulo.core.client.admin;
  
 +import static com.google.common.base.Preconditions.checkArgument;
 +import java.nio.ByteBuffer;
 +import java.util.Set;
 +
 +import org.apache.accumulo.core.client.AccumuloException;
 +import org.apache.accumulo.core.client.AccumuloSecurityException;
  import org.apache.accumulo.core.client.Instance;
- import org.apache.accumulo.core.client.impl.ClientExec;
- import org.apache.accumulo.core.client.impl.ClientExecReturn;
- import org.apache.accumulo.core.client.impl.ServerClient;
- import org.apache.accumulo.core.client.impl.thrift.ClientService;
- import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
- 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.PasswordToken;
- import org.apache.accumulo.core.security.Authorizations;
  import org.apache.accumulo.core.security.Credentials;
 +import org.apache.accumulo.core.security.NamespacePermission;
 +import org.apache.accumulo.core.security.SystemPermission;
 +import org.apache.accumulo.core.security.TablePermission;
 +import org.apache.accumulo.core.util.ByteBufferUtil;
 +import org.apache.accumulo.trace.instrument.Tracer;
+ import org.apache.accumulo.core.security.thrift.TCredentials;
  
- public class SecurityOperationsImpl implements SecurityOperations {
- 
-   private Instance instance;
-   private Credentials credentials;
- 
-   private void execute(ClientExec<ClientService.Client> exec) throws AccumuloException, AccumuloSecurityException {
-     try {
-       ServerClient.executeRaw(instance, exec);
-     } catch (ThriftTableOperationException ttoe) {
-       // recast missing table
-       if (ttoe.getType() == TableOperationExceptionType.NOTFOUND)
-         throw new AccumuloSecurityException(null, SecurityErrorCode.TABLE_DOESNT_EXIST);
-       else if (ttoe.getType() == TableOperationExceptionType.NAMESPACE_NOTFOUND)
-         throw new AccumuloSecurityException(null, SecurityErrorCode.NAMESPACE_DOESNT_EXIST);
-       else
-         throw new AccumuloException(ttoe);
-     } catch (ThriftSecurityException e) {
-       throw new AccumuloSecurityException(e.user, e.code, e);
-     } catch (AccumuloException e) {
-       throw e;
-     } catch (Exception e) {
-       throw new AccumuloException(e);
-     }
-   }
- 
-   private <T> T execute(ClientExecReturn<T,ClientService.Client> exec) throws AccumuloException, AccumuloSecurityException {
-     try {
-       return ServerClient.executeRaw(instance, exec);
-     } catch (ThriftTableOperationException ttoe) {
-       // recast missing table
-       if (ttoe.getType() == TableOperationExceptionType.NOTFOUND)
-         throw new AccumuloSecurityException(null, SecurityErrorCode.TABLE_DOESNT_EXIST);
-       else if (ttoe.getType() == TableOperationExceptionType.NAMESPACE_NOTFOUND)
-         throw new AccumuloSecurityException(null, SecurityErrorCode.NAMESPACE_DOESNT_EXIST);
-       else
-         throw new AccumuloException(ttoe);
-     } catch (ThriftSecurityException e) {
-       throw new AccumuloSecurityException(e.user, e.code, e);
-     } catch (AccumuloException e) {
-       throw e;
-     } catch (Exception e) {
-       throw new AccumuloException(e);
-     }
-   }
+ /**
+  * @deprecated since 1.6.0; not intended for public api and you should not use it.
+  */
+ @Deprecated
+ public class SecurityOperationsImpl extends org.apache.accumulo.core.client.impl.SecurityOperationsImpl {
  
    public SecurityOperationsImpl(Instance instance, Credentials credentials) {
 -    super(instance, credentials);
 +    checkArgument(instance != null, "instance is null");
 +    checkArgument(credentials != null, "credentials is null");
 +    this.instance = instance;
 +    this.credentials = credentials;
 +  }
 +
 +  @Deprecated
 +  @Override
 +  public void createUser(String user, byte[] password, final Authorizations authorizations) throws AccumuloException, AccumuloSecurityException {
 +    createLocalUser(user, new PasswordToken(password));
 +    changeUserAuthorizations(user, authorizations);
 +  }
 +
 +  @Override
 +  public void createLocalUser(final String principal, final PasswordToken password) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(password != null, "password is null");
 +    execute(new ClientExec<ClientService.Client>() {
 +      @Override
 +      public void execute(ClientService.Client client) throws Exception {
 +        client.createLocalUser(Tracer.traceInfo(), credentials.toThrift(instance), principal, ByteBuffer.wrap(password.getPassword()));
 +      }
 +    });
 +  }
 +
 +  @Deprecated
 +  @Override
 +  public void dropUser(final String user) throws AccumuloException, AccumuloSecurityException {
 +    dropLocalUser(user);
 +  }
 +
 +  @Override
 +  public void dropLocalUser(final String principal) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    execute(new ClientExec<ClientService.Client>() {
 +      @Override
 +      public void execute(ClientService.Client client) throws Exception {
 +        client.dropLocalUser(Tracer.traceInfo(), credentials.toThrift(instance), principal);
 +      }
 +    });
 +  }
 +
 +  @Deprecated
 +  @Override
 +  public boolean authenticateUser(String user, byte[] password) throws AccumuloException, AccumuloSecurityException {
 +    return authenticateUser(user, new PasswordToken(password));
 +  }
 +
 +  @Override
 +  public boolean authenticateUser(final String principal, final AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(token != null, "token is null");
 +    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.toThrift(instance), toAuth.toThrift(instance));
 +      }
 +    });
 +  }
 +
 +  @Override
 +  @Deprecated
 +  public void changeUserPassword(String user, byte[] password) throws AccumuloException, AccumuloSecurityException {
 +    changeLocalUserPassword(user, new PasswordToken(password));
 +  }
 +
 +  @Override
 +  public void changeLocalUserPassword(final String principal, final PasswordToken token) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(token != null, "token is null");
 +    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.toThrift(instance), principal, ByteBuffer.wrap(token.getPassword()));
 +      }
 +    });
 +    if (this.credentials.getPrincipal().equals(principal)) {
 +      this.credentials = toChange;
 +    }
 +  }
 +
 +  @Override
 +  public void changeUserAuthorizations(final String principal, final Authorizations authorizations) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(authorizations != null, "authorizations is null");
 +    execute(new ClientExec<ClientService.Client>() {
 +      @Override
 +      public void execute(ClientService.Client client) throws Exception {
 +        client.changeAuthorizations(Tracer.traceInfo(), credentials.toThrift(instance), principal,
 +            ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()));
 +      }
 +    });
 +  }
 +
 +  @Override
 +  public Authorizations getUserAuthorizations(final String principal) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    return execute(new ClientExecReturn<Authorizations,ClientService.Client>() {
 +      @Override
 +      public Authorizations execute(ClientService.Client client) throws Exception {
 +        return new Authorizations(client.getUserAuthorizations(Tracer.traceInfo(), credentials.toThrift(instance), principal));
 +      }
 +    });
 +  }
 +
 +  @Override
 +  public boolean hasSystemPermission(final String principal, final SystemPermission perm) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(perm != null, "perm is null");
 +    return execute(new ClientExecReturn<Boolean,ClientService.Client>() {
 +      @Override
 +      public Boolean execute(ClientService.Client client) throws Exception {
 +        return client.hasSystemPermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, perm.getId());
 +      }
 +    });
 +  }
 +
 +  @Override
 +  public boolean hasTablePermission(final String principal, final String table, final TablePermission perm) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(table != null, "table is null");
 +    checkArgument(perm != null, "perm is null");
 +    try {
 +      return execute(new ClientExecReturn<Boolean,ClientService.Client>() {
 +        @Override
 +        public Boolean execute(ClientService.Client client) throws Exception {
 +          return client.hasTablePermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, table, perm.getId());
 +        }
 +      });
 +    } catch (AccumuloSecurityException e) {
 +      if (e.getSecurityErrorCode() == org.apache.accumulo.core.client.security.SecurityErrorCode.NAMESPACE_DOESNT_EXIST)
 +        throw new AccumuloSecurityException(null, SecurityErrorCode.TABLE_DOESNT_EXIST, e);
 +      else
 +        throw e;
 +    }
 +  }
 +
 +  @Override
 +  public boolean hasNamespacePermission(final String principal, final String namespace, final NamespacePermission permission) throws AccumuloException,
 +      AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(namespace != null, "namespace is null");
 +    checkArgument(permission != null, "permission is null");
 +    return execute(new ClientExecReturn<Boolean,ClientService.Client>() {
 +      @Override
 +      public Boolean execute(ClientService.Client client) throws Exception {
 +        return client.hasNamespacePermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, namespace, permission.getId());
 +      }
 +    });
 +  }
 +
 +  @Override
 +  public void grantSystemPermission(final String principal, final SystemPermission permission) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(permission != null, "permission is null");
 +    execute(new ClientExec<ClientService.Client>() {
 +      @Override
 +      public void execute(ClientService.Client client) throws Exception {
 +        client.grantSystemPermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, permission.getId());
 +      }
 +    });
 +  }
 +
 +  @Override
 +  public void grantTablePermission(final String principal, final String table, final TablePermission permission) throws AccumuloException,
 +      AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(table != null, "table is null");
 +    checkArgument(permission != null, "permission is null");
 +    try {
 +      execute(new ClientExec<ClientService.Client>() {
 +        @Override
 +        public void execute(ClientService.Client client) throws Exception {
 +          client.grantTablePermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, table, permission.getId());
 +        }
 +      });
 +    } catch (AccumuloSecurityException e) {
 +      if (e.getSecurityErrorCode() == org.apache.accumulo.core.client.security.SecurityErrorCode.NAMESPACE_DOESNT_EXIST)
 +        throw new AccumuloSecurityException(null, SecurityErrorCode.TABLE_DOESNT_EXIST, e);
 +      else
 +        throw e;
 +    }
 +  }
 +
 +  @Override
 +  public void grantNamespacePermission(final String principal, final String namespace, final NamespacePermission permission) throws AccumuloException,
 +      AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(namespace != null, "namespace is null");
 +    checkArgument(permission != null, "permission is null");
 +    execute(new ClientExec<ClientService.Client>() {
 +      @Override
 +      public void execute(ClientService.Client client) throws Exception {
 +        client.grantNamespacePermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, namespace, permission.getId());
 +      }
 +    });
 +  }
 +
 +  @Override
 +  public void revokeSystemPermission(final String principal, final SystemPermission permission) throws AccumuloException, AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(permission != null, "permission is null");
 +    execute(new ClientExec<ClientService.Client>() {
 +      @Override
 +      public void execute(ClientService.Client client) throws Exception {
 +        client.revokeSystemPermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, permission.getId());
 +      }
 +    });
 +  }
 +
 +  @Override
 +  public void revokeTablePermission(final String principal, final String table, final TablePermission permission) throws AccumuloException,
 +      AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(table != null, "table is null");
 +    checkArgument(permission != null, "permission is null");
 +    try {
 +      execute(new ClientExec<ClientService.Client>() {
 +        @Override
 +        public void execute(ClientService.Client client) throws Exception {
 +          client.revokeTablePermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, table, permission.getId());
 +        }
 +      });
 +    } catch (AccumuloSecurityException e) {
 +      if (e.getSecurityErrorCode() == org.apache.accumulo.core.client.security.SecurityErrorCode.NAMESPACE_DOESNT_EXIST)
 +        throw new AccumuloSecurityException(null, SecurityErrorCode.TABLE_DOESNT_EXIST, e);
 +      else
 +        throw e;
 +    }
 +  }
 +
 +  @Override
 +  public void revokeNamespacePermission(final String principal, final String namespace, final NamespacePermission permission) throws AccumuloException,
 +      AccumuloSecurityException {
 +    checkArgument(principal != null, "principal is null");
 +    checkArgument(namespace != null, "namespace is null");
 +    checkArgument(permission != null, "permission is null");
 +    execute(new ClientExec<ClientService.Client>() {
 +      @Override
 +      public void execute(ClientService.Client client) throws Exception {
 +        client.revokeNamespacePermission(Tracer.traceInfo(), credentials.toThrift(instance), principal, namespace, permission.getId());
 +      }
 +    });
    }
  
-   @Deprecated
-   @Override
-   public Set<String> listUsers() throws AccumuloException, AccumuloSecurityException {
-     return listLocalUsers();
-   }
- 
-   @Override
-   public Set<String> listLocalUsers() throws AccumuloException, AccumuloSecurityException {
-     return execute(new ClientExecReturn<Set<String>,ClientService.Client>() {
-       @Override
-       public Set<String> execute(ClientService.Client client) throws Exception {
-         return client.listLocalUsers(Tracer.traceInfo(), credentials.toThrift(instance));
-       }
-     });
+   public SecurityOperationsImpl(Instance instance, TCredentials credentials) {
+     this(instance, Credentials.fromThrift(credentials));
    }
- 
  }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/592c8b06/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java
index f9bc6e7,1384a54..9d0d770
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java
@@@ -16,189 -16,9 +16,193 @@@
   */
  package org.apache.accumulo.core.client.admin;
  
 +import static com.google.common.base.Preconditions.checkArgument;
 +import java.util.EnumSet;
 +import java.util.HashMap;
 +import java.util.Map;
 +import java.util.Map.Entry;
 +import java.util.TreeMap;
 +import java.util.TreeSet;
 +
 +import org.apache.accumulo.core.client.AccumuloException;
 +import org.apache.accumulo.core.client.AccumuloSecurityException;
 +import org.apache.accumulo.core.client.IteratorSetting;
 +import org.apache.accumulo.core.client.TableNotFoundException;
 +import org.apache.accumulo.core.conf.Property;
 +import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
 +
- public abstract class TableOperationsHelper implements TableOperations {
+ /**
+  * @deprecated since 1.6.0; not intended for public api and you should not use it.
+  */
+ @Deprecated
+ public abstract class TableOperationsHelper extends org.apache.accumulo.core.client.impl.TableOperationsHelper {
 +
 +  @Override
 +  public void attachIterator(String tableName, IteratorSetting setting) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
 +    attachIterator(tableName, setting, EnumSet.allOf(IteratorScope.class));
 +  }
 +
 +  @Override
 +  public void attachIterator(String tableName, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
 +      TableNotFoundException {
 +    checkArgument(tableName != null, "tableName is null");
 +    checkArgument(setting != null, "setting is null");
 +    checkArgument(scopes != null, "scopes is null");
 +    checkIteratorConflicts(tableName, setting, scopes);
 +    for (IteratorScope scope : scopes) {
 +      String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), setting.getName());
 +      for (Entry<String,String> prop : setting.getOptions().entrySet()) {
 +        this.setProperty(tableName, root + ".opt." + prop.getKey(), prop.getValue());
 +      }
 +      this.setProperty(tableName, root, setting.getPriority() + "," + setting.getIteratorClass());
 +    }
 +  }
 +
 +  @Override
 +  public void removeIterator(String tableName, String name, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
 +      TableNotFoundException {
 +    Map<String,String> copy = new TreeMap<String,String>();
 +    for (Entry<String,String> property : this.getProperties(tableName)) {
 +      copy.put(property.getKey(), property.getValue());
 +    }
 +    for (IteratorScope scope : scopes) {
 +      String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), name);
 +      for (Entry<String,String> property : copy.entrySet()) {
 +        if (property.getKey().equals(root) || property.getKey().startsWith(root + ".opt."))
 +          this.removeProperty(tableName, property.getKey());
 +      }
 +    }
 +  }
 +
 +  @Override
 +  public IteratorSetting getIteratorSetting(String tableName, String name, IteratorScope scope) throws AccumuloSecurityException, AccumuloException,
 +      TableNotFoundException {
 +    checkArgument(tableName != null, "tableName is null");
 +    checkArgument(name != null, "name is null");
 +    checkArgument(scope != null, "scope is null");
 +    int priority = -1;
 +    String classname = null;
 +    Map<String,String> settings = new HashMap<String,String>();
 +
 +    String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), name);
 +    String opt = root + ".opt.";
 +    for (Entry<String,String> property : this.getProperties(tableName)) {
 +      if (property.getKey().equals(root)) {
 +        String parts[] = property.getValue().split(",");
 +        if (parts.length != 2) {
 +          throw new AccumuloException("Bad value for iterator setting: " + property.getValue());
 +        }
 +        priority = Integer.parseInt(parts[0]);
 +        classname = parts[1];
 +      } else if (property.getKey().startsWith(opt)) {
 +        settings.put(property.getKey().substring(opt.length()), property.getValue());
 +      }
 +    }
 +    if (priority <= 0 || classname == null) {
 +      return null;
 +    }
 +    return new IteratorSetting(priority, name, classname, settings);
 +  }
 +
 +  @Override
 +  public Map<String,EnumSet<IteratorScope>> listIterators(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
 +    Map<String,EnumSet<IteratorScope>> result = new TreeMap<String,EnumSet<IteratorScope>>();
 +    for (Entry<String,String> property : this.getProperties(tableName)) {
 +      String name = property.getKey();
 +      String[] parts = name.split("\\.");
 +      if (parts.length == 4) {
 +        if (parts[0].equals("table") && parts[1].equals("iterator")) {
 +          IteratorScope scope = IteratorScope.valueOf(parts[2]);
 +          if (!result.containsKey(parts[3]))
 +            result.put(parts[3], EnumSet.noneOf(IteratorScope.class));
 +          result.get(parts[3]).add(scope);
 +        }
 +      }
 +    }
 +    return result;
 +  }
 +
 +  @Override
 +  public void checkIteratorConflicts(String tableName, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException, TableNotFoundException {
 +    checkArgument(tableName != null, "tableName is null");
 +    checkArgument(setting != null, "setting is null");
 +    checkArgument(scopes != null, "scopes is null");
 +    for (IteratorScope scope : scopes) {
 +      String scopeStr = String.format("%s%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase());
 +      String nameStr = String.format("%s.%s", scopeStr, setting.getName());
 +      String optStr = String.format("%s.opt.", nameStr);
 +      Map<String,String> optionConflicts = new TreeMap<String,String>();
 +      for (Entry<String,String> property : this.getProperties(tableName)) {
 +        if (property.getKey().startsWith(scopeStr)) {
 +          if (property.getKey().equals(nameStr))
 +            throw new AccumuloException(new IllegalArgumentException("iterator name conflict for " + setting.getName() + ": " + property.getKey() + "="
 +                + property.getValue()));
 +          if (property.getKey().startsWith(optStr))
 +            optionConflicts.put(property.getKey(), property.getValue());
 +          if (property.getKey().contains(".opt."))
 +            continue;
 +          String parts[] = property.getValue().split(",");
 +          if (parts.length != 2)
 +            throw new AccumuloException("Bad value for existing iterator setting: " + property.getKey() + "=" + property.getValue());
 +          try {
 +            if (Integer.parseInt(parts[0]) == setting.getPriority())
 +              throw new AccumuloException(new IllegalArgumentException("iterator priority conflict: " + property.getKey() + "=" + property.getValue()));
 +          } catch (NumberFormatException e) {
 +            throw new AccumuloException("Bad value for existing iterator setting: " + property.getKey() + "=" + property.getValue());
 +          }
 +        }
 +      }
 +      if (optionConflicts.size() > 0)
 +        throw new AccumuloException(new IllegalArgumentException("iterator options conflict for " + setting.getName() + ": " + optionConflicts));
 +    }
 +  }
 +
 +  @Override
 +  public int addConstraint(String tableName, String constraintClassName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
 +    TreeSet<Integer> constraintNumbers = new TreeSet<Integer>();
 +    TreeMap<String,Integer> constraintClasses = new TreeMap<String,Integer>();
 +    int i;
 +    for (Entry<String,String> property : this.getProperties(tableName)) {
 +      if (property.getKey().startsWith(Property.TABLE_CONSTRAINT_PREFIX.toString())) {
 +        try {
 +          i = Integer.parseInt(property.getKey().substring(Property.TABLE_CONSTRAINT_PREFIX.toString().length()));
 +        } catch (NumberFormatException e) {
 +          throw new AccumuloException("Bad key for existing constraint: " + property.toString());
 +        }
 +        constraintNumbers.add(i);
 +        constraintClasses.put(property.getValue(), i);
 +      }
 +    }
 +    i = 1;
 +    while (constraintNumbers.contains(i))
 +      i++;
 +    if (constraintClasses.containsKey(constraintClassName))
 +      throw new AccumuloException("Constraint " + constraintClassName + " already exists for table " + tableName + " with number "
 +          + constraintClasses.get(constraintClassName));
 +    this.setProperty(tableName, Property.TABLE_CONSTRAINT_PREFIX.toString() + i, constraintClassName);
 +    return i;
 +  }
 +
 +  @Override
 +  public void removeConstraint(String tableName, int number) throws AccumuloException, AccumuloSecurityException {
 +    this.removeProperty(tableName, Property.TABLE_CONSTRAINT_PREFIX.toString() + number);
 +  }
 +
 +  @Override
 +  public Map<String,Integer> listConstraints(String tableName) throws AccumuloException, TableNotFoundException {
 +    Map<String,Integer> constraints = new TreeMap<String,Integer>();
 +    for (Entry<String,String> property : this.getProperties(tableName)) {
 +      if (property.getKey().startsWith(Property.TABLE_CONSTRAINT_PREFIX.toString())) {
 +        if (constraints.containsKey(property.getValue()))
 +          throw new AccumuloException("Same constraint configured twice: " + property.getKey() + "=" + Property.TABLE_CONSTRAINT_PREFIX
 +              + constraints.get(property.getValue()) + "=" + property.getKey());
 +        try {
 +          constraints.put(property.getValue(), Integer.parseInt(property.getKey().substring(Property.TABLE_CONSTRAINT_PREFIX.toString().length())));
 +        } catch (NumberFormatException e) {
 +          throw new AccumuloException("Bad key for existing constraint: " + property.toString());
 +        }
 +      }
 +    }
 +    return constraints;
 +  }
  }