Brooklyn

brooklyn.entity.basic
[Java] Class AbstractSoftwareProcessSshDriver

java.lang.Object
  brooklyn.entity.basic.AbstractSoftwareProcessDriver
      brooklyn.entity.basic.AbstractSoftwareProcessSshDriver
All Implemented Interfaces:
ScriptRunner

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 BROOKLYN_HOME_DIR

protected static java.lang.String CHECK_RUNNING

protected static java.lang.String CUSTOMIZING

static java.lang.String DEFAULT_INSTALL_BASEDIR

static java.lang.String DEFAULT_RUN_BASEDIR

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)

protected static java.lang.String INSTALLING

protected static java.lang.String KILLING

protected static java.lang.String LAUNCHING

static java.lang.String NO_VERSION_INFO

static java.lang.String PID_FILENAME

protected static java.lang.String RESTARTING

protected static java.lang.String STOPPING

protected static java.lang.String USE_PID_FILE

specify as a flag to use a PID file, creating for 'start', and reading it for 'status', 'start'; value can be true, or a path to a pid file to use (either relative to RUN_DIR, or an absolute path)

static Logger log

static Logger logSsh

 
Fields inherited from class AbstractSoftwareProcessDriver
entity
 
Constructor Summary
AbstractSoftwareProcessSshDriver(EntityLocal entity, SshMachineLocation machine)

 
Method Summary
void copyFile(java.io.File src, java.lang.String destination)

@deprecated since 0.5.0, should use copyResource(java.io.File, java.lang.String).

void copyFile(java.io.File src, java.io.File destination)

@deprecated since 0.5.0, destination should be a string not a File

void copyFile(java.util.Map flags2, java.io.File src, java.lang.String destination)

@deprecated since 0.5.0, should use copyResource(java.util.Map, java.lang.String, java.lang.String).

int copyResource(java.io.File file, java.lang.String target)

int copyResource(java.lang.String resource, java.lang.String target)

int copyResource(java.util.Map flags2, java.lang.String resource, java.lang.String target)

void copyResources(java.util.Map resources)

int copyTemplate(java.io.File template, java.lang.String target)

int copyTemplate(java.lang.String template, java.lang.String target)

void copyTemplates(java.util.Map templates)

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()

protected java.lang.String getDefaultVersion()

deprecated:
since 0.4.

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 getHostname()

java.lang.String getInstallDir()

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()

extracts the values for the main brooklyn.ssh.config.* config keys (i.e. those declared in ConfigKeys) as declared on the entity, and inserts them in a map using the unprefixed state, for ssh.

protected java.lang.String getVersion()

protected ScriptHelper newScript(java.lang.String phase)

sets up a script for the given phase, including default wrapper commands (e.g.

protected ScriptHelper newScript(java.util.Map flags, java.lang.String phase)

 
Methods inherited from class AbstractSoftwareProcessDriver
customize, getEntity, getLocation, getResource, getResourceAsString, install, kill, launch, postLaunch, processTemplate, processTemplate, rebind, restart, start, stop, waitForConfigKey
 

Field Detail

BROOKLYN_HOME_DIR

public static final java.lang.String BROOKLYN_HOME_DIR


CHECK_RUNNING

protected static final java.lang.String CHECK_RUNNING


CUSTOMIZING

protected static final java.lang.String CUSTOMIZING


DEFAULT_INSTALL_BASEDIR

public static final java.lang.String DEFAULT_INSTALL_BASEDIR


DEFAULT_RUN_BASEDIR

public static final java.lang.String DEFAULT_RUN_BASEDIR


IGNORE_ENTITY_SSH_FLAGS

public static final 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)


INSTALLING

protected static final java.lang.String INSTALLING


KILLING

protected static final java.lang.String KILLING


LAUNCHING

protected static final java.lang.String LAUNCHING


NO_VERSION_INFO

public static final java.lang.String NO_VERSION_INFO


PID_FILENAME

public static final java.lang.String PID_FILENAME


RESTARTING

protected static final java.lang.String RESTARTING


STOPPING

protected static final java.lang.String STOPPING


USE_PID_FILE

