public class Main
extends java.lang.Object
Main
is the externally visible Standalone Java Application
launcher for Sling. Please refer to the full description The Sling
Launchpad on the Sling Web Site for a full description of this class.
Logging goes to standard output for informational messages and to standard error for error messages.
This class goes into the secondary artifact with the classifier app to be used as the main class when starting the Java Application.
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
PROP_CONTROL_ACTION
The name of the configuration property indicating the
ControlAction to be taken in the doControlAction()
method. |
protected static java.lang.String |
PROP_CONTROL_SOCKET
The name of the configuration property indicating the socket to use for
the control connection.
|
Modifier | Constructor and Description |
---|---|
protected |
Main(java.util.Map<java.lang.String,java.lang.String> args)
Creates an instance of this main loader class.
|
Modifier and Type | Method and Description |
---|---|
protected int |
doControlAction()
After instantiating this class, this method may be called to help with
the communication with a running Sling instance.
|
protected boolean |
doStart()
Starts the application with the configuration supplied with the
configuration properties when this instance has been created.
|
protected boolean |
doStart(java.net.URL launcherJar) |
protected void |
doStop()
Maybe called by the application to cause the Sling Application to
properly terminate by stopping the OSGi Framework.
|
protected static void |
error(java.lang.String message,
java.lang.Throwable t) |
java.lang.String |
getSlingHome()
Return the absolute path to sling home
|
protected static void |
info(java.lang.String message,
java.lang.Throwable t) |
static void |
main(java.lang.String[] args)
The main entry point to the Sling Launcher Standalone Java Application.
|
protected static final java.lang.String PROP_CONTROL_ACTION
ControlAction
to be taken in the doControlAction()
method.protected static final java.lang.String PROP_CONTROL_SOCKET
localhost
)
or a host name (or IP address) and port number separated by a colon.protected Main(java.util.Map<java.lang.String,java.lang.String> args)
doStart(URL)
method.args
- The map of configuration properties to be supplied to the
OSGi framework. The keys in this map are assumed to be usefull
without translation to the launcher and the OSGi Framework. If
this parameter is null
and empty map without
configuration is assumed.public static void main(java.lang.String[] args)
args
- The command line arguments supplied when starting the Sling
Launcher through the Java VM.protected int doControlAction()
"sling.control.socket" |
Specifies the socket to use for the control connection. This specification is of the form host:port where the host can be a host name or IP Address and may be omitted (along with the separating colon) and port is just the numeric port number at which to listen. The default is localhost:63000. It is suggested to not use an externally accessible interface for security reasons because there is no added security on this control channel for now. |
"sling.control.action" |
The actual action to execute:
|
After this method has executed the j
and
PROP_CONTROL_ACTION
properties have been removed from the
configuration properties.
While the doStart()
and doStop()
methods may be called
multiple times this method should only be called once after creating this
class's instance.
-1
is returned, the VM should
continue as intended, maybe starting the Sling Application. This
code is returned if the start action (or no action at all) is
supplied. Otherwise the VM should terminate with the returned
code as its exit code. For the stop action, this will be zero.
For the status action, this will be a LSB compliant code for
daemon status check: 0 (application running), 1 (Program Dead),
3 (Program Not Running), 4 (Unknown Problem).protected boolean doStart()
Calling this method multiple times before calling doStop()
will
cause a message to be printed and true
being returned.
true
if startup was successful or the application
is considered to be started already. Otherwise an error message
has been logged and false
is returned.protected boolean doStart(java.net.URL launcherJar)
protected void doStop()
After calling this method the Sling Application can be started again
by calling the doStart()
method.
Calling this method multiple times without calling the doStart()
method in between has no effect after the Sling Application has been
terminated.
public java.lang.String getSlingHome()
protected static void info(java.lang.String message, java.lang.Throwable t)
protected static void error(java.lang.String message, java.lang.Throwable t)
Copyright © 2018 The Apache Software Foundation. All rights reserved.