Package org.opends.server.tools
Class ConfigureWindowsService
- java.lang.Object
-
- org.opends.server.tools.ConfigureWindowsService
-
public class ConfigureWindowsService extends Object
This class is used to configure the Windows service for this instance on this machine. This tool allows to enable and disable OpenDJ to run as a Windows service and allows to know if OpenDJ is running as a Windows service or not. Some comments about Vista: In Vista, when we launch the subcommands that require administrator privileges (enable, disable and cleanup) we cannot use the administrator launcher binary directly from Java (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6410605) so we use winlauncher.exe. When we launch subcommands that required administrator privileges we must launch a binary containing the manifest that specifies that we require administrator privileges (requireAdministrator value): if UAC is enabled, the user will be asked for confirmation. To minimize the number of confirmation that the user must provide when launching the state subcommand we will use a binary whose manifest does not contain the requireAdministrator value. See the files under src/build-tools/windows for more details.
-
-
Field Summary
Fields Modifier and Type Field Description static StringLAUNCHER_OPTIONOption to be used when calling the launchers.static intSERVICE_ALREADY_DISABLEDThe service was already disabled.static intSERVICE_ALREADY_ENABLEDThe service was already enabled.static intSERVICE_DISABLE_ERRORAn error occurred disabling the service.static intSERVICE_DISABLE_SUCCESSThe service was successfully disabled.static intSERVICE_ENABLE_SUCCESSThe service was successfully enabled.static intSERVICE_STATE_ENABLEDThe service is enabled.
-
Constructor Summary
Constructors Constructor Description ConfigureWindowsService()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intdisableService(PrintStream out, PrintStream err)Disables OpenDJ to run as a windows service.static intenableService(PrintStream out, PrintStream err)Enables OpenDJ to run as a windows service.static StringgetLauncherAdministratorBinaryFullPath()Returns the full path of the executable that has a manifest requiring administrator privileges used by this class to perform operations related to the service.static StringgetLauncherBinaryFullPath()Returns the full path of the executable that has a manifest requiring administrator privileges used by this class to perform operations related to the service.static voidmain(String[] args)Configures the Windows service for this instance on this machine.static intserviceState()Checks if OpenDJ is enabled as a windows service.
-
-
-
Field Detail
-
LAUNCHER_OPTION
public static final String LAUNCHER_OPTION
Option to be used when calling the launchers.- See Also:
- Constant Field Values
-
SERVICE_ENABLE_SUCCESS
public static final int SERVICE_ENABLE_SUCCESS
The service was successfully enabled.- See Also:
- Constant Field Values
-
SERVICE_ALREADY_ENABLED
public static final int SERVICE_ALREADY_ENABLED
The service was already enabled.- See Also:
- Constant Field Values
-
SERVICE_DISABLE_SUCCESS
public static final int SERVICE_DISABLE_SUCCESS
The service was successfully disabled.- See Also:
- Constant Field Values
-
SERVICE_ALREADY_DISABLED
public static final int SERVICE_ALREADY_DISABLED
The service was already disabled.- See Also:
- Constant Field Values
-
SERVICE_DISABLE_ERROR
public static final int SERVICE_DISABLE_ERROR
An error occurred disabling the service.- See Also:
- Constant Field Values
-
SERVICE_STATE_ENABLED
public static final int SERVICE_STATE_ENABLED
The service is enabled.- See Also:
- Constant Field Values
-
-
Method Detail
-
main
public static void main(String[] args)
Configures the Windows service for this instance on this machine. This tool allows to enable and disable OpenDJ to run as a Windows service and allows to know if OpenDJ is running as a Windows service or not.- Parameters:
args- The command-line arguments provided to this program.
-
enableService
public static int enableService(PrintStream out, PrintStream err)
Enables OpenDJ to run as a windows service.- Parameters:
out- the stream used to write the standard output.err- the stream used to write the error output.- Returns:
SERVICE_ENABLE_SUCCESS,SERVICE_ENABLE_ERROR,SERVICE_NAME_ALREADY_IN_USEorSERVICE_ALREADY_ENABLEDdepending on whether the service could be enabled or not.
-
disableService
public static int disableService(PrintStream out, PrintStream err)
Disables OpenDJ to run as a windows service.- Parameters:
out- the stream used to write the standard output.err- the stream used to write the error output.- Returns:
SERVICE_DISABLE_SUCCESS,SERVICE_DISABLE_ERROR,SERVICE_MARKED_FOR_DELETIONorSERVICE_ALREADY_DISABLEDdepending on whether the service could be disabled or not.
-
serviceState
public static int serviceState()
Checks if OpenDJ is enabled as a windows service.- Returns:
SERVICE_STATE_ENABLED,SERVICE_STATE_DISABLEDorSERVICE_STATE_ERRORdepending on the state of the service.
-
getLauncherAdministratorBinaryFullPath
public static String getLauncherAdministratorBinaryFullPath()
Returns the full path of the executable that has a manifest requiring administrator privileges used by this class to perform operations related to the service.- Returns:
- the full path of the executable that has a manifest requiring administrator privileges used by this class to perform operations related to the service.
-
getLauncherBinaryFullPath
public static String getLauncherBinaryFullPath()
Returns the full path of the executable that has a manifest requiring administrator privileges used by this class to perform operations related to the service.- Returns:
- the full path of the executable that has a manifest requiring administrator privileges used by this class to perform operations related to the service.
-
-