protected static final java.lang.String USE_PID_FILE
specify as a flag to use a PID file, creating for 'start', and reading it for 'status', 'start'; value can be true, or a path to a pid file to use (either relative to RUN_DIR, or an absolute path)


log

public static final Logger log


logSsh

public static final Logger logSsh


 
Constructor Detail

AbstractSoftwareProcessSshDriver

public AbstractSoftwareProcessSshDriver(EntityLocal entity, SshMachineLocation machine)


 
Method Detail

copyFile

@Deprecated
public void copyFile(java.io.File src, java.lang.String destination)
deprecated:
since 0.5.0, should use copyResource(java.io.File, java.lang.String).


copyFile

@Deprecated
public void copyFile(java.io.File src, java.io.File destination)
deprecated:
since 0.5.0, destination should be a string not a File


copyFile

@Deprecated
@SuppressWarnings({ "unchecked", "rawtypes" })
public void copyFile(java.util.Map flags2, java.io.File src, java.lang.String destination)
deprecated:
since 0.5.0, should use copyResource(java.util.Map, java.lang.String, java.lang.String).


copyResource

public int copyResource(java.io.File file, java.lang.String target)


copyResource

public int copyResource(java.lang.String resource, java.lang.String target)


copyResource

@SuppressWarnings({ "unchecked", "rawtypes" })
public int copyResource(java.util.Map flags2, java.lang.String resource, java.lang.String target)


copyResources

public void copyResources(java.util.Map resources)


copyTemplate

public int copyTemplate(java.io.File template, java.lang.String target)


copyTemplate

public int copyTemplate(java.lang.String template, java.lang.String target)


copyTemplates

public void copyTemplates(java.util.Map templates)


execute

public int execute(java.util.List script, java.lang.String summaryForLogging)


execute

@Override
public int execute(java.util.Map flags2, java.util.List script, java.lang.String summaryForLogging)


getAddress

public java.lang.String getAddress()


getDefaultVersion

@Deprecated
protected java.lang.String getDefaultVersion()
deprecated:
since 0.4. Set default on ConfigKey in entity, rather than overriding it here and not telling the entity what value was chosen!


getDownloadFileSuffix

public java.lang.String getDownloadFileSuffix()
Suffix to use when looking up the file in the local repo. Ignored if getDownloadFilename() returns non-null.


getDownloadFilename

public java.lang.String getDownloadFilename()
Name to be used in the local repo, when looking for the download file. If null, will


getEntityVersionLabel

protected java.lang.String getEntityVersionLabel()
deprecated:
since 0.5.0; instead rely on DownloadResolverManager to include local-repo, such as:
 DownloadResolver resolver = entity.getManagementContext().getEntityDownloadsManager().resolve(this);
       List urls = resolver.getTargets();
 
 


getEntityVersionLabel

protected java.lang.String getEntityVersionLabel(java.lang.String separator)
deprecated:
since 0.5.0; instead rely on DownloadResolverManager to include local-repo


getHostname

public java.lang.String getHostname()


getInstallDir

public java.lang.String getInstallDir()


getLocation

public SshMachineLocation getLocation()
returns location (tighten type, since we know it is an ssh machine location here)


getMachine

public SshMachineLocation getMachine()


getPortsUsed

public java.util.Set getPortsUsed()


getRunDir

public java.lang.String getRunDir()


getShellEnvironment

public java.util.Map getShellEnvironment()
The environment variables to be set when executing the commands (for install, run, check running, etc).


getSshFlags

protected java.util.Map getSshFlags()
extracts the values for the main brooklyn.ssh.config.* config keys (i.e. those declared in ConfigKeys) as declared on the entity, and inserts them in a map using the unprefixed state, for ssh.


getVersion

protected java.lang.String getVersion()


newScript

protected ScriptHelper newScript(java.lang.String phase)
sets up a script for the given phase, including default wrapper commands (e.g. INSTALLING, LAUNCHING, etc)

flags supported include: - usePidFile: true, or a filename, meaning to create (for launching) that pid

Parameters:
phase
Returns:


newScript

protected ScriptHelper newScript(java.util.Map flags, java.lang.String phase)


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.