Interface NamespaceOperations
public interface NamespaceOperations
Provides an API for administering namespaces
 All tables exist in a namespace. The default namespace has no name, and is used if an explicit
 namespace is not specified. Fully qualified table names look like "namespaceName.tableName".
 Tables in the default namespace are fully qualified simply as "tableName".
- Since:
- 1.6.0
- 
Method SummaryModifier and TypeMethodDescriptionintaddConstraint(String namespace, String constraintClassName) Add a new constraint to a namespace.voidattachIterator(String namespace, IteratorSetting setting) Add an iterator to a namespace on all scopes.voidattachIterator(String namespace, IteratorSetting setting, EnumSet<IteratorUtil.IteratorScope> scopes) Add an iterator to a namespace on the given scopes.voidcheckIteratorConflicts(String namespace, IteratorSetting setting, EnumSet<IteratorUtil.IteratorScope> scopes) 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.voidCreate an empty namespace with no initial configuration.Returns the name of the default namespacevoidDelete an empty namespacebooleanA method to check if a namespace exists in Accumulo.getConfiguration(String namespace) Gets properties of a namespace, which are inherited by tables in this namespace.getIteratorSetting(String namespace, String name, IteratorUtil.IteratorScope scope) Get the settings for an iterator.getNamespaceProperties(String namespace) Gets properties specific to this namespace.getProperties(String namespace) Gets properties of a namespace, which are inherited by tables in this namespace.list()Retrieve a list of namespaces in Accumulo.listConstraints(String namespace) List constraints on a namespace with their assigned numbers.listIterators(String namespace) Get a list of iterators for this namespace.For a detailed overview of the behavior of this method seeInstanceOperations.modifyProperties(Consumer)which operates on a different layer of properties but has the same behavior and better documentation.Get a mapping of namespace name to internal namespace id.voidremoveConstraint(String namespace, int id) Remove a constraint from a namespace.voidremoveIterator(String namespace, String name, EnumSet<IteratorUtil.IteratorScope> scopes) Remove an iterator from a namespace by name.voidremoveProperty(String namespace, String property) Removes a property from a namespace.voidRename a namespacevoidsetProperty(String namespace, String property, String value) Sets a property on a namespace which applies to all tables in the namespace.Returns the name of the system reserved namespacebooleantestClassLoad(String namespace, String className, String asTypeName) Test to see if the instance can load the given class as the given type.
- 
Method Details- 
systemNamespaceString systemNamespace()Returns the name of the system reserved namespace- Returns:
- the name of the system namespace
- Since:
- 1.6.0
 
- 
defaultNamespaceString defaultNamespace()Returns the name of the default namespace- Returns:
- the name of the default namespace
- Since:
- 1.6.0
 
- 
listRetrieve a list of namespaces in Accumulo.- Returns:
- List of namespaces in accumulo
- Throws:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- Since:
- 1.6.0
 
- 
existsA method to check if a namespace exists in Accumulo.- Parameters:
- namespace- the name of the namespace
- Returns:
- true if the namespace exists
- Throws:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- Since:
- 1.6.0
 
