public abstract class NuxeoLauncher extends Object
Modifier and Type | Class and Description |
---|---|
protected class |
NuxeoLauncher.ShutdownThread |
static class |
NuxeoLauncher.SolarisProcessManager |
Modifier and Type | Field and Description |
---|---|
protected String |
command |
protected ConfigurationGenerator |
configurationGenerator |
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.
|
protected Process |
nuxeoProcess |
protected static String |
OPTION_ACCEPT |
protected static String |
OPTION_CLID |
protected static String |
OPTION_DEBUG |
protected static String |
OPTION_DEBUG_CATEGORY |
protected static String |
OPTION_ENCRYPT |
protected static String |
OPTION_FORCE |
protected static String |
OPTION_GET |
protected static String |
OPTION_GET_REGEXP |
protected static String |
OPTION_GUI |
protected static String |
OPTION_HELP |
protected static String |
OPTION_HIDE_DEPRECATION |
protected static String |
OPTION_HIDE_DEPRECATION_DESC |
protected static String |
OPTION_IGNORE_MISSING |
protected static String |
OPTION_IGNORE_MISSING_DESC |
protected static String |
OPTION_JSON |
protected static String |
OPTION_NODEPS |
protected static String |
OPTION_QUIET |
protected static String |
OPTION_RELAX |
protected static String |
OPTION_SET |
protected static String |
OPTION_SNAPSHOT |
protected static String |
OPTION_STRICT |
protected static String |
OPTION_XML |
protected static String |
OUTPUT_UNSET_VALUE |
protected boolean |
overrideJavaTmpDir |
protected String[] |
params |
protected String |
pid |
protected org.artofsolving.jodconverter.process.ProcessManager |
processManager |
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 |
---|---|
protected void |
addShutdownHook() |
protected String |
addToClassPath(String cp,
String filename) |
void |
checkNoRunningServer()
Check if some server is already running (from another thread) and throw a Runtime exception if it finds one.
|
boolean |
commandIs(String aCommand) |
protected boolean |
commandRequiresNoGUI() |
protected boolean |
commandRequiresNoRunningServer() |
protected void |
config() |
void |
configure()
Configure the server after checking installation
|
static NuxeoLauncher |
createLauncher(String[] args) |
protected void |
decrypt() |
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 |
protected void |
encrypt() |
protected abstract String |
getClassPath() |
protected String |
getClassPath(String classpath,
File baseDir) |
String |
getCommand() |
protected void |
getConfigProperties() |
ConfigurationGenerator |
getConfigurationGenerator() |
protected ConnectBroker |
getConnectBroker() |
protected DistributionInfo |
getDistributionInfo() |
int |
getErrorValue()
Last error value set by any method.
|
protected File[] |
getFilename(File baseDir,
String filePattern) |
NuxeoLauncherGUI |
getGUI() |
protected String |
getJavaOptsProperty()
Gets the Java options with 'nuxeo.*' properties substituted.
|
protected List<String> |
getJavaOptsPropertyAsList() |
File |
getLogFile() |
protected Collection<? extends String> |
getNuxeoProperties() |
protected abstract String |
getServerPrint() |
protected abstract Collection<? extends String> |
getServerProperties() |
protected abstract String |
getShutdownClassPath() |
String |
getStartupSummary() |
int |
getStatus()
Last status value set by
status() . |
String |
getURL() |
void |
init() |
protected static void |
initParserOptions() |
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) |
protected boolean |
pack()
Since 5.5
|
protected static org.apache.commons.cli.CommandLine |
parseOptions(String[] args) |
protected boolean |
pkgAdd(String[] pkgNames) |
protected boolean |
pkgCompoundRequest(List<String> request)
Combined install/uninstall request
|
protected boolean |
pkgHotfix()
Install the hotfixes available for the instance
|
protected boolean |
pkgInit()
Add packages from the distribution to the local cache
|
protected boolean |
pkgInstall(String[] pkgIDs) |
protected void |
pkgList()
List all local packages.
|
protected void |
pkgListAll()
List all packages including remote ones.
|
protected boolean |
pkgPurge()
Uninstall and remove all packages from the local cache
|
protected boolean |
pkgRefreshCache()
Update the cached list of remote packages
|
protected boolean |
pkgRemove(String[] pkgIDs) |
protected boolean |
pkgRequest(List<String> pkgsToAdd,
List<String> pkgsToInstall,
List<String> pkgsToUninstall,
List<String> pkgsToRemove) |
protected boolean |
pkgReset() |
protected boolean |
pkgSetRequest(List<String> request,
boolean nodeps) |
protected boolean |
pkgShow(String[] packages)
dpkg-like command which returns package location, version, dependencies, conflicts, ...
|
protected boolean |
pkgUninstall(String[] pkgIDs) |
protected boolean |
pkgUpgrade()
Upgrade the marketplace packages (addons) available for the instance
|
protected void |
printInstanceXMLOutput(InstanceInfo instance) |
static void |
printLongHelp() |
static void |
printShortHelp() |
protected void |
printXMLOutput() |
protected void |
printXMLOutput(JAXBContext jaxbContext,
Object objectToOutput) |
protected void |
removeShutdownHook() |
protected void |
setConfigProperties() |
protected static void |
setDebug(boolean activateDebug) |
protected static void |
setDebug(String categories) |
protected static void |
setDebug(String[] categories,
String defaultCategory) |
protected static void |
setDebug(String categories,
boolean activateDebug) |
void |
setGUI(NuxeoLauncherGUI gui) |
protected void |
setJSONOutput() |
protected static void |
setQuiet()
Set launcher in quiet mode
|
protected abstract void |
setServerStartCommand(List<String> command) |
protected abstract void |
setServerStopCommand(List<String> command) |
protected static void |
setStrict(boolean isStrict) |
protected void |
setXMLOutput() |
protected InstanceInfo |
showConfig() |
protected void |
start(boolean logProcessOutput)
Do not directly call this method without a call to
checkNoRunningServer() |
protected boolean |
startWizard() |
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.
|
protected boolean |
waitForEffectiveStart() |
void |
waitForProcessStreams(ArrayList<ThreadedStreamGobbler> sgArray)
Stop stream gobblers contained in the given ArrayList
|
boolean |
wasStartupFine()
Must be called after
getStartupSummary() |
protected static final String OUTPUT_UNSET_VALUE
protected static final String OPTION_NODEPS
protected static final String OPTION_GUI
protected static final String OPTION_JSON
protected static final String OPTION_XML
protected static final String OPTION_DEBUG
protected static final String OPTION_DEBUG_CATEGORY
protected static final String OPTION_QUIET
protected static final String OPTION_HELP
protected static final String OPTION_RELAX
protected static final String OPTION_ACCEPT
protected static final String OPTION_SNAPSHOT
protected static final String OPTION_FORCE
protected static final String OPTION_STRICT
protected static final String OPTION_HIDE_DEPRECATION
protected static final String OPTION_HIDE_DEPRECATION_DESC
protected static final String OPTION_IGNORE_MISSING
protected static final String OPTION_IGNORE_MISSING_DESC
protected static final String OPTION_CLID
protected static final String OPTION_ENCRYPT
protected static final String OPTION_SET
protected static final String OPTION_GET
protected static final String OPTION_GET_REGEXP
protected boolean overrideJavaTmpDir
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
protected ConfigurationGenerator configurationGenerator
protected org.artofsolving.jodconverter.process.ProcessManager processManager
protected Process nuxeoProcess
public CommandSetInfo cset
public NuxeoLauncher(ConfigurationGenerator configurationGenerator)
protected boolean commandRequiresNoRunningServer()
protected boolean commandRequiresNoGUI()
public final ConfigurationGenerator getConfigurationGenerator()
public String getCommand()
public boolean isUsingGui()
public boolean isQuiet()
public NuxeoLauncherGUI getGUI()
public void setGUI(NuxeoLauncherGUI gui)
public void init()
protected void start(boolean logProcessOutput) throws IOException, InterruptedException
checkNoRunningServer()
IOException
- In case of issue with process.InterruptedException
- If any thread has interrupted the current thread.doStart()
protected String getJavaOptsProperty()
protected List<String> getJavaOptsPropertyAsList()
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)
protected abstract String getServerPrint()
protected abstract Collection<? extends String> getServerProperties()
protected abstract void setServerStartCommand(List<String> command)
protected abstract String getClassPath()
protected abstract String getShutdownClassPath()
protected Collection<? extends String> getNuxeoProperties()
protected String addToClassPath(String cp, String filename)
protected static void initParserOptions()
protected static org.apache.commons.cli.CommandLine parseOptions(String[] args) throws org.apache.commons.cli.ParseException
org.apache.commons.cli.ParseException
public static void launch(NuxeoLauncher launcher) throws IOException, org.nuxeo.connect.update.PackageException, ConfigurationException, org.apache.commons.cli.ParseException, GeneralSecurityException
launcher
- org.nuxeo.connect.update.PackageException
IOException
ConfigurationException
org.apache.commons.cli.ParseException
GeneralSecurityException
protected void encrypt() throws ConfigurationException, GeneralSecurityException
ConfigurationException
GeneralSecurityException
protected void decrypt() throws ConfigurationException
ConfigurationException
protected void config() throws ConfigurationException, IOException, GeneralSecurityException
ConfigurationException
IOException
GeneralSecurityException
protected void getConfigProperties()
protected void setConfigProperties() throws ConfigurationException, IOException, GeneralSecurityException
IOException
GeneralSecurityException
ConfigurationException
protected boolean pack()
protected boolean startWizard() throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
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
protected void removeShutdownHook()
protected boolean waitForEffectiveStart() throws InterruptedException
InterruptedException
public boolean wasStartupFine()
getStartupSummary()
public String getStartupSummary()
public boolean doStart(boolean logProcessOutput) throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
protected void printXMLOutput()
protected void printXMLOutput(JAXBContext jaxbContext, Object objectToOutput)
public void waitForProcessStreams(ArrayList<ThreadedStreamGobbler> sgArray)
logProcessStreams(Process, boolean)
protected String getClassPath(String classpath, File baseDir) throws IOException
classpath
- baseDir
- IOException
protected File[] getFilename(File baseDir, String filePattern)
baseDir
- filePattern
- protected void addShutdownHook()
public void stop(boolean logProcessOutput)
protected abstract void setServerStopCommand(List<String> command)
public void configure() throws ConfigurationException
ConfigurationException
- If an installation error is detected or if configuration failspublic String status()
getStatus()
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 identifiedprotected static void setQuiet()
protected static void setDebug(String[] categories, String defaultCategory)
categories
- Root categories to switch DEBUG on.protected static void setDebug(String categories)
categories
- Root categories to switch DEBUG on.protected static void setDebug(String categories, boolean activateDebug)
categories
- Root categories to switch DEBUG on or offactivateDebug
- Set DEBUG on or off.protected static void setDebug(boolean activateDebug)
activateDebug
- if true, will activate the DEBUG logsprotected static void setStrict(boolean isStrict)
isStrict
- if true
, set the launcher strict optionOPTION_STRICT_DESC
protected void setXMLOutput()
protected void setJSONOutput()
public static void printShortHelp()
public static void printLongHelp()
public boolean isRunning()
public boolean isStarted()
public File getLogFile()
protected ConnectBroker getConnectBroker() throws IOException, org.nuxeo.connect.update.PackageException
IOException
org.nuxeo.connect.update.PackageException
protected void pkgList() throws IOException, org.nuxeo.connect.update.PackageException
IOException
org.nuxeo.connect.update.PackageException
protected void pkgListAll() throws IOException, org.nuxeo.connect.update.PackageException
IOException
org.nuxeo.connect.update.PackageException
protected boolean pkgAdd(String[] pkgNames) throws IOException, org.nuxeo.connect.update.PackageException
IOException
org.nuxeo.connect.update.PackageException
protected boolean pkgInstall(String[] pkgIDs) throws IOException, org.nuxeo.connect.update.PackageException
IOException
org.nuxeo.connect.update.PackageException
protected boolean pkgUninstall(String[] pkgIDs) throws IOException, org.nuxeo.connect.update.PackageException
IOException
org.nuxeo.connect.update.PackageException
protected boolean pkgRemove(String[] pkgIDs) throws IOException, org.nuxeo.connect.update.PackageException
IOException
org.nuxeo.connect.update.PackageException
protected boolean pkgReset() throws IOException, org.nuxeo.connect.update.PackageException
IOException
org.nuxeo.connect.update.PackageException
protected void printInstanceXMLOutput(InstanceInfo instance)
protected InstanceInfo showConfig() throws IOException, org.nuxeo.connect.update.PackageException, ConfigurationException
org.nuxeo.connect.update.PackageException
IOException
ConfigurationException
protected DistributionInfo getDistributionInfo()
protected boolean pkgRequest(List<String> pkgsToAdd, List<String> pkgsToInstall, List<String> pkgsToUninstall, List<String> pkgsToRemove) throws IOException, org.nuxeo.connect.update.PackageException
pkgsToAdd
- pkgsToInstall
- pkgsToUninstall
- pkgsToRemove
- IOException
org.nuxeo.connect.update.PackageException
protected boolean pkgRefreshCache() throws IOException, org.nuxeo.connect.update.PackageException
IOException
org.nuxeo.connect.update.PackageException
protected boolean pkgInit() throws IOException, org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
IOException
protected boolean pkgPurge() throws org.nuxeo.connect.update.PackageException, IOException
true
if command succeedorg.nuxeo.connect.update.PackageException
IOException
protected boolean pkgHotfix() throws IOException, org.nuxeo.connect.update.PackageException
true
if command succeedorg.nuxeo.connect.update.PackageException
IOException
protected boolean pkgUpgrade() throws IOException, org.nuxeo.connect.update.PackageException
true
if command succeedorg.nuxeo.connect.update.PackageException
IOException
protected boolean pkgCompoundRequest(List<String> request) throws IOException, org.nuxeo.connect.update.PackageException
request
- Space separated list of package names or IDs prefixed with + (install) or - (uninstall)IOException
org.nuxeo.connect.update.PackageException
protected boolean pkgSetRequest(List<String> request, boolean nodeps) throws IOException, org.nuxeo.connect.update.PackageException
IOException
org.nuxeo.connect.update.PackageException
protected boolean pkgShow(String[] packages) throws IOException, org.nuxeo.connect.update.PackageException
packages
- List of packages identified by their ID, name or local filename.org.nuxeo.connect.update.PackageException
IOException
Copyright © 2015 Nuxeo SA. All rights reserved.