public abstract class NuxeoLauncher extends Object
Modifier and Type | Class and Description |
---|---|
static class |
NuxeoLauncher.SolarisProcessManager |
Modifier and Type | Field and Description |
---|---|
CommandSetInfo |
cset |
static int |
EXIT_CODE_ERROR
Generic or unspecified error.
|
static int |
EXIT_CODE_INVALID
Invalid or excess argument(s).
|
static int |
EXIT_CODE_NOT_CONFIGURED
Program is not configured.
|
static int |
EXIT_CODE_NOT_INSTALLED
Program is not installed.
|
static int |
EXIT_CODE_NOT_RUNNING
Program is not running.
|
static int |
EXIT_CODE_OK |
static int |
EXIT_CODE_UNAUTHORIZED
User had insufficient privilege.
|
static int |
EXIT_CODE_UNIMPLEMENTED
Unimplemented feature.
|
static int |
STATUS_CODE_OFF
Program is not running.
|
static int |
STATUS_CODE_ON
Program is running or service is OK.
|
static int |
STATUS_CODE_UNKNOWN
Program or service status is unknown.
|
Constructor and Description |
---|
NuxeoLauncher(ConfigurationGenerator configurationGenerator) |
Modifier and Type | Method and Description |
---|---|
void |
checkNoRunningServer()
Check if some server is already running (from another thread) and throw a
Runtime exception if it finds one.
|
void |
configure()
Configure the server after checking installation
|
static NuxeoLauncher |
createLauncher(String[] args) |
boolean |
doStart()
Call
doStart(boolean) with false as parameter. |
boolean |
doStart(boolean logProcessOutput)
Starts the server in background.
|
boolean |
doStartAndWait() |
boolean |
doStartAndWait(boolean logProcessOutput)
Whereas
doStart() considers the server as started when the
process is running, doStartAndWait() waits for effective start
by watching the logs |
String |
getCommand() |
ConfigurationGenerator |
getConfigurationGenerator() |
int |
getErrorValue()
Last error value set by any method.
|
NuxeoLauncherGUI |
getGUI() |
File |
getLogFile() |
String |
getStartupSummary() |
int |
getStatus()
Last status value set by
status() . |
String |
getURL() |
void |
init() |
boolean |
isQuiet() |
boolean |
isRunning()
Work best with current nuxeoProcess.
|
boolean |
isStarted() |
boolean |
isUsingGui() |
static void |
launch(NuxeoLauncher launcher) |
ArrayList<ThreadedStreamGobbler> |
logProcessStreams(Process process,
boolean logProcessOutput) |
static void |
main(String[] args) |
static void |
printLongHelp() |
static void |
printShortHelp() |
void |
setGUI(NuxeoLauncherGUI gui) |
String |
status()
Return process status (running or not) as String, depending on OS
capability to manage processes.
|
void |
stop() |
void |
stop(boolean logProcessOutput)
Stops the server.
|
void |
waitForProcessStreams(ArrayList<ThreadedStreamGobbler> sgArray)
Stop stream gobblers contained in the given ArrayList
|
boolean |
wasStartupFine()
Must be called after
getStartupSummary() |
public static final int STATUS_CODE_ON
public static final int STATUS_CODE_OFF
public static final int STATUS_CODE_UNKNOWN
public static final int EXIT_CODE_OK
public static final int EXIT_CODE_ERROR
public static final int EXIT_CODE_INVALID
public static final int EXIT_CODE_UNIMPLEMENTED
public static final int EXIT_CODE_UNAUTHORIZED
public static final int EXIT_CODE_NOT_INSTALLED
public static final int EXIT_CODE_NOT_CONFIGURED
public static final int EXIT_CODE_NOT_RUNNING
public CommandSetInfo cset
public NuxeoLauncher(ConfigurationGenerator configurationGenerator)
public final ConfigurationGenerator getConfigurationGenerator()
public String getCommand()
public boolean isUsingGui()
public boolean isQuiet()
public NuxeoLauncherGUI getGUI()
public void setGUI(NuxeoLauncherGUI gui)
public void init()
public void checkNoRunningServer() throws IllegalStateException
isRunning()
won't.IllegalThreadStateException
- Thrown if a server is already
running.IllegalStateException
public ArrayList<ThreadedStreamGobbler> logProcessStreams(Process process, boolean logProcessOutput)
public static void main(String[] args)
public static void launch(NuxeoLauncher launcher) throws IOException, org.nuxeo.connect.update.PackageException
launcher
- launcherGUI
- command
- org.nuxeo.connect.update.PackageException
IOException
public boolean doStartAndWait() throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
doStartAndWait(boolean)
public void stop()
stop(boolean)
public boolean doStart() throws org.nuxeo.connect.update.PackageException
doStart(boolean)
with false as parameter.org.nuxeo.connect.update.PackageException
doStart(boolean)
public boolean doStartAndWait(boolean logProcessOutput) throws org.nuxeo.connect.update.PackageException
doStart()
considers the server as started when the
process is running, doStartAndWait()
waits for effective start
by watching the logslogProcessOutput
- Must process output stream must be logged or not.org.nuxeo.connect.update.PackageException
public boolean wasStartupFine()
getStartupSummary()
public String getStartupSummary()
SocketTimeoutException
- if Nuxeo server is not respondingpublic boolean doStart(boolean logProcessOutput) throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
public void waitForProcessStreams(ArrayList<ThreadedStreamGobbler> sgArray)
InterruptedException
logProcessStreams(Process, boolean)
public void stop(boolean logProcessOutput)
STOP_NB_TRY
, waiting STOP_SECONDS_BEFORE_NEXT_TRY
between each try, then kill the process if still running.public void configure() throws ConfigurationException
ConfigurationException
- If an installation error is detected or if
configuration failspublic String status()
status
public int getStatus()
status()
.public int getErrorValue()
public static NuxeoLauncher createLauncher(String[] args) throws ConfigurationException, org.apache.commons.cli.ParseException
org.apache.commons.cli.ParseException
ConfigurationException
- If server cannot be identifiedpublic static void printShortHelp()
public static void printLongHelp()
public boolean isRunning()
public boolean isStarted()
public File getLogFile()
public String getURL()
Copyright © 2013 Nuxeo SA. All Rights Reserved.