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 |
|---|---|
void |
copyInstallResources()
Files and templates to be copied to the server before installation.
|
void |
copyPreInstallResources()
Files and templates to be copied to the server before pre-install.
|
int |
copyResource(java.io.File file,
java.lang.String target) |
int |
copyResource(java.io.InputStream source,
java.lang.String target) |
abstract int |
copyResource(java.util.Map<java.lang.Object,java.lang.Object> sshFlags,
java.io.InputStream source,
java.lang.String target,
boolean createParentDir) |
int |
copyResource(java.util.Map<java.lang.Object,java.lang.Object> sshFlags,
java.io.Reader source,
java.lang.String target,
boolean createParent) |
abstract int |
copyResource(java.util.Map<java.lang.Object,java.lang.Object> sshFlags,
java.lang.String source,
java.lang.String target,
boolean createParentDir) |
int |
copyResource(java.util.Map sshFlags,
java.lang.String source,
java.lang.String target) |
int |
copyResource(java.io.Reader source,
java.lang.String target) |
int |
copyResource(java.lang.String resource,
java.lang.String target) |
int |
copyResource(java.lang.String resource,
java.lang.String target,
boolean createParentDir) |
void |
copyRuntimeResources()
Files and templates to be copied to the server after customisation.
|
int |
copyTemplate(java.io.File template,
java.lang.String target) |
int |
copyTemplate(java.lang.String template,
java.lang.String target) |
int |
copyTemplate(java.lang.String template,
java.lang.String target,
boolean createParent,
java.util.Map<java.lang.String,?> extraSubstitutions) |
abstract void |
customize() |
EntityLocal |
getEntity()
The entity whose components we are controlling.
|
abstract java.lang.String |
getInstallDir() |
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 java.lang.String |
getRunDir() |
java.lang.String |
getVersion() |
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 pre-install 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() |
abstract void |
runPostLaunchCommand() |
abstract void |
runPreInstallCommand() |
abstract void |
runPreLaunchCommand() |
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, waitisRunningpublic AbstractSoftwareProcessDriver(EntityLocal entity, Location location)
public void rebind()
SoftwareProcessDriverrebind in interface SoftwareProcessDriverpublic 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 SoftwareProcessDriverstop()public abstract void stop()
SoftwareProcessDriverstop in interface SoftwareProcessDriverStartable.stop()public void preInstall()
public abstract void runPreInstallCommand()
public abstract void setup()
public abstract void install()
public abstract void runPostInstallCommand()
public abstract void customize()
public abstract void runPreLaunchCommand()
public abstract void launch()
public abstract void runPostLaunchCommand()
public void kill()
SoftwareProcessDriverkill in interface SoftwareProcessDriverpublic void postLaunch()
public void restart()
SoftwareProcessDriverrestart in interface SoftwareProcessDriverStartable.restart()public EntityLocal getEntity()
SoftwareProcessDrivergetEntity in interface EntityDrivergetEntity in interface SoftwareProcessDriverpublic Location getLocation()
EntityDrivergetLocation in interface EntityDriverpublic java.io.InputStream getResource(java.lang.String url)
public void copyPreInstallResources()
preInstall()
process to have access to all required resources.
Will be prefixed with the entity's install directory if relative.
public void copyInstallResources()
install()
process to have access to all required resources.
Will be prefixed with the entity's install directory if relative.
public void copyRuntimeResources()
customize() process.
Will be prefixed with the entity's run directory if relative.
public int copyTemplate(java.io.File template,
java.lang.String target)
template - File to template and copy.target - Destination on server.public int copyTemplate(java.lang.String template,
java.lang.String target)
template - URI of file to template and copy, e.g. file://.., http://.., classpath://..target - Destination on server.public int copyTemplate(java.lang.String template,
java.lang.String target,
boolean createParent,
java.util.Map<java.lang.String,?> extraSubstitutions)
template - URI of file to template and copy, e.g. file://.., http://.., classpath://..target - Destination on server.extraSubstitutions - Extra substitutions for the templater to use, for example
"foo" -> "bar", and in a template ${foo}.public abstract int copyResource(java.util.Map<java.lang.Object,java.lang.Object> sshFlags,
java.lang.String source,
java.lang.String target,
boolean createParentDir)
public abstract int copyResource(java.util.Map<java.lang.Object,java.lang.Object> sshFlags,
java.io.InputStream source,
java.lang.String target,
boolean createParentDir)
public int copyResource(java.io.File file,
java.lang.String target)
file - File to copy.target - Destination on server.public int copyResource(java.lang.String resource,
java.lang.String target)
resource - URI of file to copy, e.g. file://.., http://.., classpath://..target - Destination on server.public int copyResource(java.lang.String resource,
java.lang.String target,
boolean createParentDir)
public int copyResource(java.util.Map sshFlags,
java.lang.String source,
java.lang.String target)
public int copyResource(java.io.Reader source,
java.lang.String target)
public int copyResource(java.util.Map<java.lang.Object,java.lang.Object> sshFlags,
java.io.Reader source,
java.lang.String target,
boolean createParent)
public int copyResource(java.io.InputStream source,
java.lang.String target)
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)
public java.lang.String getVersion()
public abstract java.lang.String getRunDir()
public abstract java.lang.String getInstallDir()