org.opends.server.util
Class EmbeddedUtils

java.lang.Object
  extended by org.opends.server.util.EmbeddedUtils

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=false,
           mayExtend=false,
           mayInvoke=true)
public final class EmbeddedUtils
extends java.lang.Object

This class provides a number of utility methods for using OpenDS in an embedded manner (i.e., running within the same JVM as another application and controlled by that application).


Constructor Summary
EmbeddedUtils()
           
 
Method Summary
static void initializeForClientUse()
          Sets up a number of internal server data structures to ensure that they are properly initialized for use.
static boolean isRunning()
          Indicates whether the Directory Server is currently running.
static void restartServer(java.lang.String className, Message reason, DirectoryEnvironmentConfig config)
          Attempts to restart the Directory Server.
static void startServer(DirectoryEnvironmentConfig config)
          Attempts to start the Directory Server.
static void stopServer(java.lang.String className, Message reason)
          Attempts to stop the Directory Server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbeddedUtils

public EmbeddedUtils()
Method Detail

isRunning

public static boolean isRunning()
Indicates whether the Directory Server is currently running.

Returns:
true if the server is currently running, or false if not.

startServer

public static void startServer(DirectoryEnvironmentConfig config)
                        throws ConfigException,
                               InitializationException
Attempts to start the Directory Server.

Parameters:
config - The environment configuration to use for the server.
Throws:
ConfigException - If a configuration problem is detected during the server initialization or startup process.
InitializationException - If the Directory Server is already running, or if an error occurs during server initialization or startup.

stopServer

public static void stopServer(java.lang.String className,
                              Message reason)
Attempts to stop the Directory Server.

Parameters:
className - The name of the class that initiated the shutdown.
reason - A message explaining the reason for the shutdown.

restartServer

public static void restartServer(java.lang.String className,
                                 Message reason,
                                 DirectoryEnvironmentConfig config)
Attempts to restart the Directory Server. This will perform an in-core restart in which the existing server instance will be shut down, a new instance will be created, and it will be reinitialized and restarted.

Parameters:
className - The name of the class that initiated the restart.
reason - A message explaining the reason for the retart.
config - The environment configuration to use for the new server instance.

initializeForClientUse

public static void initializeForClientUse()
Sets up a number of internal server data structures to ensure that they are properly initialized for use. This is necessary if server libraries are going to be used without the server running (e.g., to facilitate use in an LDAP client API, for DN processing, etc.). This will have no effect if the server has already been initialized for client use.