Class NamespaceOperationsImpl
- java.lang.Object
-
- org.apache.accumulo.core.clientImpl.NamespaceOperationsHelper
-
- org.apache.accumulo.core.clientImpl.NamespaceOperationsImpl
-
- All Implemented Interfaces:
NamespaceOperations
public class NamespaceOperationsImpl extends NamespaceOperationsHelper
-
-
Constructor Summary
Constructors Constructor Description NamespaceOperationsImpl(ClientContext context, TableOperationsImpl tableOps)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddConstraint(String namespace, String constraintClassName)Add a new constraint to a namespace.voidattachIterator(String namespace, IteratorSetting setting, EnumSet<IteratorUtil.IteratorScope> scopes)Add an iterator to a namespace on the given scopes.voidcreate(String namespace)Create an empty namespace with no initial configuration.voiddelete(String namespace)Delete an empty namespacebooleanexists(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.voidremoveProperty(String namespace, String property)Removes a property from a namespace.voidrename(String oldNamespaceName, String newNamespaceName)Rename a namespacevoidsetProperty(String namespace, String property, String value)Sets a property on a namespace which applies to all tables in the namespace.booleantestClassLoad(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.clientImpl.NamespaceOperationsHelper
attachIterator, checkIteratorConflicts, defaultNamespace, getIteratorSetting, listConstraints, listIterators, removeConstraint, removeIterator, systemNamespace
-
-
-
-
Constructor Detail
-
NamespaceOperationsImpl
public NamespaceOperationsImpl(ClientContext context, TableOperationsImpl tableOps)
-
-
Method Detail
-
list
public SortedSet<String> list()
Description copied from interface:NamespaceOperationsRetrieve a list of namespaces in Accumulo.- Returns:
- List of namespaces in accumulo
-
exists
public boolean exists(String namespace)
Description copied from interface:NamespaceOperationsA 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:NamespaceOperationsCreate an empty namespace with no initial configuration. Valid names for a namespace contain letters, numbers, and the underscore character. A safe way to ignore namespaces that do exist would be to do something like the following:try { connector.namespaceOperations().create("mynamespace"); } catch (NamespaceExistsException e) { // ignore or log }- Parameters:
namespace- the name of the namespace- Throws:
AccumuloException- if a general error occursAccumuloSecurityException- if the user does not have permissionNamespaceExistsException- if the specified namespace already exists
-
delete
public void delete(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException, NamespaceNotEmptyException
Description copied from interface:NamespaceOperationsDelete an empty namespace- Parameters:
namespace- the name of the namespace- Throws:
AccumuloException- if a general error occursAccumuloSecurityException- if the user does not have permissionNamespaceNotFoundException- if the specified namespace doesn't existNamespaceNotEmptyException- if the namespaces still contains tables
-
rename
public void rename(String oldNamespaceName, String newNamespaceName) throws AccumuloSecurityException, NamespaceNotFoundException, AccumuloException, NamespaceExistsException
Description copied from interface:NamespaceOperationsRename a namespace- Parameters:
oldNamespaceName- the old namespace namenewNamespaceName- the new namespace name- Throws:
AccumuloSecurityException- if the user does not have permissionNamespaceNotFoundException- if the old namespace does not existAccumuloException- if a general error occursNamespaceExistsException- if the new namespace already exists
-
setProperty
public void setProperty(String namespace, String property, String value) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException
Description copied from interface:NamespaceOperationsSets 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 namespaceproperty- the name of a per-table propertyvalue- the value to set a per-table property to- Throws:
AccumuloException- if a general error occursAccumuloSecurityException- if the user does not have permissionNamespaceNotFoundException- if the specified namespace doesn't exist
-
removeProperty
public void removeProperty(String namespace, String property) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException
Description copied from interface:NamespaceOperationsRemoves a property from a namespace. Note that it may take a few seconds to propagate the change everywhere.- Parameters:
namespace- the name of the namespaceproperty- the name of a per-table property- Throws:
AccumuloException- if a general error occursAccumuloSecurityException- if the user does not have permissionNamespaceNotFoundException- if the specified namespace doesn't exist
-
getProperties
public Iterable<Map.Entry<String,String>> getProperties(String namespace) throws AccumuloException, NamespaceNotFoundException
Description copied from interface:NamespaceOperationsGets 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 occursNamespaceNotFoundException- if the specified namespace doesn't exist
-
namespaceIdMap
public Map<String,String> namespaceIdMap()
Description copied from interface:NamespaceOperationsGet 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:NamespaceOperationsTest 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 namespaceclassName- the class to try to loadasTypeName- 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 existAccumuloException- if a general error occursAccumuloSecurityException- 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:NamespaceOperationsAdd an iterator to a namespace on the given scopes.- Specified by:
attachIteratorin interfaceNamespaceOperations- Overrides:
attachIteratorin classNamespaceOperationsHelper- Parameters:
namespace- the name of the namespacesetting- object specifying the properties of the iteratorscopes- the set of scopes the iterator should apply to- Throws:
AccumuloSecurityException- if the user does not have permissionAccumuloException- if a general error occursNamespaceNotFoundException- if the specified namespace doesn't exist
-
addConstraint
public int addConstraint(String namespace, String constraintClassName) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException
Description copied from interface:NamespaceOperationsAdd a new constraint to a namespace.- Specified by:
addConstraintin interfaceNamespaceOperations- Overrides:
addConstraintin classNamespaceOperationsHelper- Parameters:
namespace- the name of the namespaceconstraintClassName- the full name of the constraint class- Returns:
- the unique id number assigned to the constraint
- Throws:
AccumuloException- if a general error occursAccumuloSecurityException- if the user does not have permissionNamespaceNotFoundException- if the specified namespace doesn't exist
-
-