|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.dsrg.sofa.deployment.launcher.Launcher
public class Launcher
Launcher
is used to launch separate programs on local machine.
Launcher is a small program which exposes its interface to remote
management (using JMX; see LauncherMBean
). It enables the user
to start applications on local machine remotely.
You can set it to launch one default program and then this program
is launched every time the launch()
method is invoked, or you can
use launch(...)
methods with parameters to launch a different
program on each call.
There is a couple of ways how to specify the default program to launch:
setDefaultsFromServer(int, int, int, boolean)
;Configuration
instance. See setDefaultsFromConfiguration(Configuration, boolean)
;setDefault???()
methods.
Field Summary | |
---|---|
protected Configuration |
configuration
|
Fields inherited from interface org.objectweb.dsrg.sofa.deployment.launcher.LauncherMBean |
---|
OUTPUT_LIMIT |
Constructor Summary | |
---|---|
Launcher()
Creates a launcher instance. |
|
Launcher(int zeroconfPort)
|
Method Summary | |
---|---|
java.lang.String[] |
getAllDeploymentDocks()
Returns the list of deployment docks running on the Launcher. |
java.lang.String |
getConfiguration()
Returns the configuration received from the server. |
void |
killProcess(int id)
Kills the launched process with ID id . |
int |
launch()
Launches the default command and returns its id. |
int |
launch(java.lang.String command)
Launches the given command. |
int |
launch(java.lang.String[] cmdarray)
Launches the given command with parameters. |
int |
launch(java.lang.String[] cmdarray,
java.lang.String dir)
Launches the given command with parameters. |
int |
launchClass(java.lang.String classname)
Launches the given java class in a separate JVM. |
int |
launchClass(java.lang.String[] cmdarray)
Launches the given java class with parameters in a separate JVM. |
int |
launchClass(java.lang.String[] cmdarray,
java.lang.String dir)
Launches the given java class with parameters in a separate JVM. |
int |
launchClass(java.lang.String[] cmdarray,
java.lang.String jvmpath,
java.lang.String[] jvmargs)
Launches the given java class with parameters in a given JVM with specified arguments. |
int |
launchClass(java.lang.String[] cmdarray,
java.lang.String dir,
java.lang.String jvmpath,
java.lang.String[] jvmargs)
Launches the given java class with parameters in a given JVM with specified arguments. |
void |
launchConfiguredSofaClass(java.lang.String className)
Launches a class in separate JVM with sofa configuration set as java properties. |
void |
launchConfiguredSofaClass(java.lang.String className,
java.lang.String[] parameters)
Launches a class in separate JVM with sofa configuration set as java properties. |
void |
launchDeploymentDock(java.lang.String dockName)
Launches a sofa deployment dock in a separate jvm with configuration downloaded from the zeroconf server. |
void |
launchSofaApp(java.lang.String className,
java.lang.String[] parameters)
Launches a sofa application (e.g. |
void |
launchSofaClass(java.lang.String className,
java.lang.String[] parameters)
|
java.lang.String[] |
listProcesses()
Returns an array of all launched processes in format ID: command arg1 arg2 ... |
static void |
main(java.lang.String[] args)
Used to run launcher as a standalone program. |
java.lang.String |
readError(int id)
Returns the next portion of standard error of the process with ID id . |
java.lang.String |
readOutput(int id)
Returns the next portion of standard output of the process with ID id . |
void |
setDefaultDir(java.lang.String dir)
Sets the default working directory of new process to dir . |
void |
setDefaultJvm(java.lang.String jvmpath)
Sets the default JVM path (path to java executable) to
jvmpath . |
void |
setDefaultJvmArgs(java.lang.String[] jvmargs)
Sets the default JVM arguments to jvmargs . |
void |
setDefaultsFromConfiguration(Configuration cfg,
boolean erase)
|
boolean |
setDefaultsFromServer()
|
boolean |
setDefaultsFromServer(int port,
int timeout,
int tries,
boolean erase)
|
void |
shutSofaApp(java.lang.String appID)
Shuts down a launched sofa application with the given appID. |
void |
shutSofaAppNoConf(java.lang.String appID)
|
void |
startJMX(int rmiPort,
java.lang.String name)
Starts and registers the JMX interface of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Configuration configuration
Constructor Detail |
---|
public Launcher()
public Launcher(int zeroconfPort)
Method Detail |
---|
public void setDefaultDir(java.lang.String dir)
LauncherMBean
dir
.
setDefaultDir
in interface LauncherMBean
dir
- working directory for newly lauched processes, or null
if the working directory should be inherited from the current
process.public void setDefaultJvm(java.lang.String jvmpath)
LauncherMBean
java
executable) to
jvmpath
.
setDefaultJvm
in interface LauncherMBean
jvmpath
- path to JVM which should be used to launch Java classes,
or null
if the JVM path of this process should be used.public void setDefaultJvmArgs(java.lang.String[] jvmargs)
LauncherMBean
jvmargs
.
setDefaultJvmArgs
in interface LauncherMBean
jvmargs
- array of virtual machine arguments to be used when
starting Java classes, or null
if no JVM arguments
should be used.public boolean setDefaultsFromServer() throws java.net.SocketException, java.io.IOException
java.net.SocketException
java.io.IOException
public boolean setDefaultsFromServer(int port, int timeout, int tries, boolean erase) throws java.net.SocketException, java.io.IOException
java.net.SocketException
java.io.IOException
public void setDefaultsFromConfiguration(Configuration cfg, boolean erase)
public int launch() throws java.io.IOException
java.io.IOException
public int launch(java.lang.String command) throws java.io.IOException
command
- The command to be launched.
java.io.IOException
public int launch(java.lang.String[] cmdarray) throws java.io.IOException
cmdarray
- The command and its parameters.
java.io.IOException
public int launch(java.lang.String[] cmdarray, java.lang.String dir) throws java.io.IOException
cmdarray
- The command and its parameters.dir
- The working directory of the launched process.
java.io.IOException
public int launchClass(java.lang.String classname) throws java.io.IOException
classname
- The class to be launched.
java.io.IOException
public int launchClass(java.lang.String[] cmdarray) throws java.io.IOException
cmdarray
- The class and its parameters to be launched.
java.io.IOException
public int launchClass(java.lang.String[] cmdarray, java.lang.String dir) throws java.io.IOException
cmdarray
- The class and its parameters to be launched.dir
- The workdir in which the process is to be launched.
java.io.IOException
public int launchClass(java.lang.String[] cmdarray, java.lang.String jvmpath, java.lang.String[] jvmargs) throws java.io.IOException
cmdarray
- The class and its parameters to be launched.jvmpath
- Path to the JVM executable.jvmargs
- Arguments of the launched JVM.
java.io.IOException
public int launchClass(java.lang.String[] cmdarray, java.lang.String dir, java.lang.String jvmpath, java.lang.String[] jvmargs) throws java.io.IOException
cmdarray
- The class and its parameters to be launched.dir
- The workdir in which the process is to be launched.jvmpath
- Path to the JVM executable.jvmargs
- Arguments of the launched JVM.
java.io.IOException
public java.lang.String[] listProcesses()
LauncherMBean
listProcesses
in interface LauncherMBean
public java.lang.String readOutput(int id) throws java.io.IOException
LauncherMBean
id
. The returned string will be at most LauncherMBean.OUTPUT_LIMIT
characters long. If no output is available right now, returns an empty
string.
readOutput
in interface LauncherMBean
java.io.IOException
public java.lang.String readError(int id) throws java.io.IOException
LauncherMBean
id
. The returned string will be at most LauncherMBean.OUTPUT_LIMIT
characters long. If no error output is available right now, returns
an empty string.
readError
in interface LauncherMBean
java.io.IOException
public void killProcess(int id)
LauncherMBean
id
. After the kill,
id
becomes invalid.
killProcess
in interface LauncherMBean
public void startJMX(int rmiPort, java.lang.String name) throws java.io.IOException, javax.management.JMException
rmiPort
- The port of the RMI registry.name
- The name of the object.
java.io.IOException
javax.management.JMException
public static void main(java.lang.String[] args) throws java.io.IOException, javax.management.JMException
-h
option.
java.io.IOException
javax.management.JMException
public void launchConfiguredSofaClass(java.lang.String className, java.lang.String[] parameters) throws java.io.IOException
LauncherMBean
launchConfiguredSofaClass
in interface LauncherMBean
className
- Name of the class to be launched.parameters
- The parameters to be passed to the class's main function.
java.io.IOException
public void launchSofaClass(java.lang.String className, java.lang.String[] parameters) throws java.io.IOException
java.io.IOException
public void launchConfiguredSofaClass(java.lang.String className) throws java.io.IOException
LauncherMBean
launchConfiguredSofaClass
in interface LauncherMBean
className
- Name of the class to be launched.
java.io.IOException
public void launchDeploymentDock(java.lang.String dockName) throws java.io.IOException
LauncherMBean
launchDeploymentDock
in interface LauncherMBean
dockName
- The name of the deployment dock.
java.io.IOException
public void launchSofaApp(java.lang.String className, java.lang.String[] parameters) throws java.io.IOException
LauncherMBean
launchSofaApp
in interface LauncherMBean
className
- Full name of the deployment plan to be launched (e.g. org.objectweb.dsrg.sofa.examples.logdemo.deplplan.Local).parameters
- Parameters to pass - e.g. version of the deployment plan.
java.io.IOException
public void shutSofaApp(java.lang.String appID) throws java.io.IOException
LauncherMBean
shutSofaApp
in interface LauncherMBean
appID
- Id of the running sofa application (usually outputed when
java.io.IOException
public void shutSofaAppNoConf(java.lang.String appID) throws java.io.IOException
java.io.IOException
public java.lang.String getConfiguration() throws java.net.SocketException, java.io.IOException
LauncherMBean
getConfiguration
in interface LauncherMBean
java.net.SocketException
java.io.IOException
public java.lang.String[] getAllDeploymentDocks()
LauncherMBean
getAllDeploymentDocks
in interface LauncherMBean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |