Brooklyn

brooklyn.entity.basic
[Java] Class SoftwareProcessImpl

java.lang.Object
  brooklyn.entity.basic.AbstractEntity
      brooklyn.entity.basic.SoftwareProcessImpl
All Implemented Interfaces:
DriverDependentEntity, SoftwareProcess

public abstract class SoftwareProcessImpl
extends AbstractEntity

An Entity representing a piece of software which can be installed, run, and controlled. A single such entity can only run on a single MachineLocation at a time (you can have multiple on the machine). It typically takes config keys for suggested versions, filesystem locations to use, and environment variables to set.

It exposes sensors for service state (Lifecycle) and status (String), and for host info, log file location.


Field Summary
protected boolean connectedSensors

 
Fields inherited from class AbstractEntity
EFFECTOR_ADDED, EFFECTOR_CHANGED, EFFECTOR_REMOVED, LOG, POLICY_ADDED, POLICY_REMOVED, SENSOR_ADDED, SENSOR_REMOVED, _subscriptionTracker, managementSupport, tempWorkings
 
Constructor Summary
SoftwareProcessImpl()

SoftwareProcessImpl(Entity parent)

SoftwareProcessImpl(java.util.Map properties)

SoftwareProcessImpl(java.util.Map properties, Entity parent)

 
Method Summary
protected void callRebindHooks()

protected void callStartHooks()

void checkModifiable()

protected void connectSensors()

For binding to the running app (e.g. connecting sensors to registry).

protected void connectServiceUpIsRunning()

For connecting the SERVICE_UP sensor to the value of the getDriver().isRunning() expression.

protected void disconnectSensors()

For disconnecting from the running app.

protected void disconnectServiceUpIsRunning()

For disconneting the SERVICE_UP feed.

protected SoftwareProcessDriver doInitDriver(MachineLocation machine)

void doRestart()

protected void doStart(java.util.Collection locations)

To be overridden instead of doRestart(); sub-classes should call super.doRestart() and should add do additional work via tasks, executed using DynamicTasks#queue(String, Callable)#queue(String, Callable).

protected void doStop()

SoftwareProcessDriver getDriver()

java.lang.String getLocalHostname()

@deprecated since 0.6.0 use Machines#findSubnetHostname(this)#findSubnetHostname(this)

protected MachineLocation getMachineOrNull()

protected java.util.Map getProvisioningFlags(MachineProvisioningLocation location)

deprecated:
in 0.4.0. use obtainProvisioningFlags.

protected MachineProvisioningLocation getProvisioningLocation()

protected java.util.Collection getRequiredOpenPorts()

protected SoftwareProcessDriver newDriver(MachineLocation loc)

protected java.util.Map obtainProvisioningFlags(MachineProvisioningLocation location)

void onManagementStarted()

void onManagementStarting()

protected void postDriverStart()

Called after driver.start().

protected void postRebind()

Called after this entity is fully rebound (i.e. it is fully managed).

protected void postStart()

Called after the rest of start has completed (after connectSensors() and waitForServiceUp())

protected void preStart()

Called before driver.start; guarantees the driver will exist, and locations will have been set.

protected void preStop()

protected void rebind()

void restart()

If custom behaviour is required by sub-classes, consider overriding doStop().

protected void setProvisioningLocation(MachineProvisioningLocation val)

void start(java.util.Collection locations)

If custom behaviour is required by sub-classes, consider overriding doStart().

protected void startInLocation(java.util.Collection locations)

@deprecated since 0.6.0 use/override method in SoftwareProcessDriverStartEffectorTask

protected void startInLocation(Location location)

@deprecated since 0.6.0 use/override method in SoftwareProcessDriverStartEffectorTask

protected void startInLocation(MachineProvisioningLocation location)

protected void startInLocation(MachineLocation machine)

void stop()

void waitForEntityStart()

void waitForServiceUp()

void waitForServiceUp(Duration duration)

void waitForServiceUp(groovy.time.TimeDuration duration)

void waitForServiceUp(long duration, java.util.concurrent.TimeUnit units)

 
Methods inherited from class AbstractEntity
addChild, addChild, addEnricher, addGroup, addLocations, addPolicy, clearLocations, clearParent, configure, configure, configure, configure, configure, configure, destroy, emit, emitInternal, equals, finalize, firstLocation, getAllAttributes, getAllConfig, getApplication, getApplicationId, getAttribute, getAttributeByNameParts, getChildren, getConfig, getConfig, getConfig, getConfig, getConfigMap, getCreationTime, getDisplayName, getEffector, getEnrichers, getEntityManager, getEntityType, getEntityTypeName, getExecutionContext, getGroups, getIconUrl, getId, getLocations, getManagementContext, getManagementSupport, getMutableEntityType, getParent, getPolicies, getProxy, getProxyIfAvailable, getRebindSupport, getSubscriptionContext, getSubscriptionTracker, hashCode, init, invalidateReferences, invoke, invoke, invoke, isLegacyConstruction, onManagementBecomingMaster, onManagementNoLongerMaster, onManagementStarted, onManagementStarting, onManagementStopped, refreshInheritedConfig, removeAllEnrichers, removeAllPolicies, removeAttribute, removeChild, removeEnricher, removeLocations, removePolicy, setApplication, setAttribute, setAttribute, setAttributeWithoutPublishing, setConfig, setConfig, setConfig, setConfig, setConfig, setConfig, setConfigEvenIfOwned, setConfigEvenIfOwned, setConfigIfValNonNull, setConfigIfValNonNull, setDisplayName, setManagementContext, setParent, setProxy, subscribe, subscribeToChildren, subscribeToMembers, toMetadataRecord, toString, toStringHelper, unsubscribe, unsubscribe
 

Field Detail

connectedSensors

protected boolean connectedSensors


 
Constructor Detail

SoftwareProcessImpl

public SoftwareProcessImpl()


SoftwareProcessImpl

public SoftwareProcessImpl(Entity parent)


SoftwareProcessImpl

public SoftwareProcessImpl(java.util.Map properties)


SoftwareProcessImpl

public SoftwareProcessImpl(java.util.Map properties, Entity parent)


 
Method Detail

callRebindHooks

protected void callRebindHooks()


callStartHooks

protected final void callStartHooks()


checkModifiable

public void checkModifiable()


connectSensors

protected void connectSensors()
For binding to the running app (e.g. connecting sensors to registry). Will be called on start() and on rebind().

Implementations should be idempotent (ie tell whether sensors already connected), though the framework is pretty good about not calling when already connected. TODO improve the framework's feed system to detect duplicate additions


connectServiceUpIsRunning

protected void connectServiceUpIsRunning()
For connecting the SERVICE_UP sensor to the value of the getDriver().isRunning() expression.

Should be called inside connectSensors().

See Also:
disconnectServiceUpIsRunning()


disconnectSensors

protected void disconnectSensors()
For disconnecting from the running app. Will be called on stop.


disconnectServiceUpIsRunning

protected void disconnectServiceUpIsRunning()
For disconneting the SERVICE_UP feed.

Should be called from disconnectSensors().

See Also:
connectServiceUpIsRunning()


doInitDriver

protected SoftwareProcessDriver doInitDriver(MachineLocation machine)


doRestart

public void doRestart()


doStart

protected void doStart(java.util.Collection locations)
To be overridden instead of doRestart(); sub-classes should call super.doRestart() and should add do additional work via tasks, executed using DynamicTasks#queue(String, Callable)#queue(String, Callable).


doStop

protected void doStop()


getDriver

public SoftwareProcessDriver getDriver()


getLocalHostname

}
public java.lang.String getLocalHostname()
deprecated:
since 0.6.0 use Machines#findSubnetHostname(this)#findSubnetHostname(this)


getMachineOrNull

protected MachineLocation getMachineOrNull()


getProvisioningFlags

protected final java.util.Map getProvisioningFlags(MachineProvisioningLocation location)
deprecated:
in 0.4.0. use obtainProvisioningFlags. introduced in a branch which duplicates changes in master where it is called "obtainPF". will remove as soon as those uses are updated.


getProvisioningLocation

protected MachineProvisioningLocation getProvisioningLocation()


getRequiredOpenPorts

protected java.util.Collection getRequiredOpenPorts()


newDriver

protected SoftwareProcessDriver newDriver(MachineLocation loc)


obtainProvisioningFlags

protected java.util.Map obtainProvisioningFlags(MachineProvisioningLocation location)


onManagementStarted

if (state != null && state != Lifecycle.CREATED) {
public void onManagementStarted()


onManagementStarting

Lifecycle state = getAttribute(SERVICE_STATE);
public void onManagementStarting()


postDriverStart

protected void postDriverStart()
Called after driver.start(). Default implementation is to wait to confirm the driver definitely started the process.


postRebind

protected void postRebind()
Called after this entity is fully rebound (i.e. it is fully managed).


postStart

protected void postStart()
Called after the rest of start has completed (after connectSensors() and waitForServiceUp())


preStart

protected void preStart()
Called before driver.start; guarantees the driver will exist, and locations will have been set.


preStop

protected void preStop()


rebind

protected void rebind()


restart

* To be overridden instead of {@link #stop()}; sub-classes should call {@code super.doStop()} and should
public final void restart()
If custom behaviour is required by sub-classes, consider overriding doStop().


setProvisioningLocation

protected void setProvisioningLocation(MachineProvisioningLocation val)


start

@Override
	pub
public final void start(java.util.Collection locations)
If custom behaviour is required by sub-classes, consider overriding doStart().


startInLocation

protected final void startInLocation(java.util.Collection locations)
deprecated:
since 0.6.0 use/override method in SoftwareProcessDriverStartEffectorTask


startInLocation

protected final void startInLocation(Location location)
deprecated:
since 0.6.0 use/override method in SoftwareProcessDriverStartEffectorTask


startInLocation

protected final void startInLocation(MachineProvisioningLocation location)


startInLocation

protected final void startInLocation(MachineLocation machine)


stop

Task task = Tasks.builder().name("stop").body(new Runnable() { public void run() { doStop(); } }).build();
public final void stop()


waitForEntityStart

public void waitForEntityStart()


waitForServiceUp

public void waitForServiceUp()


waitForServiceUp

public void waitForServiceUp(Duration duration)


waitForServiceUp

public void waitForServiceUp(groovy.time.TimeDuration duration)


waitForServiceUp

public void waitForServiceUp(long duration, java.util.concurrent.TimeUnit units)


 

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