Package org.opends.server.tools
Class RebuildIndex
- java.lang.Object
-
- org.opends.server.tools.tasks.TaskTool
-
- org.opends.server.tools.RebuildIndex
-
- All Implemented Interfaces:
TaskScheduleInformation
public class RebuildIndex extends TaskTool
This program provides a utility to rebuild the contents of the indexes of a Directory Server backend. This will be a process that is intended to run separate from Directory Server and not internally within the server process (e.g., via the tasks interface).
-
-
Field Summary
-
Fields inherited from class org.opends.server.tools.tasks.TaskTool
NOW, runOfflineArg
-
-
Constructor Summary
Constructors Constructor Description RebuildIndex()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTaskAttributes(List<RawAttribute> attributes)Adds utility specific attributes toattributesfor population of the entry that is added to the task backend.protected voidcleanup()Cleanup task environment after offline run.LocalBackend<?>getCurrentBackend()Returns the current backend.RebuildConfiggetRebuildConfig()Returns the rebuild configuration.Class<?>getTaskClass()Gets the Class that implements the utility to execute.StringgetTaskId()Gets an arbitrary task id assigned to this task.StringgetTaskObjectclass()Gets the objectclass used to represent scheduled instances of this utility in the task backend.static voidmain(String[] args)Processes the command-line arguments and invokes the rebuild process.static intmainRebuildIndex(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream)Processes the command-line arguments and invokes the rebuild process.protected intprocessLocal(boolean initializeServer, PrintStream out, PrintStream err)Called when this utility should perform its actions locally in this JVM.intrebuildIndexesWithinMultipleBackends(boolean initializeServer, PrintStream out, Collection<String> args)This function allow internal use of the rebuild index tools.voidsetCurrentBackend(LocalBackend<?> currentBackend)Sets the current backend.voidsetRebuildConfig(RebuildConfig rebuildConfig)Sets the rebuild configuration.-
Methods inherited from class org.opends.server.tools.tasks.TaskTool
checkVersion, createArgParser, getDependencyIds, getFailedDependencyAction, getNotifyUponCompletionEmailAddresses, getNotifyUponErrorEmailAddresses, getOfflineDescriptionMessage, getRecurringDateTime, getStartDateTime, process, runOffline, validateTaskArgs
-
-
-
-
Method Detail
-
main
public static void main(String[] args)
Processes the command-line arguments and invokes the rebuild process.- Parameters:
args- The command-line arguments provided to this program.
-
mainRebuildIndex
public static int mainRebuildIndex(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream)
Processes the command-line arguments and invokes the rebuild process.- Parameters:
args- The command-line arguments provided to this program.initializeServer- Indicates whether to initialize the server.outStream- The output stream to use for standard output, ornullif standard output is not needed.errStream- The output stream to use for standard error, ornullif standard error is not needed.- Returns:
- The error code.
-
processLocal
protected int processLocal(boolean initializeServer, PrintStream out, PrintStream err)Description copied from class:TaskToolCalled when this utility should perform its actions locally in this JVM.- Specified by:
processLocalin classTaskTool- Parameters:
initializeServer- indicates whether to initialize the directory server in the case of a local actionout- stream to write messages; may be nullerr- stream to write messages; may be null- Returns:
- int indicating the result of this action
-
cleanup
protected void cleanup()
Description copied from class:TaskToolCleanup task environment after offline run. Default implementation does nothing. Tasks which initialize some static part of the DirectoryServer instance (e.g admin data local backends) must override this method to shutdown all needed component to prevent JVM environment alteration.
-
rebuildIndexesWithinMultipleBackends
public int rebuildIndexesWithinMultipleBackends(boolean initializeServer, PrintStream out, Collection<String> args)This function allow internal use of the rebuild index tools. This function rebuilds indexes shared by multiple backends.- Parameters:
initializeServer- Indicates whether to initialize the server.out- The print stream which is used to display errors/debug lines. Usually redirected into a logger if the tool is used as external.args- The arguments used to launch the rebuild index process.- Returns:
- An integer indicating the result of this action.
-
getTaskId
public String getTaskId()
Gets an arbitrary task id assigned to this task.- Returns:
- assigned task id if any or
nullotherwise.
-
addTaskAttributes
public void addTaskAttributes(List<RawAttribute> attributes)
Adds utility specific attributes toattributesfor population of the entry that is added to the task backend.- Parameters:
attributes- that will be added to the task backend
-
getTaskObjectclass
public String getTaskObjectclass()
Gets the objectclass used to represent scheduled instances of this utility in the task backend.- Returns:
- String representation of this utilities objectclass
-
getTaskClass
public Class<?> getTaskClass()
Gets the Class that implements the utility to execute.- Returns:
- class of the tasks implementation
-
getRebuildConfig
public RebuildConfig getRebuildConfig()
Returns the rebuild configuration.- Returns:
- The rebuild configuration.
-
setRebuildConfig
public void setRebuildConfig(RebuildConfig rebuildConfig)
Sets the rebuild configuration.- Parameters:
rebuildConfig- The rebuild configuration to set.
-
getCurrentBackend
public LocalBackend<?> getCurrentBackend()
Returns the current backend.- Returns:
- The current backend.
-
setCurrentBackend
public void setCurrentBackend(LocalBackend<?> currentBackend)
Sets the current backend.- Parameters:
currentBackend- The current backend to set.
-
-