accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [2/6] git commit: ACCUMULO-2114 Move built-in namespace names to a method
Date Thu, 06 Feb 2014 00:30:29 GMT
ACCUMULO-2114 Move built-in namespace names to a method


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

Branch: refs/heads/master
Commit: 7f789ecbdcb902f9a14ddb2192ffa5a42bb2787b
Parents: 7820120
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Wed Feb 5 15:53:08 2014 -0500
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Wed Feb 5 15:53:08 2014 -0500

----------------------------------------------------------------------
 .../accumulo/core/client/ClientConstants.java   | 22 -------------------
 .../core/client/admin/NamespaceOperations.java  | 23 ++++++++++++++++----
 .../client/admin/NamespaceOperationsHelper.java | 11 ++++++++++
 .../accumulo/core/client/impl/Namespaces.java   |  3 +--
 .../org/apache/accumulo/test/NamespacesIT.java  |  8 ++++++-
 5 files changed, 38 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/7f789ecb/core/src/main/java/org/apache/accumulo/core/client/ClientConstants.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/ClientConstants.java b/core/src/main/java/org/apache/accumulo/core/client/ClientConstants.java
deleted file mode 100644
index 4514e82..0000000
--- a/core/src/main/java/org/apache/accumulo/core/client/ClientConstants.java
+++ /dev/null
@@ -1,22 +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;
-
-
-public class ClientConstants {
-  public static final String DEFAULT_NAMESPACE = "";
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7f789ecb/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
index 269e563..c6dff92 100644
--- 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
@@ -40,6 +40,22 @@ import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
 public interface NamespaceOperations {
 
   /**
+   * Returns the name of the system reserved namespace
+   * 
+   * @return the name of the system namespace
+   * @since 1.6.0
+   */
+  String systemNamespace();
+
+  /**
+   * Returns the name of the default namespace
+   * 
+   * @return the name of the default namespace
+   * @since 1.6.0
+   */
+  String defaultNamespace();
+
+  /**
    * Retrieve a list of namespaces in Accumulo.
    * 
    * @return List of namespaces in accumulo
@@ -293,8 +309,8 @@ public interface NamespaceOperations {
    *           if the specified namespace doesn't exist
    * @since 1.6.0
    */
-  void checkIteratorConflicts(String namespace, IteratorSetting setting, EnumSet<IteratorScope>
scopes) throws AccumuloException,
-      AccumuloSecurityException, NamespaceNotFoundException;
+  void checkIteratorConflicts(String namespace, IteratorSetting setting, EnumSet<IteratorScope>
scopes) throws AccumuloException, AccumuloSecurityException,
+      NamespaceNotFoundException;
 
   /**
    * Add a new constraint to a namespace.
@@ -365,6 +381,5 @@ public interface NamespaceOperations {
    *           if the specified namespace doesn't exist
    * @since 1.6.0
    */
-  boolean testClassLoad(String namespace, String className, String asTypeName) throws AccumuloException,
AccumuloSecurityException,
-      NamespaceNotFoundException;
+  boolean testClassLoad(String namespace, String className, String asTypeName) throws AccumuloException,
AccumuloSecurityException, NamespaceNotFoundException;
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7f789ecb/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
index 7ecc4e3..b9a7791 100644
--- 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
@@ -27,12 +27,23 @@ 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.client.impl.Namespaces;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
 
 public abstract class NamespaceOperationsHelper implements NamespaceOperations {
 
   @Override
+  public String systemNamespace() {
+    return Namespaces.ACCUMULO_NAMESPACE;
+  }
+
+  @Override
+  public String defaultNamespace() {
+    return Namespaces.DEFAULT_NAMESPACE;
+  }
+
+  @Override
   public void attachIterator(String namespace, IteratorSetting setting) throws AccumuloSecurityException,
AccumuloException, NamespaceNotFoundException {
     attachIterator(namespace, setting, EnumSet.allOf(IteratorScope.class));
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7f789ecb/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
index 4161b12..c134c04 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
@@ -24,7 +24,6 @@ import java.util.SortedMap;
 import java.util.TreeMap;
 
 import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.ClientConstants;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.NamespaceNotFoundException;
 import org.apache.accumulo.core.util.ArgumentChecker.Validator;
@@ -74,7 +73,7 @@ public class Namespaces {
   private static SecurityPermission TABLES_PERMISSION = new SecurityPermission("tablesPermission");
 
   public static final String DEFAULT_NAMESPACE_ID = "+default";
-  public static final String DEFAULT_NAMESPACE = ClientConstants.DEFAULT_NAMESPACE;
+  public static final String DEFAULT_NAMESPACE = "";
   public static final String ACCUMULO_NAMESPACE_ID = "+accumulo";
   public static final String ACCUMULO_NAMESPACE = "accumulo";
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7f789ecb/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
index 3ea16c5..313b0ce 100644
--- a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
@@ -108,6 +108,12 @@ public class NamespacesIT extends SimpleMacIT {
   }
 
   @Test
+  public void checkReservedNamespaces() throws Exception {
+    assertEquals(c.namespaceOperations().defaultNamespace(), Namespaces.DEFAULT_NAMESPACE);
+    assertEquals(c.namespaceOperations().systemNamespace(), Namespaces.ACCUMULO_NAMESPACE);
+  }
+
+  @Test
   public void checkBuiltInNamespaces() throws Exception {
     assertTrue(c.namespaceOperations().exists(Namespaces.DEFAULT_NAMESPACE));
     assertTrue(c.namespaceOperations().exists(Namespaces.ACCUMULO_NAMESPACE));
@@ -553,7 +559,7 @@ public class NamespacesIT extends SimpleMacIT {
     c.securityOperations().createLocalUser(u1, pass);
 
     Connector user1Con = c.getInstance().getConnector(u1, pass);
-    
+
     try {
       user1Con.tableOperations().create(t2);
       fail();


Mime
View raw message