You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/12/05 00:58:35 UTC

[43/50] [abbrv] git commit: ACCUMULO-802 Renamed "TableNamespace" to "Namespace"

ACCUMULO-802 Renamed "TableNamespace" to "Namespace"

 based on ReviewBoard suggestion


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: ea8ec1939af2d73ab3727e6fa4f16f7bde0d51c6
Parents: ab50556
Author: Christopher Tubbs <ct...@apache.org>
Authored: Fri Nov 15 20:31:42 2013 -0500
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Wed Dec 4 18:46:11 2013 -0500

----------------------------------------------------------------------
 .../org/apache/accumulo/core/Constants.java     |   58 +-
 .../apache/accumulo/core/client/Connector.java  |   42 +-
 .../core/client/NamespaceExistsException.java   |   67 +
 .../core/client/NamespaceNotEmptyException.java |   74 ++
 .../core/client/NamespaceNotFoundException.java |   77 ++
 .../client/TableNamespaceExistsException.java   |   67 -
 .../client/TableNamespaceNotEmptyException.java |   74 --
 .../client/TableNamespaceNotFoundException.java |   77 --
 .../core/client/admin/NamespaceOperations.java  |  401 ++++++
 .../client/admin/NamespaceOperationsHelper.java |  203 +++
 .../client/admin/NamespaceOperationsImpl.java   |  589 +++++++++
 .../core/client/admin/SecurityOperations.java   |   76 +-
 .../client/admin/SecurityOperationsImpl.java    |   73 +-
 .../client/admin/TableNamespaceOperations.java  |  406 ------
 .../admin/TableNamespaceOperationsHelper.java   |  206 ---
 .../admin/TableNamespaceOperationsImpl.java     |  590 ---------
 .../core/client/admin/TableOperationsImpl.java  |   34 +-
 .../core/client/impl/ConnectorImpl.java         |   10 +-
 .../accumulo/core/client/impl/Namespaces.java   |  107 ++
 .../core/client/impl/TableNamespaces.java       |  107 --
 .../accumulo/core/client/impl/Tables.java       |   12 +-
 .../core/client/impl/thrift/ClientService.java  | 1230 +++++++++---------
 .../client/impl/thrift/SecurityErrorCode.java   |    4 +-
 .../accumulo/core/client/mock/MockAccumulo.java |   14 +-
 .../core/client/mock/MockConnector.java         |    6 +-
 .../core/client/mock/MockNamespace.java         |   54 +
 .../client/mock/MockNamespaceOperations.java    |  188 +++
 .../client/mock/MockSecurityOperations.java     |   39 +-
 .../accumulo/core/client/mock/MockTable.java    |    8 +-
 .../core/client/mock/MockTableNamespace.java    |   54 -
 .../mock/MockTableNamespaceOperations.java      |  188 ---
 .../core/client/mock/MockTableOperations.java   |    8 +-
 .../core/client/security/SecurityErrorCode.java |    2 +-
 .../core/master/thrift/MasterClientService.java | 1072 +++++++--------
 .../core/security/NamespacePermission.java      |   66 +
 .../core/security/TableNamespacePermission.java |   66 -
 .../apache/accumulo/core/util/shell/Shell.java  |   26 +-
 .../core/util/shell/ShellCompletor.java         |   57 +-
 .../accumulo/core/util/shell/ShellOptions.java  |    4 +-
 .../core/util/shell/commands/ConfigCommand.java |  103 +-
 .../util/shell/commands/ConstraintCommand.java  |   58 +-
 .../shell/commands/CreateNamespaceCommand.java  |   30 +-
 .../util/shell/commands/CreateTableCommand.java |    4 +-
 .../core/util/shell/commands/DUCommand.java     |   56 +-
 .../util/shell/commands/DeleteIterCommand.java  |   44 +-
 .../shell/commands/DeleteNamespaceCommand.java  |   26 +-
 .../util/shell/commands/DeleteTableCommand.java |    2 +-
 .../core/util/shell/commands/GrantCommand.java  |   50 +-
 .../util/shell/commands/ListIterCommand.java    |   43 +-
 .../commands/NamespacePermissionsCommand.java   |    6 +-
 .../util/shell/commands/NamespacesCommand.java  |    8 +-
 .../core/util/shell/commands/OptUtil.java       |   62 +-
 .../shell/commands/RenameNamespaceCommand.java  |   20 +-
 .../util/shell/commands/RenameTableCommand.java |    2 +-
 .../core/util/shell/commands/RevokeCommand.java |   52 +-
 .../util/shell/commands/SetIterCommand.java     |  127 +-
 .../util/shell/commands/TableOperation.java     |   59 +-
 .../core/util/shell/commands/TablesCommand.java |   16 +-
 .../shell/commands/UserPermissionsCommand.java  |   30 +-
 core/src/main/thrift/client.thrift              |   12 +-
 core/src/main/thrift/master.thrift              |   14 +-
 .../core/client/mock/MockNamespacesTest.java    |  313 +++++
 .../client/mock/MockTableNamespacesTest.java    |  312 -----
 .../server/client/ClientServiceHandler.java     |   60 +-
 .../server/conf/NamespaceConfWatcher.java       |  107 ++
 .../server/conf/NamespaceConfiguration.java     |  174 +++
 .../server/conf/ServerConfiguration.java        |   28 +-
 .../server/conf/TableConfiguration.java         |   46 +-
 .../server/conf/TableNamespaceConfWatcher.java  |  107 --
 .../conf/TableNamespaceConfiguration.java       |  174 ---
 .../server/conf/TableParentConfiguration.java   |    4 +-
 .../apache/accumulo/server/init/Initialize.java |   10 +-
 .../server/security/SecurityOperation.java      |  400 +++---
 .../security/handler/InsecurePermHandler.java   |   22 +-
 .../security/handler/PermissionHandler.java     |   69 +-
 .../server/security/handler/ZKPermHandler.java  |  157 +--
 .../server/security/handler/ZKSecurityTool.java |   12 +-
 .../accumulo/server/tables/TableManager.java    |    4 +-
 .../java/org/apache/accumulo/master/Master.java |  111 +-
 .../master/tableOps/CancelCompactions.java      |    4 +-
 .../master/tableOps/ChangeTableState.java       |    6 +-
 .../accumulo/master/tableOps/CloneTable.java    |   20 +-
 .../accumulo/master/tableOps/CompactRange.java  |    4 +-
 .../master/tableOps/CreateNamespace.java        |  196 +++
 .../accumulo/master/tableOps/CreateTable.java   |   14 +-
 .../master/tableOps/CreateTableNamespace.java   |  197 ---
 .../master/tableOps/DeleteNamespace.java        |  104 ++
 .../accumulo/master/tableOps/DeleteTable.java   |    6 +-
 .../master/tableOps/DeleteTableNamespace.java   |  104 --
 .../accumulo/master/tableOps/ExportTable.java   |    6 +-
 .../accumulo/master/tableOps/ImportTable.java   |   16 +-
 .../master/tableOps/RenameNamespace.java        |   92 ++
 .../accumulo/master/tableOps/RenameTable.java   |   20 +-
 .../master/tableOps/RenameTableNamespace.java   |   91 --
 .../accumulo/master/tableOps/TableRangeOp.java  |    6 +-
 .../apache/accumulo/master/tableOps/Utils.java  |   56 +-
 .../concurrent/ChangePermissions.java           |   30 +-
 .../randomwalk/concurrent/CheckPermission.java  |   26 +-
 .../test/randomwalk/concurrent/Config.java      |   14 +-
 .../randomwalk/concurrent/CreateNamespace.java  |   48 +
 .../concurrent/CreateTableNamespace.java        |   48 -
 .../randomwalk/concurrent/DeleteNamespace.java  |   48 +
 .../concurrent/DeleteTableNamespace.java        |   48 -
 .../randomwalk/concurrent/OfflineNamespace.java |   53 +
 .../concurrent/OfflineTableNamespace.java       |   53 -
 .../randomwalk/concurrent/RenameNamespace.java  |   52 +
 .../concurrent/RenameTableNamespace.java        |   52 -
 .../randomwalk/security/WalkingSecurity.java    |  182 +--
 .../org/apache/accumulo/test/NamespacesIT.java  |  584 +++++++++
 .../org/apache/accumulo/test/ShellServerIT.java |   32 +-
 .../apache/accumulo/test/TableNamespacesIT.java |  584 ---------
 .../accumulo/test/functional/PermissionsIT.java |  100 +-
 .../randomwalk/conf/modules/Concurrent.xml      |   16 +-
 113 files changed, 6139 insertions(+), 6143 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea8ec193/core/src/main/java/org/apache/accumulo/core/Constants.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/Constants.java b/core/src/main/java/org/apache/accumulo/core/Constants.java
