org.opends.server.tasks
Class TaskUtils

java.lang.Object
  extended by org.opends.server.tasks.TaskUtils

public class TaskUtils
extends java.lang.Object

This class defines a number of static utility methods for server tasks.


Constructor Summary
TaskUtils()
           
 
Method Summary
static void disableBackend(java.lang.String backendID)
          Disables a backend using an internal modify operation on the backend configuration entry.
static void enableBackend(java.lang.String backendID)
          Enables a backend using an internal modify operation on the backend configuration entry.
static java.util.Map<java.lang.String,ConfigEntry> getBackendConfigEntries()
          Get all the backend configuration entries defined in the server mapped by their backend ID.
static java.lang.String getBackendID(ConfigEntry configEntry)
          Get the backend ID of a backend configuration entry.
static boolean getBoolean(java.util.List<Attribute> attrList, boolean defaultValue)
          Get the single boolean value of an entry attribute that is defined in the schema as a single valued boolean attribute, and that is not expected to have attribute options.
static BackendCfg getConfigEntry(Backend backend)
          Get the configuration entry for a given backend.
static java.util.ArrayList<java.lang.String> getMultiValueString(java.util.List<Attribute> attrList)
          Get the multiple string values of an entry attribute that is defined in the schema as a multi-valued string attribute, and that is not expected to have attribute options.
static int getSingleValueInteger(java.util.List<Attribute> attrList, int defaultValue)
          Get the single integer value of an entry attribute that is defined in the schema as a single valued integer attribute, and that is not expected to have attribute options.
static java.lang.String getSingleValueString(java.util.List<Attribute> attrList)
          Get the single string value of an entry attribute that is defined in the schema as a single valued string attribute, and that is not expected to have attribute options.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskUtils

public TaskUtils()
Method Detail

getBackendID

public static java.lang.String getBackendID(ConfigEntry configEntry)
Get the backend ID of a backend configuration entry.

Parameters:
configEntry - A backend configuration entry.
Returns:
The backend ID.

getBackendConfigEntries

public static java.util.Map<java.lang.String,ConfigEntry> getBackendConfigEntries()
Get all the backend configuration entries defined in the server mapped by their backend ID.

Returns:
A map of backend IDs to their corresponding configuration entries.

getConfigEntry

public static BackendCfg getConfigEntry(Backend backend)
Get the configuration entry for a given backend.

Parameters:
backend - The backend whose configuration entry is wanted.
Returns:
The configuration entry of the backend, or null if it could not be found.

enableBackend

public static void enableBackend(java.lang.String backendID)
                          throws DirectoryException
Enables a backend using an internal modify operation on the backend configuration entry.

Parameters:
backendID - Identifies the backend to be enabled.
Throws:
DirectoryException - If the internal modify operation failed.

disableBackend

public static void disableBackend(java.lang.String backendID)
                           throws DirectoryException
Disables a backend using an internal modify operation on the backend configuration entry.

Parameters:
backendID - Identifies the backend to be disabled.
Throws:
DirectoryException - If the internal modify operation failed.

getBoolean

public static boolean getBoolean(java.util.List<Attribute> attrList,
                                 boolean defaultValue)
Get the single boolean value of an entry attribute that is defined in the schema as a single valued boolean attribute, and that is not expected to have attribute options.

Parameters:
attrList - The attribute value of the entry attribute.
defaultValue - The default value to be returned if there is no recognizable boolean attribute value.
Returns:
The boolean value of the attribute, or the provided default value if there is no value.

getMultiValueString

public static java.util.ArrayList<java.lang.String> getMultiValueString(java.util.List<Attribute> attrList)
Get the multiple string values of an entry attribute that is defined in the schema as a multi-valued string attribute, and that is not expected to have attribute options.

Parameters:
attrList - The attribute values of the entry attribute.
Returns:
The string values of the attribute, empty if there are none.

getSingleValueString

public static java.lang.String getSingleValueString(java.util.List<Attribute> attrList)
Get the single string value of an entry attribute that is defined in the schema as a single valued string attribute, and that is not expected to have attribute options.

Parameters:
attrList - The attribute value of the entry attribute.
Returns:
The string value of the attribute, or null if there is none.

getSingleValueInteger

public static int getSingleValueInteger(java.util.List<Attribute> attrList,
                                        int defaultValue)
Get the single integer value of an entry attribute that is defined in the schema as a single valued integer attribute, and that is not expected to have attribute options.

Parameters:
attrList - The attribute value of the entry attribute.
defaultValue - The default value to be returned if there is no recognizable integer attribute value.
Returns:
The integer value of the attribute, or the provided default value if there is no value.