org.apache.accumulo.core.client.impl
Class NamespaceOperationsImpl

java.lang.Object
  extended by org.apache.accumulo.core.client.impl.NamespaceOperationsHelper
      extended by org.apache.accumulo.core.client.impl.NamespaceOperationsImpl
All Implemented Interfaces:
NamespaceOperations

public class NamespaceOperationsImpl
extends NamespaceOperationsHelper


Constructor Summary
NamespaceOperationsImpl(Instance instance, Credentials credentials, TableOperationsImpl tableOps)
           
 
Method Summary
 int addConstraint(String namespace, String constraintClassName)
          Add a new constraint to a namespace.
 void attachIterator(String namespace, IteratorSetting setting, EnumSet<IteratorUtil.IteratorScope> scopes)
          Add an iterator to a namespace on the given scopes.
 void create(String namespace)
          Create an empty namespace with no initial configuration.
 void delete(String namespace)
          Delete an empty namespace
 boolean exists(String namespace)
          A method to check if a namespace exists in Accumulo.
 Iterable<Map.Entry<String,String>> getProperties(String namespace)
          Gets properties of a namespace, which are inherited by tables in this namespace.
 SortedSet<String> list()
          Retrieve a list of namespaces in Accumulo.
 Map<String,String> namespaceIdMap()
          Get a mapping of namespace name to internal namespace id.
 void removeProperty(String namespace, String property)
          Removes a property from a namespace.
 void rename(String oldNamespaceName, String newNamespaceName)
          Rename a namespace
 void setProperty(String namespace, String property, String value)
          Sets a property on a namespace which applies to all tables in the namespace.
 boolean testClassLoad(String namespace, String className, String asTypeName)
          Test to see if the instance can load the given class as the given type.
 
Methods inherited from class org.apache.accumulo.core.client.impl.NamespaceOperationsHelper
attachIterator, checkIteratorConflicts, defaultNamespace, getIteratorSetting, listConstraints, listIterators, removeConstraint, removeIterator, systemNamespace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamespaceOperationsImpl

public NamespaceOperationsImpl(Instance instance,
                               Credentials credentials,
                               TableOperationsImpl tableOps)
Method Detail

list

public SortedSet<String> list()
Description copied from interface: NamespaceOperations
Retrieve a list of namespaces in Accumulo.

Returns:
List of namespaces in accumulo

exists

public boolean exists(String namespace)
Description copied from interface: NamespaceOperations
A method to check if a namespace exists in Accumulo.

Parameters:
namespace - the name of the namespace
Returns:
true if the namespace exists

create

public void create(String namespace)
            throws AccumuloException,
                   AccumuloSecurityException,
                   NamespaceExistsException
Description copied from interface: NamespaceOperations
Create an empty namespace with no initial configuration. Valid names for a namespace contain letters, numbers, and the underscore character.

Parameters:
namespace - the name of the namespace
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission
NamespaceExistsException - if the specified namespace already exists

delete

public void delete(String namespace)
            throws AccumuloException,
                   AccumuloSecurityException,
                   NamespaceNotFoundException,
                   NamespaceNotEmptyException
Description copied from interface: NamespaceOperations
Delete an empty namespace

Parameters:
namespace - the name of the namespace
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission
NamespaceNotFoundException - if the specified namespace doesn't exist
NamespaceNotEmptyException - if the namespaces still contains tables

rename

public void rename(String oldNamespaceName,
                   String newNamespaceName)
            throws AccumuloSecurityException,
                   NamespaceNotFoundException,
                   AccumuloException,
                   NamespaceExistsException
Description copied from interface: NamespaceOperations
Rename a namespace

Parameters:
oldNamespaceName - the old namespace name
newNamespaceName - the new namespace name
Throws:
AccumuloSecurityException - if the user does not have permission
NamespaceNotFoundException - if the old namespace does not exist
AccumuloException - if a general error occurs
NamespaceExistsException - if the new namespace already exists

setProperty

public void setProperty(String namespace,
                        String property,
                        String value)
                 throws AccumuloException,
                        AccumuloSecurityException,
                        NamespaceNotFoundException
Description copied from interface: NamespaceOperations
Sets a property on a namespace which applies to all tables in the namespace. Note that it may take a few seconds to propagate the change everywhere.

Parameters:
namespace - the name of the namespace
property - the name of a per-table property
value - the value to set a per-table property to
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission
NamespaceNotFoundException - if the specified namespace doesn't exist

removeProperty

public void removeProperty(String namespace,
                           String property)
                    throws AccumuloException,
                           AccumuloSecurityException,
                           NamespaceNotFoundException
Description copied from interface: NamespaceOperations
Removes a property from a namespace. Note that it may take a few seconds to propagate the change everywhere.

Parameters:
namespace - the name of the namespace
property - the name of a per-table property
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission
NamespaceNotFoundException - if the specified namespace doesn't exist

getProperties

public Iterable<Map.Entry<String,String>> getProperties(String namespace)
                                                 throws AccumuloException,
                                                        NamespaceNotFoundException
Description copied from interface: NamespaceOperations
Gets properties of a namespace, which are inherited by tables in this namespace. Note that recently changed properties may not be available immediately.

Parameters:
namespace - the name of the namespace
Returns:
all properties visible by this namespace (system and per-table properties). Note that recently changed properties may not be visible immediately.
Throws:
AccumuloException - if a general error occurs
NamespaceNotFoundException - if the specified namespace doesn't exist

namespaceIdMap

public Map<String,String> namespaceIdMap()
Description copied from interface: NamespaceOperations
Get a mapping of namespace name to internal namespace id.

Returns:
the map from namespace name to internal namespace id

testClassLoad

public boolean testClassLoad(String namespace,
                             String className,
                             String asTypeName)
                      throws NamespaceNotFoundException,
                             AccumuloException,
                             AccumuloSecurityException
Description copied from interface: NamespaceOperations
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.

Parameters:
namespace - the name of the namespace
className - the class to try to load
asTypeName - the interface or superclass the given class is attempted to load as
Returns:
true if the instance can load the given class as the given type, false otherwise
Throws:
NamespaceNotFoundException - if the specified namespace doesn't exist
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission

attachIterator

public void attachIterator(String namespace,
                           IteratorSetting setting,
                           EnumSet<IteratorUtil.IteratorScope> scopes)
                    throws AccumuloSecurityException,
                           AccumuloException,
                           NamespaceNotFoundException
Description copied from interface: NamespaceOperations
Add an iterator to a namespace on the given scopes.

Specified by:
attachIterator in interface NamespaceOperations
Overrides:
attachIterator in class NamespaceOperationsHelper
Parameters:
namespace - the name of the namespace
setting - object specifying the properties of the iterator
scopes - the set of scopes the iterator should apply to
Throws:
AccumuloSecurityException - if the user does not have permission
AccumuloException - if a general error occurs
NamespaceNotFoundException - if the specified namespace doesn't exist

addConstraint

public int addConstraint(String namespace,
                         String constraintClassName)
                  throws AccumuloException,
                         AccumuloSecurityException,
                         NamespaceNotFoundException
Description copied from interface: NamespaceOperations
Add a new constraint to a namespace.

Specified by:
addConstraint in interface NamespaceOperations
Overrides:
addConstraint in class NamespaceOperationsHelper
Parameters:
namespace - the name of the namespace
constraintClassName - the full name of the constraint class
Returns:
the unique id number assigned to the constraint
Throws:
AccumuloException - if a general error occurs
AccumuloSecurityException - if the user does not have permission
NamespaceNotFoundException - if the specified namespace doesn't exist


Copyright © 2015 Apache Accumulo Project. All rights reserved.