index 4eb7471..2909c3d 100644
--- a/core/src/main/java/org/apache/accumulo/core/Constants.java
+++ b/core/src/main/java/org/apache/accumulo/core/Constants.java
@@ -23,11 +23,11 @@ import org.apache.accumulo.core.security.Authorizations;
 public class Constants {
   public static final Charset UTF8 = Charset.forName("UTF-8");
   public static final String VERSION = FilteredConstants.VERSION;
-  
+
   // Zookeeper locations
   public static final String ZROOT = "/accumulo";
   public static final String ZINSTANCES = "/instances";
-  
+
   public static final String ZTABLES = "/tables";
   public static final byte[] ZTABLES_INITIAL_ID = new byte[] {'0'};
   public static final String ZTABLE_NAME = "/name";
@@ -45,76 +45,76 @@ public class Constants {
   public static final String ZMASTERS = "/masters";
   public static final String ZMASTER_LOCK = ZMASTERS + "/lock";
   public static final String ZMASTER_GOAL_STATE = ZMASTERS + "/goal_state";
-  
+
   public static final String ZGC = "/gc";
   public static final String ZGC_LOCK = ZGC + "/lock";
-  
+
   public static final String ZMONITOR = "/monitor";
   public static final String ZMONITOR_LOG4J_PORT = ZMONITOR + "/log4j_port";
-  
+
   public static final String ZCONFIG = "/config";
-  
+
   public static final String ZTSERVERS = "/tservers";
-  
+
   public static final String ZDEAD = "/dead";
   public static final String ZDEADTSERVERS = ZDEAD + "/tservers";
-  
+
   public static final String ZTRACERS = "/tracers";
-  
+
   public static final String ZPROBLEMS = "/problems";
-  
+
   public static final String BULK_ARBITRATOR_TYPE = "bulkTx";
-  
+
   public static final String ZFATE = "/fate";
-  
+
   public static final String ZNEXT_FILE = "/next_file";
-  
+
   public static final String ZBULK_FAILED_COPYQ = "/bulk_failed_copyq";
-  
+
   public static final String ZHDFS_RESERVATIONS = "/hdfs_reservations";
   public static final String ZRECOVERY = "/recovery";
-  
+
   /**
    * Initial tablet directory name for the default tablet in all tables
    */
   public static final String DEFAULT_TABLET_LOCATION = "/default_tablet";
-  
+
   public static final String ZTABLE_LOCKS = "/table_locks";
-  
+
   public static final String BULK_PREFIX = "b-";
-  
+
   // this affects the table client caching of metadata
   public static final int SCAN_BATCH_SIZE = 1000;
-  
+
   // Scanners will default to fetching 3 batches of Key/Value pairs before asynchronously
   // fetching the next batch.
   public static final long SCANNER_DEFAULT_READAHEAD_THRESHOLD = 3l;
-  
+
   // Security configuration
   public static final String PW_HASH_ALGORITHM = "SHA-256";
-  
+
   /**
    * @deprecated since 1.6.0; Use {@link Authorizations#EMPTY} instead
    */
   @Deprecated
   public static final Authorizations NO_AUTHS = Authorizations.EMPTY;
-  
+
   public static final int MAX_DATA_TO_PRINT = 64;
   public static final String CORE_PACKAGE_NAME = "org.apache.accumulo.core";
   public static final String VALID_TABLE_NAME_REGEX = "^(\\w+\\.)?(\\w+)$";
-  public static final String VALID_TABLE_NAMESPACE_REGEX = "^\\w+$";
+  public static final String VALID_NAMESPACE_REGEX = "^\\w+$";
   public static final String MAPFILE_EXTENSION = "map";
   public static final String GENERATED_TABLET_DIRECTORY_PREFIX = "t-";
-  
+
   public static final String EXPORT_METADATA_FILE = "metadata.bin";
   public static final String EXPORT_TABLE_CONFIG_FILE = "table_config.txt";
   public static final String EXPORT_FILE = "exportMetadata.zip";
   public static final String EXPORT_INFO_FILE = "accumulo_export_info.txt";
-  
+
   // Variables that will be substituted with environment vars in PropertyType.PATH values
   public static final String[] PATH_PROPERTY_ENV_VARS = new String[]{"$ACCUMULO_HOME", "$ACCUMULO_CONF_DIR"};
-  public static final String DEFAULT_TABLE_NAMESPACE = "_default_";
-  public static final String SYSTEM_TABLE_NAMESPACE = "_system_";
-  public static final String DEFAULT_TABLE_NAMESPACE_ID = "!DEF";
-  public static final String SYSTEM_TABLE_NAMESPACE_ID = "!SYS";
+  public static final String DEFAULT_NAMESPACE = "_default_";
+  public static final String SYSTEM_NAMESPACE = "_system_";
+  public static final String DEFAULT_NAMESPACE_ID = "!DEF";
+  public static final String SYSTEM_NAMESPACE_ID = "!SYS";
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea8ec193/core/src/main/java/org/apache/accumulo/core/client/Connector.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/Connector.java b/core/src/main/java/org/apache/accumulo/core/client/Connector.java
index 06b74a8..92a1184 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/Connector.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/Connector.java
@@ -17,8 +17,8 @@
 package org.apache.accumulo.core.client;
 
 import org.apache.accumulo.core.client.admin.InstanceOperations;
+import org.apache.accumulo.core.client.admin.NamespaceOperations;
 import org.apache.accumulo.core.client.admin.SecurityOperations;
-import org.apache.accumulo.core.client.admin.TableNamespaceOperations;
 import org.apache.accumulo.core.client.admin.TableOperations;
 import org.apache.accumulo.core.security.Authorizations;
 
@@ -29,7 +29,7 @@ import org.apache.accumulo.core.security.Authorizations;
  * The Connector enforces security on the client side by forcing all API calls to be accompanied by user credentials.
  */
 public abstract class Connector {
-  
+
   /**
    * Factory method to create a BatchScanner connected to Accumulo.
    * 
@@ -47,7 +47,7 @@ public abstract class Connector {
    *           when the specified table doesn't exist
    */
   public abstract BatchScanner createBatchScanner(String tableName, Authorizations authorizations, int numQueryThreads) throws TableNotFoundException;
-  
+
   /**
    * Factory method to create a BatchDeleter connected to Accumulo.
    * 
@@ -74,7 +74,7 @@ public abstract class Connector {
   @Deprecated
   public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, long maxMemory, long maxLatency,
       int maxWriteThreads) throws TableNotFoundException;
-  
+
   /**
    * 
    * @param tableName
@@ -91,10 +91,10 @@ public abstract class Connector {
    * @throws TableNotFoundException
    * @since 1.5.0
    */
-  
+
   public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, BatchWriterConfig config)
       throws TableNotFoundException;
-  
+
   /**
    * Factory method to create a BatchWriter connected to Accumulo.
    * 
@@ -114,7 +114,7 @@ public abstract class Connector {
    */
   @Deprecated
   public abstract BatchWriter createBatchWriter(String tableName, long maxMemory, long maxLatency, int maxWriteThreads) throws TableNotFoundException;
-  
+
   /**
    * Factory method to create a BatchWriter connected to Accumulo.
    * 
@@ -126,9 +126,9 @@ public abstract class Connector {
    * @throws TableNotFoundException
    * @since 1.5.0
    */
-  
+
   public abstract BatchWriter createBatchWriter(String tableName, BatchWriterConfig config) throws TableNotFoundException;
-  
+
   /**
    * Factory method to create a Multi-Table BatchWriter connected to Accumulo. Multi-table batch writers can queue data for multiple tables, which is good for
    * ingesting data into multiple tables from the same source
@@ -145,7 +145,7 @@ public abstract class Connector {
    */
   @Deprecated
   public abstract MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory, long maxLatency, int maxWriteThreads);
-  
+
   /**
    * Factory method to create a Multi-Table BatchWriter connected to Accumulo. Multi-table batch writers can queue data for multiple tables. Also data for
    * multiple tables can be sent to a server in a single batch. Its an efficient way to ingest data into multiple tables from a single process.
@@ -155,9 +155,9 @@ public abstract class Connector {
    * @return MultiTableBatchWriter object for configuring and writing data to
    * @since 1.5.0
    */
-  
+
   public abstract MultiTableBatchWriter createMultiTableBatchWriter(BatchWriterConfig config);
-  
+
   /**
    * Factory method to create a Scanner connected to Accumulo.
    * 
@@ -173,7 +173,7 @@ public abstract class Connector {
    *           when the specified table doesn't exist
    */
   public abstract Scanner createScanner(String tableName, Authorizations authorizations) throws TableNotFoundException;
-  
+
   /**
    * Factory method to create a ConditionalWriter connected to Accumulo.
    * 
@@ -195,35 +195,35 @@ public abstract class Connector {
    * @return the internal instance object
    */
   public abstract Instance getInstance();
-  
+
   /**
    * Get the current user for this connector
    * 
    * @return the user name
    */
   public abstract String whoami();
-  
+
   /**
    * Retrieves a TableOperations object to perform table functions, such as create and delete.
    * 
    * @return an object to manipulate tables
    */
   public abstract TableOperations tableOperations();
-  
+
   /**
-   * Retrieves a TableNamespaceOperations object to perform table namespace functions, such as create and delete.
+   * Retrieves a NamespaceOperations object to perform namespace functions, such as create and delete.
    * 
-   * @return an object to manipulate table namespaces
+   * @return an object to manipulate namespaces
    */
-  public abstract TableNamespaceOperations tableNamespaceOperations();
-  
+  public abstract NamespaceOperations namespaceOperations();
+
   /**
    * Retrieves a SecurityOperations object to perform user security operations, such as creating users.
    * 
    * @return an object to modify users and permissions
    */
   public abstract SecurityOperations securityOperations();
-  
+
   /**
    * Retrieves an InstanceOperations object to modify instance configuration.
    * 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea8ec193/core/src/main/java/org/apache/accumulo/core/client/NamespaceExistsException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/NamespaceExistsException.java b/core/src/main/java/org/apache/accumulo/core/client/NamespaceExistsException.java
new file mode 100644
index 0000000..d2cb607
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/client/NamespaceExistsException.java
@@ -0,0 +1,67 @@
+/*
+ * 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.client;
+
+import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
+
+/**
+ * Thrown when the namespace specified already exists, and it was expected that it didn't
+ */
+public class NamespaceExistsException extends Exception {
+  /**
+   * Exception to throw if an operation is attempted on a namespace that already exists.
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * @param namespaceId
+   *          the internal id of the namespace that exists
+   * @param namespaceName
+   *          the visible name of the namespace that exists
+   * @param description
+   *          the specific reason why it failed
+   */
+  public NamespaceExistsException(String namespaceId, String namespaceName, String description) {
+    super("Namespace" + (namespaceName != null && !namespaceName.isEmpty() ? " " + namespaceName : "")
+        + (namespaceId != null && !namespaceId.isEmpty() ? " (Id=" + namespaceId + ")" : "") + " exists"
+        + (description != null && !description.isEmpty() ? " (" + description + ")" : ""));
+  }
+
+  /**
+   * @param namespaceId
+   *          the internal id of the namespace that exists
+   * @param namespaceName
+   *          the visible name of the namespace that exists
+   * @param description
+   *          the specific reason why it failed
+   * @param cause
+   *          the exception that caused this failure
+   */
+  public NamespaceExistsException(String namespaceId, String namespaceName, String description, Throwable cause) {
+    this(namespaceId, namespaceName, description);
+    super.initCause(cause);
+  }
+
+  /**
+   * @param e
+   *          constructs an exception from a thrift exception
+   */
+  public NamespaceExistsException(ThriftTableOperationException e) {
+    this(e.getTableId(), e.getTableName(), e.getDescription(), e);
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea8ec193/core/src/main/java/org/apache/accumulo/core/client/NamespaceNotEmptyException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/NamespaceNotEmptyException.java b/core/src/main/java/org/apache/accumulo/core/client/NamespaceNotEmptyException.java
new file mode 100644
index 0000000..d5542bf
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/client/NamespaceNotEmptyException.java
@@ -0,0 +1,74 @@
+/*
+ * 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.client;
+
+import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
+
+/**
+ * Thrown when the namespace specified contains tables
+ */
+public class NamespaceNotEmptyException extends Exception {
+
+  private static final long serialVersionUID = 1L;
+
+  private String namespace;
+
+  /**
+   * @param namespaceId
+   *          the internal id of the namespace
+   * @param namespaceName
+   *          the visible name of the namespace
+   * @param description
+   *          the specific reason why it failed
+   */
+  public NamespaceNotEmptyException(String namespaceId, String namespaceName, String description) {
+    super("Namespace" + (namespaceName != null && !namespaceName.isEmpty() ? " " + namespaceName : "")
+        + (namespaceId != null && !namespaceId.isEmpty() ? " (Id=" + namespaceId + ")" : "") + " it not empty, contains at least one table"
+        + (description != null && !description.isEmpty() ? " (" + description + ")" : ""));
+    this.namespace = namespaceName;
+  }
+
+  /**
+   * @param namespaceId
+   *          the internal id of the namespace
+   * @param namespaceName
+   *          the visible name of the namespace
+   * @param description
+   *          the specific reason why it failed
+   * @param cause
+   *          the exception that caused this failure
+   */
+  public NamespaceNotEmptyException(String namespaceId, String namespaceName, String description, Throwable cause) {
+    this(namespaceId, namespaceName, description);
+    super.initCause(cause);
+  }
+
+  /**
+   * @param e
+   *          constructs an exception from a thrift exception
+   */
+  public NamespaceNotEmptyException(ThriftTableOperationException e) {
+    this(e.getTableId(), e.getTableName(), e.getDescription(), e);
+  }
+
+  /**
+   * @return the name of the namespace
+   */
+  public String getNamespaceName() {
+    return namespace;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea8ec193/core/src/main/java/org/apache/accumulo/core/client/NamespaceNotFoundException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/NamespaceNotFoundException.java b/core/src/main/java/org/apache/accumulo/core/client/NamespaceNotFoundException.java
new file mode 100644
index 0000000..031cf16
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/client/NamespaceNotFoundException.java
@@ -0,0 +1,77 @@
+/*
+ * 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.client;
+
+import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
+
+/**
+ * Thrown when the namespace specified doesn't exist when it was expected to
+ */
+public class NamespaceNotFoundException extends Exception {
+  /**
+   * Exception to throw if an operation is attempted on a namespace that doesn't exist.
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  private String namespace;
+
+  /**
+   * @param namespaceId
+   *          the internal id of the namespace that was sought
+   * @param namespaceName
+   *          the visible name of the namespace that was sought
+   * @param description
+   *          the specific reason why it failed
+   */
+  public NamespaceNotFoundException(String namespaceId, String namespaceName, String description) {
+    super("Namespace" + (namespaceName != null && !namespaceName.isEmpty() ? " " + namespaceName : "")
+        + (namespaceId != null && !namespaceId.isEmpty() ? " (Id=" + namespaceId + ")" : "") + " does not exist"
+        + (description != null && !description.isEmpty() ? " (" + description + ")" : ""));
+    this.namespace = namespaceName;
+  }
+
+  /**
+   * @param namespaceId
+   *          the internal id of the namespace that was sought
+   * @param namespaceName
+   *          the visible name of the namespace that was sought
+   * @param description
+   *          the specific reason why it failed
+   * @param cause
+   *          the exception that caused this failure
+   */
+  public NamespaceNotFoundException(String namespaceId, String namespaceName, String description, Throwable cause) {
+    this(namespaceId, namespaceName, description);
+    super.initCause(cause);
+  }
+
+  /**
+   * @param e
+   *          constructs an exception from a thrift exception
+   */
+  public NamespaceNotFoundException(ThriftTableOperationException e) {
+    this(e.getTableId(), e.getTableName(), e.getDescription(), e);
+  }
+
+  /**
+   * @return the name of the namespace sought
+   */
+  public String getNamespaceName() {
+    return namespace;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea8ec193/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceExistsException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceExistsException.java b/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceExistsException.java
deleted file mode 100644
index c6a8591..0000000
--- a/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceExistsException.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.client;
-
-import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
-
-/**
- * Thrown when the table namespace specified already exists, and it was expected that it didn't
- */
-public class TableNamespaceExistsException extends Exception {
-  /**
-   * Exception to throw if an operation is attempted on a table namespace that already exists.
-   * 
-   */
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * @param namespaceId
-   *          the internal id of the table namespace that exists
-   * @param namespaceName
-   *          the visible name of the table namespace that exists
-   * @param description
-   *          the specific reason why it failed
-   */
-  public TableNamespaceExistsException(String namespaceId, String namespaceName, String description) {
-    super("Table namespace" + (namespaceName != null && !namespaceName.isEmpty() ? " " + namespaceName : "")
-        + (namespaceId != null && !namespaceId.isEmpty() ? " (Id=" + namespaceId + ")" : "") + " exists"
-        + (description != null && !description.isEmpty() ? " (" + description + ")" : ""));
-  }
-
-  /**
-   * @param namespaceId
-   *          the internal id of the table namespace that exists
-   * @param namespaceName
-   *          the visible name of the table namespace that exists
-   * @param description
-   *          the specific reason why it failed
-   * @param cause
-   *          the exception that caused this failure
-   */
-  public TableNamespaceExistsException(String namespaceId, String namespaceName, String description, Throwable cause) {
-    this(namespaceId, namespaceName, description);
-    super.initCause(cause);
-  }
-
-  /**
-   * @param e
-   *          constructs an exception from a thrift exception
-   */
-  public TableNamespaceExistsException(ThriftTableOperationException e) {
-    this(e.getTableId(), e.getTableName(), e.getDescription(), e);
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea8ec193/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceNotEmptyException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceNotEmptyException.java b/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceNotEmptyException.java
deleted file mode 100644
index 04195e3..0000000
--- a/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceNotEmptyException.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.client;
-
-import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
-
-/**
- * Thrown when the table namespace specified contains tables
- */
-public class TableNamespaceNotEmptyException extends Exception {
-
-  private static final long serialVersionUID = 1L;
-
-  private String namespace;
-
-  /**
-   * @param namespaceId
-   *          the internal id of the table namespace
-   * @param namespaceName
-   *          the visible name of the table namespace
-   * @param description
-   *          the specific reason why it failed
-   */
-  public TableNamespaceNotEmptyException(String namespaceId, String namespaceName, String description) {
-    super("Table namespace" + (namespaceName != null && !namespaceName.isEmpty() ? " " + namespaceName : "")
-        + (namespaceId != null && !namespaceId.isEmpty() ? " (Id=" + namespaceId + ")" : "") + " it not empty, contains at least one table"
-        + (description != null && !description.isEmpty() ? " (" + description + ")" : ""));
-    this.namespace = namespaceName;
-  }
-
-  /**
-   * @param namespaceId
-   *          the internal id of the table namespace
-   * @param namespaceName
-   *          the visible name of the table namespace
-   * @param description
-   *          the specific reason why it failed
-   * @param cause
-   *          the exception that caused this failure
-   */
-  public TableNamespaceNotEmptyException(String namespaceId, String namespaceName, String description, Throwable cause) {
-    this(namespaceId, namespaceName, description);
-    super.initCause(cause);
-  }
-
-  /**
-   * @param e
-   *          constructs an exception from a thrift exception
-   */
-  public TableNamespaceNotEmptyException(ThriftTableOperationException e) {
-    this(e.getTableId(), e.getTableName(), e.getDescription(), e);
-  }
-
-  /**
-   * @return the name of the table namespace
-   */
-  public String getNamespaceName() {
-    return namespace;
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea8ec193/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceNotFoundException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceNotFoundException.java b/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceNotFoundException.java
deleted file mode 100644
index c4db89b..0000000
--- a/core/src/main/java/org/apache/accumulo/core/client/TableNamespaceNotFoundException.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.client;
-
-import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
-
-/**
- * Thrown when the table namespace specified doesn't exist when it was expected to
- */
-public class TableNamespaceNotFoundException extends Exception {
-  /**
-   * Exception to throw if an operation is attempted on a table namespace that doesn't exist.
-   * 
-   */
-  private static final long serialVersionUID = 1L;
-
-  private String namespace;
-
-  /**
-   * @param namespaceId
-   *          the internal id of the table namespace that was sought
-   * @param namespaceName
-   *          the visible name of the table namespace that was sought
-   * @param description
-   *          the specific reason why it failed
-   */
-  public TableNamespaceNotFoundException(String namespaceId, String namespaceName, String description) {
-    super("Table namespace" + (namespaceName != null && !namespaceName.isEmpty() ? " " + namespaceName : "")
-        + (namespaceId != null && !namespaceId.isEmpty() ? " (Id=" + namespaceId + ")" : "") + " does not exist"
-        + (description != null && !description.isEmpty() ? " (" + description + ")" : ""));
-    this.namespace = namespaceName;
-  }
-
-  /**
-   * @param namespaceId
-   *          the internal id of the table namespace that was sought
-   * @param namespaceName
-   *          the visible name of the table namespace that was sought
-   * @param description
-   *          the specific reason why it failed
-   * @param cause
-   *          the exception that caused this failure
-   */
-  public TableNamespaceNotFoundException(String namespaceId, String namespaceName, String description, Throwable cause) {
-    this(namespaceId, namespaceName, description);
-    super.initCause(cause);
-  }
-
-  /**
-   * @param e
-   *          constructs an exception from a thrift exception
-   */
-  public TableNamespaceNotFoundException(ThriftTableOperationException e) {
-    this(e.getTableId(), e.getTableName(), e.getDescription(), e);
-  }
-
-  /**
-   * @return the name of the table namespace sought
-   */
-  public String getNamespaceName() {
-    return namespace;
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea8ec193/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperations.java b/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperations.java
new file mode 100644
index 0000000..c82b42e
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperations.java
@@ -0,0 +1,401 @@
+/*
+ * 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.client.admin;
+
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.SortedSet;
+
+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.NamespaceExistsException;
+import org.apache.accumulo.core.client.NamespaceNotEmptyException;
+import org.apache.accumulo.core.client.NamespaceNotFoundException;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
+
+/**
+ * Provides a class for administering namespaces
+ * 
+ */
+
+public interface NamespaceOperations {
+
+  /**
+   * Retrieve a list of namespaces in Accumulo.
+   * 
+   * @return List of namespaces in accumulo
+   */
+  public SortedSet<String> list();
+
+  /**
+   * A method to check if a namespace exists in Accumulo.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @return true if the namespace exists
+   */
+  public boolean exists(String namespace);
+
+  /**
+   * Create a namespace with no special configuration
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @throws AccumuloException
+   *           if a general error occurs
+   * @throws AccumuloSecurityException
+   *           if the user does not have permission
+   * @throws NamespaceExistsException
+   *           if the namespace already exists
+   */
+  public void create(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException;
+
+  /**
+   * @param namespace
+   *          the name of the namespace
+   * @param limitVersion
+   *          Enables/disables the versioning iterator, which will limit the number of Key versions kept.
+   * @throws AccumuloException
+   *           if a general error occurs
+   * @throws AccumuloSecurityException
+   *           if the user does not have permission
+   * @throws NamespaceExistsException
+   *           if the namespace already exists
+   */
+  public void create(String namespace, boolean limitVersion) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException;
+
+  /**
+   * @param namespace
+   *          the name of the namespace
+   * @param versioningIter
+   *          Enables/disables the versioning iterator, which will limit the number of Key versions kept.
+   * @param timeType
+   *          specifies logical or real-time based time recording for entries in the table
+   * @throws AccumuloException
+   *           if a general error occurs
+   * @throws AccumuloSecurityException
+   *           if the user does not have permission
+   * @throws NamespaceExistsException
+   *           if the namespace already exists
+   */
+  public void create(String namespace, boolean versioningIter, TimeType timeType) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException;
+
+  /**
+   * Delete a namespace if it is empty
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @throws AccumuloException
+   *           if a general error occurs
+   * @throws AccumuloSecurityException
+   *           if the user does not have permission
+   * @throws NamespaceNotFoundException
+   *           if the namespace does not exist
+   * @throws NamespaceNotEmptyException
+   *           if the namespaces still contains tables
+   * @throws TableNotFoundException
+   *           if table not found while deleting
+   */
+  public void delete(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException, NamespaceNotEmptyException,
+      TableNotFoundException;
+
+  /**
+   * Delete a namespace
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @param deleteTables
+   *          boolean, if true deletes all the tables in the namespace in addition to deleting the namespace.
+   * @throws AccumuloException
+   *           if a general error occurs
+   * @throws AccumuloSecurityException
+   *           if the user does not have permission
+   * @throws NamespaceNotFoundException
+   *           if the namespace does not exist
+   * @throws NamespaceNotEmptyException
+   *           if the namespaces still contains tables
+   * @throws TableNotFoundException
+   *           if table not found while deleting
+   */
+  public void delete(String namespace, boolean deleteTables) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException,
+      NamespaceNotEmptyException, TableNotFoundException;
+
+  /**
+   * Rename a namespace
+   * 
+   * @param oldNamespaceName
+   *          the old namespace name
+   * @param newNamespaceName
+   *          the new namespace name
+   * @throws AccumuloException
+   *           if a general error occurs
+   * @throws AccumuloSecurityException
+   *           if the user does not have permission
+   * @throws NamespaceNotFoundException
+   *           if the old namespace does not exist
+   * @throws NamespaceExistsException
+   *           if the new namespace already exists
+   */
+  public void rename(String oldNamespaceName, String newNamespaceName) throws AccumuloSecurityException, NamespaceNotFoundException, AccumuloException,
+      NamespaceExistsException;
+
+  /**
+   * Sets a property on a namespace which applies to all tables in the namespace. Note that it may take a short period of time (a second) to propagate the
+   * change everywhere.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @param property
+   *          the name of a per-table property
+   * @param value
+   *          the value to set a per-table property to
+   * @throws AccumuloException
+   *           if a general error occurs
+   * @throws AccumuloSecurityException
+   *           if the user does not have permission
+   */
+  public void setProperty(String namespace, String property, String value) throws AccumuloException, AccumuloSecurityException;
+
+  /**
+   * Removes a property from a namespace. Note that it may take a short period of time (a second) to propagate the change everywhere.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @param property
+   *          the name of a per-table property
+   * @throws AccumuloException
+   *           if a general error occurs
+   * @throws AccumuloSecurityException
+   *           if the user does not have permission
+   */
+  public void removeProperty(String namespace, String property) throws AccumuloException, AccumuloSecurityException;
+
+  /**
+   * Gets properties of a namespace. Note that recently changed properties may not be available immediately.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @return all properties visible by this table (system and per-table properties). Note that recently changed properties may not be visible immediately.
+   * @throws NamespaceNotFoundException
+   *           if the namespace does not exist
+   */
+  public Iterable<Entry<String,String>> getProperties(String namespace) throws AccumuloException, NamespaceNotFoundException;
+
+  /**
+   * 
+   * @param namespace
+   *          the namespace to take offline
+   * @throws AccumuloException
+   *           when there is a general accumulo error
+   * @throws AccumuloSecurityException
+   *           when the user does not have the proper permissions
+   * @throws NamespaceNotFoundException
+   *           if the namespace does not exist
+   */
+  public void offline(String namespace) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException;
+
+  /**
+   * 
+   * @param namespace
+   *          the namespace to take online
+   * @throws AccumuloException
+   *           when there is a general accumulo error
+   * @throws AccumuloSecurityException
+   *           when the user does not have the proper permissions
+   * @throws NamespaceNotFoundException
+   *           if the namespace does not exist
+   */
+  public void online(String namespace) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException;
+
+  /**
+   * Get a mapping of namespace name to internal namespace id.
+   * 
+   * @return the map from namespace name to internal namespace id
+   */
+  public Map<String,String> namespaceIdMap();
+
+  /**
+   * Gets the number of bytes being used in the files for the set of tables in this namespace
+   * 
+   * @param namespace
+   *          the namespace to get the set of tables from
+   * 
+   * @return a list of disk usage objects containing linked table names and sizes
+   * @throws AccumuloException
+   *           when there is a general accumulo error
+   * @throws AccumuloSecurityException
+   *           when the user does not have the proper permissions
+   */
+  public List<DiskUsage> getDiskUsage(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException;
+
+  /**
+   * Add an iterator to a namespace on all scopes.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @param setting
+   *          object specifying the properties of the iterator
+   * @throws AccumuloSecurityException
+   *           thrown if the user does not have the ability to set properties on the namespace
+   * @throws AccumuloException
+   * @throws NamespaceNotFoundException
+   *           throw if the namespace no longer exists
+   * @throws IllegalArgumentException
+   *           if the setting conflicts with any existing iterators
+   */
+  public void attachIterator(String namespace, IteratorSetting setting) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException;
+
+  /**
+   * Add an iterator to a namespace on the given scopes.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @param setting
+   *          object specifying the properties of the iterator
+   * @throws AccumuloSecurityException
+   *           thrown if the user does not have the ability to set properties on the namespace
+   * @throws AccumuloException
+   * @throws NamespaceNotFoundException
+   *           throw if the namespace no longer exists
+   * @throws IllegalArgumentException
+   *           if the setting conflicts with any existing iterators
+   */
+  public void attachIterator(String namespace, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
+      NamespaceNotFoundException;
+
+  /**
+   * Remove an iterator from a namespace by name.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @param name
+   *          the name of the iterator
+   * @param scopes
+   *          the scopes of the iterator
+   * @throws AccumuloSecurityException
+   *           thrown if the user does not have the ability to set properties on the namespace
+   * @throws AccumuloException
+   * @throws NamespaceNotFoundException
+   *           thrown if the namespace no longer exists
+   */
+  public void removeIterator(String namespace, String name, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
+      NamespaceNotFoundException;
+
+  /**
+   * Get the settings for an iterator.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @param name
+   *          the name of the iterator
+   * @param scope
+   *          the scope of the iterator
+   * @return the settings for this iterator
+   * @throws AccumuloSecurityException
+   *           thrown if the user does not have the ability to set properties on the namespace
+   * @throws AccumuloException
+   * @throws NamespaceNotFoundException
+   *           thrown if the namespace no longer exists
+   */
+  public IteratorSetting getIteratorSetting(String namespace, String name, IteratorScope scope) throws AccumuloSecurityException, AccumuloException,
+      NumberFormatException, NamespaceNotFoundException;
+
+  /**
+   * Get a list of iterators for this namespace.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @return a set of iterator names
+   * @throws AccumuloSecurityException
+   *           thrown if the user does not have the ability to set properties on the namespace
+   * @throws AccumuloException
+   * @throws NamespaceNotFoundException
+   *           thrown if the namespace no longer exists
+   */
+  public Map<String,EnumSet<IteratorScope>> listIterators(String namespace) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException;
+
+  /**
+   * Check whether a given iterator configuration conflicts with existing configuration; in particular, determine if the name or priority are already in use for
+   * the specified scopes.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @param setting
+   *          object specifying the properties of the iterator
+   * @throws AccumuloException
+   * @throws NamespaceNotFoundException
+   *           thrown if the namespace no longer exists
+   * @throws IllegalStateException
+   *           if the setting conflicts with any existing iterators
+   */
+  public void checkIteratorConflicts(String namespace, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException,
+      NamespaceNotFoundException;
+
+  /**
+   * Add a new constraint to a namespace.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @param constraintClassName
+   *          the full name of the constraint class
+   * @return the unique number assigned to the constraint
+   * @throws AccumuloException
+   *           thrown if the constraint has already been added to the table or if there are errors in the configuration of existing constraints
+   * @throws AccumuloSecurityException
+   *           thrown if the user doesn't have permission to add the constraint
+   * @throws NamespaceNotFoundException
+   *           thrown if the namespace no longer exists
+   */
+  public int addConstraint(String namespace, String constraintClassName) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException;
+
+  /**
+   * Remove a constraint from a namespace.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @param number
+   *          the unique number assigned to the constraint
+   * @throws AccumuloException
+   * @throws AccumuloSecurityException
+   *           thrown if the user doesn't have permission to remove the constraint
+   */
+  public void removeConstraint(String namespace, int number) throws AccumuloException, AccumuloSecurityException;
+
+  /**
+   * List constraints on a namespace with their assigned numbers.
+   * 
+   * @param namespace
+   *          the name of the namespace
+   * @return a map from constraint class name to assigned number
+   * @throws AccumuloException
+   *           thrown if there are errors in the configuration of existing constraints
+   * @throws NamespaceNotFoundException
+   *           thrown if the namespace no longer exists
+   */
+  public Map<String,Integer> listConstraints(String namespace) throws AccumuloException, NamespaceNotFoundException;
+
+  /**
+   * Test to see if the instance can load the given class as the given type. This check uses the table classpath property if it is set.
+   * 
+   * @return true if the instance can load the given class as the given type, false otherwise
+   */
+  boolean testClassLoad(String namespace, String className, String asTypeName) throws NamespaceNotFoundException, AccumuloException, AccumuloSecurityException;
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea8ec193/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsHelper.java b/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsHelper.java
new file mode 100644
index 0000000..007461f
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/NamespaceOperationsHelper.java
@@ -0,0 +1,203 @@
+/*
+ * 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.client.admin;
+
+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.NamespaceNotFoundException;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
+
+public abstract class NamespaceOperationsHelper implements NamespaceOperations {
+
+  @Override
+  public void attachIterator(String namespace, IteratorSetting setting) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException {
+    attachIterator(namespace, setting, EnumSet.allOf(IteratorScope.class));
+  }
+
+  @Override
+  public void attachIterator(String namespace, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
+      NamespaceNotFoundException {
+    checkIteratorConflicts(namespace, 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(namespace, root + ".opt." + prop.getKey(), prop.getValue());
+      }
+      this.setProperty(namespace, root, setting.getPriority() + "," + setting.getIteratorClass());
+    }
+  }
+
+  @Override
+  public void removeIterator(String namespace, String name, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
+      NamespaceNotFoundException {
+    if (!exists(namespace))
+      throw new NamespaceNotFoundException(null, namespace, null);
+    Map<String,String> copy = new TreeMap<String,String>();
+    for (Entry<String,String> property : this.getProperties(namespace)) {
+      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(namespace, property.getKey());
+      }
+    }
+  }
+
+  @Override
+  public IteratorSetting getIteratorSetting(String namespace, String name, IteratorScope scope) throws AccumuloSecurityException, AccumuloException,
+      NamespaceNotFoundException {
+    if (!exists(namespace))
+      throw new NamespaceNotFoundException(null, namespace, 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(namespace)) {
+      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 namespace) throws AccumuloSecurityException, AccumuloException, NamespaceNotFoundException {
+    if (!exists(namespace))
+      throw new NamespaceNotFoundException(null, namespace, null);
+    Map<String,EnumSet<IteratorScope>> result = new TreeMap<String,EnumSet<IteratorScope>>();
+    for (Entry<String,String> property : this.getProperties(namespace)) {
+      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 namespace, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException,
+      NamespaceNotFoundException {
+    if (!exists(namespace))
+      throw new NamespaceNotFoundException(null, namespace, 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(namespace)) {
+        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 namespace, String constraintClassName) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException {
+    TreeSet<Integer> constraintNumbers = new TreeSet<Integer>();
+    TreeMap<String,Integer> constraintClasses = new TreeMap<String,Integer>();
+    int i;
+    for (Entry<String,String> property : this.getProperties(namespace)) {
+      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 namespace " + namespace + " with number "
+          + constraintClasses.get(constraintClassName));
+    this.setProperty(namespace, Property.TABLE_CONSTRAINT_PREFIX.toString() + i, constraintClassName);
+    return i;
+  }
+
+  @Override
+  public void removeConstraint(String namespace, int number) throws AccumuloException, AccumuloSecurityException {
+    this.removeProperty(namespace, Property.TABLE_CONSTRAINT_PREFIX.toString() + number);
+  }
+
+  @Override
+  public Map<String,Integer> listConstraints(String namespace) throws AccumuloException, NamespaceNotFoundException {
+    Map<String,Integer> constraints = new TreeMap<String,Integer>();
+    for (Entry<String,String> property : this.getProperties(namespace)) {
+      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;
+  }
+}