public abstract class AbstractSoftwareProcessDriver extends java.lang.Object implements SoftwareProcessDriver
SoftwareProcessDriver
.Constructor and Description |
---|
AbstractSoftwareProcessDriver(EntityLocal entity,
Location location) |
Modifier and Type | Method and Description |
---|---|
abstract void |
copyInstallResources() |
abstract void |
copyRuntimeResources() |
abstract void |
customize() |
EntityLocal |
getEntity()
The entity whose components we are controlling.
|
Location |
getLocation()
The location the entity is running in.
|
java.io.InputStream |
getResource(java.lang.String url) |
java.lang.String |
getResourceAsString(java.lang.String url) |
abstract void |
install() |
void |
kill()
Kills the process, ungracefully and immediately where possible (e.g.
|
abstract void |
launch() |
void |
postLaunch()
Implement this method in child classes to add some post-launch behavior
|
void |
preInstall()
Implement this method in child classes to add some post-launch behavior
|
java.lang.String |
processTemplate(java.io.File templateConfigFile) |
java.lang.String |
processTemplate(java.io.File templateConfigFile,
java.util.Map<java.lang.String,java.lang.Object> extraSubstitutions) |
java.lang.String |
processTemplate(java.lang.String templateConfigUrl)
Takes the contents of a template file from the given URL (often a classpath://com/myco/myprod/myfile.conf or .sh)
and replaces "${entity.xxx}" with the result of entity.getXxx() and similar for other driver, location;
as well as replacing config keys on the management context
|
java.lang.String |
processTemplate(java.lang.String templateConfigUrl,
java.util.Map<java.lang.String,? extends java.lang.Object> extraSubstitutions) |
java.lang.String |
processTemplateContents(java.lang.String templateContents) |
java.lang.String |
processTemplateContents(java.lang.String templateContents,
java.util.Map<java.lang.String,? extends java.lang.Object> extraSubstitutions) |
void |
rebind()
Rebinds the driver to a pre-existing software process.
|
void |
restart()
Performs software restart (or queues tasks to do this).
|
abstract void |
runPostInstallCommand(java.lang.String command) |
abstract void |
runPostLaunchCommand(java.lang.String command) |
abstract void |
runPreInstallCommand(java.lang.String command) |
abstract void |
runPreLaunchCommand(java.lang.String command) |
abstract void |
setup() |
void |
start()
Start the entity.
|
abstract void |
stop()
Performs software stop (or queues tasks to do this)
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isRunning
public AbstractSoftwareProcessDriver(EntityLocal entity, Location location)
public void rebind()
SoftwareProcessDriver
rebind
in interface SoftwareProcessDriver
public void start()
This installs, configures and launches the application process. However,
users can also call the install()
, customize()
and
launch()
steps independently. The postLaunch()
will
be called after the launch()
metheod is executed, but the
process may not be completely initialised at this stage, so care is
required when implementing these stages.
The BrooklynConfigKeys#ENTITY_RUNNING
key can be set on the location
or the entity to skip the startup process if the entity is already running,
according to the SoftwareProcessDriver.isRunning()
method. To force the startup to be
skipped, BrooklynConfigKeys.SKIP_ENTITY_START
can be set on the entity.
The BrooklynConfigKeys.SKIP_ENTITY_INSTALLATION
key can also be used to
skip the setup()
, copyInstallResources()
and
install()
methods if set on the entity or location.
start
in interface SoftwareProcessDriver
stop()
public abstract void stop()
SoftwareProcessDriver
stop
in interface SoftwareProcessDriver
Startable.stop()
public void preInstall()
public abstract void runPreInstallCommand(java.lang.String command)
public abstract void setup()
public abstract void copyInstallResources()
public abstract void install()
public abstract void runPostInstallCommand(java.lang.String command)
public abstract void copyRuntimeResources()
public abstract void customize()
public abstract void runPreLaunchCommand(java.lang.String command)
public abstract void launch()
public abstract void runPostLaunchCommand(java.lang.String command)
public void kill()
SoftwareProcessDriver
kill
in interface SoftwareProcessDriver
public void postLaunch()
public void restart()
SoftwareProcessDriver
restart
in interface SoftwareProcessDriver
Startable.restart()
public EntityLocal getEntity()
SoftwareProcessDriver
getEntity
in interface SoftwareProcessDriver
getEntity
in interface EntityDriver
public Location getLocation()
EntityDriver
getLocation
in interface EntityDriver
public java.io.InputStream getResource(java.lang.String url)
public java.lang.String getResourceAsString(java.lang.String url)
public java.lang.String processTemplate(java.io.File templateConfigFile, java.util.Map<java.lang.String,java.lang.Object> extraSubstitutions)
public java.lang.String processTemplate(java.io.File templateConfigFile)
public java.lang.String processTemplate(java.lang.String templateConfigUrl)
uses Freemarker templates under the covers
public java.lang.String processTemplate(java.lang.String templateConfigUrl, java.util.Map<java.lang.String,? extends java.lang.Object> extraSubstitutions)
public java.lang.String processTemplateContents(java.lang.String templateContents)
public java.lang.String processTemplateContents(java.lang.String templateContents, java.util.Map<java.lang.String,? extends java.lang.Object> extraSubstitutions)