|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrooklyn.entity.basic.AbstractSoftwareProcessDriver
brooklyn.entity.basic.AbstractSoftwareProcessSshDriver
public abstract class AbstractSoftwareProcessSshDriver extends AbstractSoftwareProcessDriver
An abstract SSH implementation of the AbstractSoftwareProcessDriver. This provides conveniences for clients implementing the install/customize/launch/isRunning/stop lifecycle over SSH. These conveniences include checking whether software is already installed, creating/using a PID file for some operations, and reading ssh-specific config from the entity to override/augment ssh flags on the session.
Field Summary | |
---|---|
static java.lang.String |
CHECK_RUNNING
|
static java.lang.String |
CUSTOMIZING
|
static java.lang.String |
DEBUG
@see #newScript(Map, String) |
static java.lang.String |
IGNORE_ENTITY_SSH_FLAGS
include this flag in newScript creation to prevent entity-level flags from being included; any SSH-specific flags passed to newScript override flags from the entity, and flags from the entity override flags on the location (where there aren't conflicts, flags from all three are used however) |
static java.lang.String |
INSTALLING
|
static java.lang.String |
INSTALL_INCOMPLETE
Permitted flags for newScript(Map, String). |
static java.lang.String |
KILLING
|
static java.lang.String |
LAUNCHING
|
static java.lang.String |
NON_STANDARD_LAYOUT
Enable shell debugging output via |
static java.lang.String |
PID_FILENAME
|
static java.lang.String |
PROCESS_OWNER
|
static java.lang.String |
RESTARTING
|
static java.lang.String |
STOPPING
|
static java.lang.String |
USE_PID_FILE
Define the process owner if not the same as the brooklyn user. |
static java.util.List |
VALID_FLAGS
|
static Logger |
log
|
static Logger |
logSsh
|
Fields inherited from class AbstractSoftwareProcessDriver | |
---|---|
entity, location, resource |
Constructor Summary | |
AbstractSoftwareProcessSshDriver(EntityLocal entity, SshMachineLocation machine)
|
Method Summary | |
---|---|
int
|
copyResource(java.io.File file, java.lang.String target)
@param file File to copy. |
int
|
copyResource(java.lang.String resource, java.lang.String target)
|
int
|
copyResource(java.util.Map sshFlags, java.lang.String source, java.lang.String target)
|
void
|
copyResources(java.util.Map resources)
Copies all resources in the given map to the driver's machine. |
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, java.util.Map extraSubstitutions)
|
void
|
copyTemplates(java.util.Map templates)
Templates all resources in the given map, then copies them to the driver's machine. |
int
|
execute(java.util.List script, java.lang.String summaryForLogging)
|
int
|
execute(java.util.Map flags2, java.util.List script, java.lang.String summaryForLogging)
|
java.lang.String
|
getAddress()
|
java.lang.String
|
getDownloadFileSuffix()
Suffix to use when looking up the file in the local repo. |
java.lang.String
|
getDownloadFilename()
Name to be used in the local repo, when looking for the download file. |
protected java.lang.String
|
getEntityVersionLabel()
@deprecated since 0.5.0; instead rely on DownloadResolverManager to include local-repo, such as: |
protected java.lang.String
|
getEntityVersionLabel(java.lang.String separator)
@deprecated since 0.5.0; instead rely on DownloadResolverManager to include local-repo |
java.lang.String
|
getExpandedInstallDir()
|
java.lang.String
|
getHostname()
|
java.lang.String
|
getInstallDir()
|
protected java.lang.String
|
getInstallLabelExtraSalt()
allows subclasses to return extra salt (ie unique hash) for cases where install dirs need to be distinct e.g. based on extra plugins being placed in the install dir; setInstallLabel() uses entity-type simple name and version already |
SshMachineLocation
|
getLocation()
returns location (tighten type, since we know it is an ssh machine location here) |
SshMachineLocation
|
getMachine()
|
java.util.Set
|
getPortsUsed()
|
java.lang.String
|
getRunDir()
|
java.util.Map
|
getShellEnvironment()
The environment variables to be set when executing the commands (for install, run, check running, etc). |
protected java.util.Map
|
getSshFlags()
|
java.lang.String
|
getVersion()
|
protected ScriptHelper
|
newScript(java.lang.String phase)
|
protected ScriptHelper
|
newScript(java.util.Map flags, java.lang.String phase)
|
void
|
setExpandedInstallDir(java.lang.String val)
|
protected void
|
setInstallDir(java.lang.String installDir)
|
protected void
|
setInstallLabel()
|
protected void
|
setRunDir(java.lang.String runDir)
|
Methods inherited from class AbstractSoftwareProcessDriver | |
---|---|
customize, doFullStartOnRestart, getEntity, getLocation, getResource, getResourceAsString, install, kill, launch, postLaunch, processTemplate, processTemplate, processTemplate, processTemplate, processTemplateContents, processTemplateContents, rebind, restart, start, stop, waitForConfigKey |
Field Detail |
---|
public static final java.lang.String CHECK_RUNNING
public static final java.lang.String CUSTOMIZING
public static final java.lang.String DEBUG
public static final java.lang.String IGNORE_ENTITY_SSH_FLAGS
public static final java.lang.String INSTALLING
public static final java.lang.String INSTALL_INCOMPLETE
public static final java.lang.String KILLING
public static final java.lang.String LAUNCHING
public static final java.lang.String NON_STANDARD_LAYOUT
set -x
prepended to the command header.
public static final java.lang.String PID_FILENAME
public static final java.lang.String PROCESS_OWNER
public static final java.lang.String RESTARTING
public static final java.lang.String STOPPING
public static final java.lang.String USE_PID_FILE
kill
command. Only valid
if USE_PID_FILE is also set.
public static final java.util.List VALID_FLAGS
public static final Logger log
public static final Logger logSsh
Constructor Detail |
---|
public AbstractSoftwareProcessSshDriver(EntityLocal entity, SshMachineLocation machine)
Method Detail |
---|
public int copyResource(java.io.File file, java.lang.String target)
file
- File to copy.target
- Destination on server. Will be prefixed with the entity's
run directory if relative.
public int copyResource(java.lang.String resource, java.lang.String target)
@java.lang.SuppressWarningsFile file = new File(target); public int copyResource(java.util.Map sshFlags, java.lang.String source, java.lang.String target)
public void copyResources(java.util.Map resources)
resources
- A mapping of resource URI to server destination.
public int copyTemplate(java.io.File template, java.lang.String target)
public int copyTemplate(java.lang.String template, java.lang.String target)
public int copyTemplate(java.lang.String template, java.lang.String target, java.util.Map extraSubstitutions)
public void copyTemplates(java.util.Map templates)
templates
- A mapping of resource URI to server destination.
public int execute(java.util.List script, java.lang.String summaryForLogging)
@java.lang.SuppressWarningsif (!flags.containsKey("logPrefix")) flags.put("logPrefix", ""+entity.getId()+"@"+getLocation().getDisplayName()); @java.lang.Overridereturn getMachine().execScript(flags, summaryForLogging, script, environment); public int execute(java.util.Map flags2, java.util.List script, java.lang.String summaryForLogging)
public java.lang.String getAddress()
public java.lang.String getDownloadFileSuffix()
public java.lang.String getDownloadFilename()
protected java.lang.String getEntityVersionLabel()
DownloadResolver resolver = Entities.newDownloader(this);
List<String> urls = resolver.getTargets();
protected java.lang.String getEntityVersionLabel(java.lang.String separator)
public java.lang.String getExpandedInstallDir()
public java.lang.String getHostname()
public java.lang.String getInstallDir()
protected java.lang.String getInstallLabelExtraSalt()
public SshMachineLocation getLocation()
public SshMachineLocation getMachine()
public java.util.Set getPortsUsed()
public java.lang.String getRunDir()
public java.util.Map getShellEnvironment()
protected java.util.Map getSshFlags()
public java.lang.String getVersion()
protected ScriptHelper newScript(java.lang.String phase)
protected ScriptHelper newScript(java.util.Map flags, java.lang.String phase)
public void setExpandedInstallDir(java.lang.String val)
protected void setInstallDir(java.lang.String installDir)
protected void setInstallLabel()
protected void setRunDir(java.lang.String runDir)
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.