Package org.opends.server.tasks
Class TaskUtils
- java.lang.Object
-
- org.opends.server.tasks.TaskUtils
-
public class TaskUtils extends Object
This class defines a number of static utility methods for server tasks.
-
-
Constructor Summary
Constructors Constructor Description TaskUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddisableBackend(String backendID)Disables a backend using an internal modify operation on the backend configuration entry.static voidenableBackend(String backendID)Enables a backend using an internal modify operation on the backend configuration entry.static Map<String,Entry>getBackendConfigEntries()Get all the backend configuration entries defined in the server mapped by their backend ID.static StringgetBackendID(Entry configEntry)Get the backend ID of a backend configuration entry.static booleangetBoolean(Iterable<Attribute> attrs, 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 BackendCfggetConfigEntry(LocalBackend<?> backend)Get the configuration entry for a given backend.static List<String>getMultiValueString(Iterable<Attribute> attrs)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 intgetSingleValueInteger(Iterable<Attribute> attrs, 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 StringgetSingleValueString(Iterable<Attribute> attrs)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.
-
-
-
Method Detail
-
getBackendID
public static String getBackendID(Entry configEntry)
Get the backend ID of a backend configuration entry.- Parameters:
configEntry- A backend configuration entry.- Returns:
- The backend ID.
-
getBackendConfigEntries
public static Map<String,Entry> 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(LocalBackend<?> 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(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(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(Iterable<Attribute> attrs, 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:
attrs- The attribute values 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 List<String> getMultiValueString(Iterable<Attribute> attrs)
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:
attrs- The attribute values of the entry attribute.- Returns:
- The string values of the attribute, empty if there are none.
-
getSingleValueString
public static String getSingleValueString(Iterable<Attribute> attrs)
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:
attrs- The attribute values of the entry attribute.- Returns:
- The string value of the attribute, or null if there is none.
-
getSingleValueInteger
public static int getSingleValueInteger(Iterable<Attribute> attrs, 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:
attrs- The attribute values 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.
-
-