- 
createvoid create(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceExistsException Create 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 occurs
- AccumuloSecurityException- if the user does not have permission
- NamespaceExistsException- if the specified namespace already exists
- Since:
- 1.6.0
 
- 
deletevoid delete(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException, NamespaceNotEmptyException 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
- Since:
- 1.6.0
 
- 
renamevoid rename(String oldNamespaceName, String newNamespaceName) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException, NamespaceExistsException Rename a namespace- Parameters:
- oldNamespaceName- the old namespace name
- newNamespaceName- the new namespace name
- Throws:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the old namespace does not exist
- NamespaceExistsException- if the new namespace already exists
- Since:
- 1.6.0
 
- 
setPropertyvoid setProperty(String namespace, String property, String value) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException 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
- Since:
- 1.6.0
 
- 
modifyPropertiesMap<String,String> modifyProperties(String namespace, Consumer<Map<String, String>> mapMutator) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundExceptionFor a detailed overview of the behavior of this method seeInstanceOperations.modifyProperties(Consumer)which operates on a different layer of properties but has the same behavior and better documentation.Accumulo has multiple layers of properties that for many APIs and SPIs are presented as a single merged view. This API does not offer that merged view, it only offers the properties set at this namespace's layer to the mapMutator. - Parameters:
- mapMutator- This consumer should modify the passed in snapshot of namespace properties to contain the desired keys and values. It should be safe for Accumulo to call this consumer multiple times, this may be done automatically when certain retryable errors happen. The consumer should probably avoid accessing the Accumulo client as that could lead to undefined behavior.
- Returns:
- The map that became Accumulo's new properties for this namespace. This map is immutable and contains the snapshot passed to mapMutator and the changes made by mapMutator.
- Throws:
- AccumuloException
- AccumuloSecurityException
- NamespaceNotFoundException
- Since:
- 2.1.0
 
- 
removePropertyvoid removeProperty(String namespace, String property) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException 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
- Since:
- 1.6.0
 
- 
getPropertiesdefault Iterable<Map.Entry<String,String>> getProperties(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException Gets properties of a namespace, which are inherited by tables in this namespace. Note that recently changed properties may not be available immediately. Method callsgetConfiguration(String)and then calls .entrySet() on the map.- 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
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the specified namespace doesn't exist
- Since:
- 1.6.0
 
- 
getConfigurationMap<String,String> getConfiguration(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException Gets properties of a namespace, which are inherited by tables in this namespace. Note that recently changed properties may not be available immediately. This new method returns a Map instead of an Iterable.- 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
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the specified namespace doesn't exist
- Since:
- 2.1.0
 
- 
getNamespacePropertiesMap<String,String> getNamespaceProperties(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException Gets properties specific to this namespace. Note that recently changed properties may not be available immediately. This new method returns a Map instead of an Iterable.- Parameters:
- namespace- the name of the namespace
- Returns:
- per-table properties specific to this namespace. Note that recently changed properties may not be visible immediately.
- Throws:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the specified namespace doesn't exist
- Since:
- 2.1.0
 
- 
namespaceIdMapGet a mapping of namespace name to internal namespace id.- Returns:
- the map from namespace name to internal namespace id
- Throws:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- Since:
- 1.6.0
 
- 
attachIteratorvoid attachIterator(String namespace, IteratorSetting setting) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException Add an iterator to a namespace on all scopes.- Parameters:
- namespace- the name of the namespace
- setting- object specifying the properties of the iterator
- Throws:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the specified namespace doesn't exist
- Since:
- 1.6.0
 
- 
attachIteratorvoid attachIterator(String namespace, IteratorSetting setting, EnumSet<IteratorUtil.IteratorScope> scopes) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException Add an iterator to a namespace on the given scopes.- 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:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the specified namespace doesn't exist
- Since:
- 1.6.0
 
- 
removeIteratorvoid removeIterator(String namespace, String name, EnumSet<IteratorUtil.IteratorScope> scopes) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException Remove an iterator from a namespace by name.- Parameters:
- namespace- the name of the namespace
- name- the name of the iterator
- scopes- the scopes of the iterator
- Throws:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the specified namespace doesn't exist
- Since:
- 1.6.0
 
- 
getIteratorSettingIteratorSetting getIteratorSetting(String namespace, String name, IteratorUtil.IteratorScope scope) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException Get the settings for an iterator.- Parameters:
- namespace- the name of the namespace
- name- the name of the iterator
- scope- the scope of the iterator
- Returns:
- the settings for this iterator
- Throws:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the specified namespace doesn't exist
- Since:
- 1.6.0
 
- 
listIteratorsMap<String,EnumSet<IteratorUtil.IteratorScope>> listIterators(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException Get a list of iterators for this namespace.- Parameters:
- namespace- the name of the namespace
- Returns:
- a set of iterator names
- Throws:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the specified namespace doesn't exist
- Since:
- 1.6.0
 
- 
checkIteratorConflictsvoid checkIteratorConflicts(String namespace, IteratorSetting setting, EnumSet<IteratorUtil.IteratorScope> scopes) throws AccumuloException, AccumuloSecurityException, 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. If so, an IllegalArgumentException is thrown, wrapped in an AccumuloException.- Parameters:
- namespace- the name of the namespace
- setting- object specifying the properties of the iterator
- scopes- the scopes of the iterator
- Throws:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the specified namespace doesn't exist
- Since:
- 1.6.0
 
- 
addConstraintint addConstraint(String namespace, String constraintClassName) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException Add a new constraint to a namespace.- 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
- Since:
- 1.6.0
 
- 
removeConstraintvoid removeConstraint(String namespace, int id) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException Remove a constraint from a namespace.- Parameters:
- namespace- the name of the namespace
- id- 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
- Since:
- 1.6.0
 
- 
listConstraintsMap<String,Integer> listConstraints(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException List constraints on a namespace with their assigned numbers.- Parameters:
- namespace- the name of the namespace
- Returns:
- a map from constraint class name to assigned number
- Throws:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the specified namespace doesn't exist
- Since:
- 1.6.0
 
- 
testClassLoadboolean testClassLoad(String namespace, String className, String asTypeName) throws AccumuloException, AccumuloSecurityException, 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.- 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:
- AccumuloException- if a general error occurs
- AccumuloSecurityException- if the user does not have permission
- NamespaceNotFoundException- if the specified namespace doesn't exist
- Since:
- 1.6.0
 
 
-