org.rhq.core.pluginapi.util
Class ServerStartScriptDiscoveryUtility

java.lang.Object
  extended by org.rhq.core.pluginapi.util.ServerStartScriptDiscoveryUtility

public class ServerStartScriptDiscoveryUtility
extends Object

A set of utility methods that server discovery components can use to discover the values required to later restart the server process via a start script. The values can then be stored in or retrieved from the server's plugin configuration using the StartScriptConfiguration plugin configuration wrapper.


Method Summary
static File getStartScript(ProcessInfo serverParentProcess)
          If the specified process is a script, return the path to the script - the returned path will be absolute and canonical if possible, or, if it is not a script, return null.
static List<String> getStartScriptArgs(ProcessInfo serverParentProcess, List<String> serverArgs, Set<CommandLineOption> optionExcludes)
          Returns the list of arguments that should be passed to the start script for the specified server (e.g.
static Map<String,String> getStartScriptEnv(ProcessInfo serverProcess, ProcessInfo serverParentProcess, Set<String> envVarNameIncludes)
          Returns the set of environment variables that should be passed to the start script for the specified server (e.g.
static String getStartScriptPrefix(ProcessInfo serverProcess, ProcessInfo thisProcess)
          Return the command line prefix that should be used when restarting the specified server process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getStartScript

@Nullable
public static File getStartScript(ProcessInfo serverParentProcess)
If the specified process is a script, return the path to the script - the returned path will be absolute and canonical if possible, or, if it is not a script, return null.

Parameters:
serverParentProcess - the parent process of a server (e.g. JBoss AS) process
Returns:
if the specified process is a script (the returned path will be absolute and canonical if possible), the path to the script, otherwise null

getStartScriptPrefix

@Nullable
public static String getStartScriptPrefix(ProcessInfo serverProcess,
                                                   ProcessInfo thisProcess)
Return the command line prefix that should be used when restarting the specified server process.

Parameters:
serverProcess - a server (e.g. JBoss AS) process
thisProcess - this java process
Returns:
the command line prefix that should be used when restarting the specified server process

getStartScriptArgs

@NotNull
public static List<String> getStartScriptArgs(ProcessInfo serverParentProcess,
                                                      List<String> serverArgs,
                                                      Set<CommandLineOption> optionExcludes)
Returns the list of arguments that should be passed to the start script for the specified server (e.g. JBoss AS) process in order to start a functionally equivalent server instance.

Parameters:
serverParentProcess - the parent process of a server (e.g. JBoss AS) process
serverArgs - the subset of arguments from the server (e.g. JBoss AS) process that should be used if the parent process is not a script
optionExcludes - options that should be excluded from the returned arguments if the parent process is not a script
Returns:
the list of arguments that should be passed to the start script for the specified server (e.g. JBoss AS) process in order to start a functionally equivalent server instance

getStartScriptEnv

@NotNull
public static Map<String,String> getStartScriptEnv(ProcessInfo serverProcess,
                                                           ProcessInfo serverParentProcess,
                                                           Set<String> envVarNameIncludes)
Returns the set of environment variables that should be passed to the start script for the specified server (e.g. JBoss AS) process in order to start a functionally equivalent server instance.

Parameters:
serverProcess - a server (e.g. JBoss AS) process
serverParentProcess - the parent process of the server (e.g. JBoss AS) process
envVarNameIncludes - the names of the variables that should be included in the returned map, in addition to a core set of OS-level variables (PATH, LD_LIBRARY_PATH, etc.)
Returns:
the set of environment variables that should be passed to the start script for the specified server (e.g. JBoss AS) process


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.