public abstract class AssetManager extends AbstractUserArtifact
AssetManager
implementations are custom user code that respond to Broker events and interact with external resources.
To deploy an AssetManager to a Silver Fabric Broker, create a JAR archive containing the necessary classes. This JAR should then be copied to the Broker's
webapps/livecluster/WEB-INF/assets
directory along with an XML descriptor file. The descriptor file can have any arbitrary name and should be of the following format:
<assetmanager class="com.mymanager.MyAssetManager"> <property name="name" value="My Asset Manager"/> <property name="description" value="my description"/> <property name="enabled" value="true"/> <property name="detailTemplate" value="MyTemplate.vm"/> <config class="com.mymanager.MyConfig"> <property name="password" value="changeit"/> <property name="address" value="myhostname"/> <property name="username" value="myuser"/> </config> <strategy class="com.mymanager.MyStrategy"> <property name="interval" value="3000"/> </strategy> <provider class="com.mymanager.MyProvider"> <property name="useSSL" value="true"/> </provider> </assetmanager>
The detail view of the Admin > Assets
page in the Administration Tool will display the properties of the AssetManagerConfig
implementation by default. This view can be
replaced for each Asset Manager by providing a Velocity template via the AssetManager.setDetailTemplate(String)
method. The following is an example template:
<table> <tr> <td> <b>Configuration for $assetManager.getName()</b> <table> #foreach( $key in $config.keySet() ) <tr> <td>$key</td> <td>$config.get($key)</td> </tr> #end </table> </td> </tr> </table>The Velocity template has access to the following variables:
AssetManagerConfig
implementation.
Two helper methods are available to decrypt any "CRYPT::"-prefixed encrypted values:
For example, you may used them to decrypt encrypted values garnered from subclasses of AssetManagerConfig
AssetManagerConfig
,
AssetManagementStrategy
,
AssetProvider
,
AssetProvisioningWorkflow
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
ALERT_HIGH_SEVERITY
High severity alert code
|
static int |
ALERT_LOW_SEVERITY
Low severity alert code
|
static int |
ALERT_MED_SEVERITY
Medium severity alert code
|
static int |
STATUS_DISABLED
Disabled status code
|
static int |
STATUS_ENABLED
Enabled status code
|
static int |
STATUS_ERROR
Error status code
|
static java.lang.String |
STATUS_STRING_DISABLED
Enabled status String
|
static java.lang.String |
STATUS_STRING_ENABLED
Disabled status String
|
static java.lang.String |
STATUS_STRING_ERROR
Error status String
|
Constructor and Description |
---|
AssetManager() |
Modifier and Type | Method and Description |
---|---|
void |
addScript(Script script)
Add a Script to this AssetManager
|
protected java.util.Properties |
decrypt(java.util.Properties properties)
Helper method to allow "CRYPT::" prefixed encrypted values in Properties to be decrypted before use.
|
protected java.lang.String |
decrypt(java.lang.String encrypted)
Helper method to allow "CRYPT::" prefixed encrypted values to be decrypted before use.
|
abstract void |
destroy()
This method is called when a User Artifact is being removed or on disabling an enabled User Artifact
or on initialization failure.
|
int |
getAvailableProcessingUnits()
Get the available processing units for this Asset Manager.
|
AssetManagerConfig |
getConfig()
Gets the AssetManagerConfig implementation.
|
java.lang.String |
getDetailTemplate()
Gets the Velocity template used for the detail view of the Asset Managers page in the Administration Tool.
|
static java.util.logging.Logger |
getLogger()
Gets the "Assets" component logger.
|
AssetProvider |
getProvider()
Gets the AssetProvider implementation.
|
Script |
getScript(int idx)
Get the Script at the specified index
|
int |
getScriptCount()
Get the number of Scripts
|
Script[] |
getScripts()
Get the Scripts for this AssetManager
|
int |
getStatus()
Gets the status of the Asset Manager.
|
java.lang.String |
getStatusString()
Returns the String representation of the status code.
|
AssetManagementStrategy |
getStrategy()
Gets the AssetManagementStrategy implementation.
|
abstract java.lang.String |
getSummary()
Gets a summary status of the Asset Manager that is available from the Administration Tool and the Admin API.
|
abstract void |
handleAlert(java.util.Properties props)
This method gets called when an alert is posted on the Broker.
|
abstract void |
handleAllocation(AllocationMapInfo allocation)
This method gets called when the allocation changes.
|
void |
handleApplicationPolicyChanged(ApplicationInfo application,
java.lang.String scheduleName)
Deprecated.
|
void |
handleApplicationStarted(ApplicationInfo application)
Deprecated.
use
AssetManager.handleStackStarted(StackInfo) instead. |
void |
handleApplicationStopped(ApplicationInfo application)
Deprecated.
use
AssetManager.handleStackStopped(StackInfo) instead. |
void |
handleArchiveScaled(boolean scaledUp,
java.lang.String archiveName,
java.lang.String archiveId,
java.lang.String component)
This method gets called when an archived is scaled.
|
abstract void |
handleBrokerAdded(java.util.Properties broker)
This method gets called when the Primary or Failover Broker is added to this Broker.
|
abstract void |
handleBrokerRemoved(java.util.Properties broker)
This method gets called when the Primary or Failover Broker was removed from this Broker.
|
abstract void |
handleClientAdded(java.util.Properties props)
This method gets called when a VirtualRouter client was added to the Broker.
|
abstract void |
handleClientRemoved(java.util.Properties props)
This method gets called when a VirtualRouter client was removed from the Broker.
|
void |
handleComponentInstanceAdded(ActivationInfo component)
This method gets called when a Component instance finishes activation.
|
void |
handleComponentInstanceRemoved(ActivationInfo component)
This method gets called when a Component instance starts deactivation.
|
void |
handleComponentInstanceUpdated(ActivationInfo info)
This method gets called when a running component's ActivationInfo is updated via a call to the
Container.updateActivationInfoProperties(ActivationInfo)
method. |
void |
handleDomainInstanceAdded(ActivationInfo component)
Deprecated.
|
void |
handleDomainInstanceRemoved(ActivationInfo component)
Deprecated.
|
abstract void |
handleEffectivePolicyChanged()
This method gets called when the effective Policy has changed.
|
abstract void |
handleEngineAdded(FabricEngineInfo engine)
This method gets called when an Engine was added to the Broker.
|
abstract void |
handleEngineDaemonAdded(FabricEngineDaemonInfo daemon)
This method gets called when an Engine Daemon was added to the Broker.
|
void |
handleEngineDaemonDrainingStarted(FabricEngineDaemonInfo daemon)
This method gets called when an Engine Daemon was put into Draining mode.
|
void |
handleEngineDaemonDrainingStopped(FabricEngineDaemonInfo daemon)
This method gets called when an Engine Daemon was removed from Draining mode.
|
abstract void |
handleEngineDaemonRemoved(FabricEngineDaemonInfo daemon)
This method gets called when an Engine Daemon was removed from the Broker.
|
abstract void |
handleEngineRemoved(FabricEngineInfo engine)
This method gets called when an Engine was removed from the Broker.
|
abstract void |
handleFailback()
This method gets called when the Primary Broker is added to the Failover Broker.
|
void |
handleStackPolicyChanged(StackInfo stack,
java.lang.String scheduleName)
This method gets called when an active Policy changed for a Stack that is part of the effective Policy.
|
void |
handleStackStarted(StackInfo stack)
This method gets called when a Stack is added to the effective Policy.
|
void |
handleStackStopped(StackInfo stack)
This method gets called when a Stack is removed from the effective Policy.
|
abstract void |
init()
This method is called to initialize a newly loaded User Artifact and also on enabling a disabled User Artifact.
|
void |
postAlert(int severity,
java.lang.String description,
java.util.Properties props)
A convenience method for posting alerts to the Broker.
|
void |
removeScript(int idx)
Remove the Script at the specified index
|
void |
setConfig(AssetManagerConfig config)
Sets the AssetManagerConfig implementation.
|
void |
setDetailTemplate(java.lang.String detailTemplate)
Sets the Velocity template used for the detail view of the Asset Managers page in the Administration Tool.
|
void |
setProvider(AssetProvider provider)
Sets the AssetProvider implementation.
|
void |
setStatus(int status)
Sets the Asset Manager status.
|
void |
setStrategy(AssetManagementStrategy strategy)
Sets the AssetManagementStrategy implementation.
|
equals, getDescription, getLastModified, getModifiedBy, getName, hashCode, isEnabled, setDescription, setEnabled, setLastModified, setModifiedBy, setName, toString
public static final int STATUS_DISABLED
public static final int STATUS_ENABLED
public static final int STATUS_ERROR
public static final java.lang.String STATUS_STRING_DISABLED
public static final java.lang.String STATUS_STRING_ENABLED
public static final java.lang.String STATUS_STRING_ERROR
public static final int ALERT_HIGH_SEVERITY
public static final int ALERT_MED_SEVERITY
public static final int ALERT_LOW_SEVERITY
public java.lang.String getDetailTemplate()
public void setDetailTemplate(java.lang.String detailTemplate)
detailTemplate
- the template file namepublic AssetManagerConfig getConfig()
public void setConfig(AssetManagerConfig config)
config
- the AssetManagerConfig implementationpublic AssetManagementStrategy getStrategy()
public void setStrategy(AssetManagementStrategy strategy)
strategy
- the AssetManagementStrategy implementationpublic AssetProvider getProvider()
public void setProvider(AssetProvider provider)
strategy
- the AssetProvider implementationpublic void addScript(Script script)
script
- the scriptpublic int getScriptCount()
public Script getScript(int idx)
idx
- the index of the Script to retrievepublic void removeScript(int idx)
idx
- the index of the Script to removepublic Script[] getScripts()
public int getAvailableProcessingUnits()
public static java.util.logging.Logger getLogger()
public int getStatus()
public void setStatus(int status)
AssetManager.STATUS_ENABLED
, AssetManager.STATUS_DISABLED
, or AssetManager.STATUS_ERROR
, but users may specify alternate status codes.status
- the statuspublic java.lang.String getStatusString()
AssetManager.STATUS_STRING_ENABLED
, AssetManager.STATUS_STRING_DISABLED
, and AssetManager.STATUS_ERROR
.public void postAlert(int severity, java.lang.String description, java.util.Properties props) throws java.lang.Exception
severity
- the severity of the alert: AssetManager.ALERT_HIGH_SEVERITY
, AssetManager.ALERT_MED_SEVERITY
, or AssetManager.ALERT_LOW_SEVERITY
description
- the alert descriptionprops
- additional alert propertiesjava.lang.Exception
public abstract java.lang.String getSummary()
public abstract void init() throws java.lang.Exception
UserArtifact
java.lang.Exception
- if initialization failspublic abstract void destroy()
UserArtifact
public abstract void handleEngineAdded(FabricEngineInfo engine) throws java.lang.Exception
engine
- the Engine informationjava.lang.Exception
- when a problem occurs in the method implementationpublic abstract void handleEngineRemoved(FabricEngineInfo engine) throws java.lang.Exception
engine
- the Engine informationjava.lang.Exception
- when a problem occurs in the method implementationpublic abstract void handleEngineDaemonAdded(FabricEngineDaemonInfo daemon) throws java.lang.Exception
engine
- the Engine Daemon informationjava.lang.Exception
- when a problem occurs in the method implementationpublic abstract void handleEngineDaemonRemoved(FabricEngineDaemonInfo daemon) throws java.lang.Exception
engine
- the Engine Daemon informationjava.lang.Exception
- when a problem occurs in the method implementationpublic void handleEngineDaemonDrainingStarted(FabricEngineDaemonInfo daemon) throws java.lang.Exception
engine
- the Engine Daemon informationjava.lang.Exception
- when a problem occurs in the method implementationpublic void handleEngineDaemonDrainingStopped(FabricEngineDaemonInfo daemon) throws java.lang.Exception
engine
- the Engine Daemon informationjava.lang.Exception
- when a problem occurs in the method implementationpublic abstract void handleBrokerAdded(java.util.Properties broker) throws java.lang.Exception
broker
- the Broker propertiesjava.lang.Exception
- when a problem occurs in the method implementationpublic abstract void handleBrokerRemoved(java.util.Properties broker) throws java.lang.Exception
broker
- the Broker propertiesjava.lang.Exception
- when a problem occurs in the method implementationpublic abstract void handleClientAdded(java.util.Properties props) throws java.lang.Exception
props
- the client propertiesjava.lang.Exception
- when a problem occurs in the method implementationpublic abstract void handleClientRemoved(java.util.Properties props) throws java.lang.Exception
props
- the client propertiesjava.lang.Exception
- when a problem occurs in the method implementationpublic abstract void handleAlert(java.util.Properties props) throws java.lang.Exception
FabricServerEvent.ALERT_DESCRIPTION
and FabricServerEvent.ALERT_SEVERITY
respectively.props
- the alert propertiesjava.lang.Exception
- when a problem occurs in the method implementationpublic void handleComponentInstanceAdded(ActivationInfo component) throws java.lang.Exception
component
- the component activation informationjava.lang.Exception
- when a problem occurs in the method implementationpublic void handleDomainInstanceAdded(ActivationInfo component) throws java.lang.Exception
AssetManager.handleComponentInstanceAdded(ActivationInfo)
instead.component
- java.lang.Exception
public void handleComponentInstanceRemoved(ActivationInfo component) throws java.lang.Exception
component
- the component activation informationjava.lang.Exception
- when a problem occurs in the method implementationpublic void handleDomainInstanceRemoved(ActivationInfo component) throws java.lang.Exception
AssetManager.handleComponentInstanceRemoved(ActivationInfo)
instead.java.lang.Exception
public abstract void handleEffectivePolicyChanged() throws java.lang.Exception
java.lang.Exception
- when a problem occurs in the method implementationpublic void handleStackStarted(StackInfo stack) throws java.lang.Exception
stack
- the stack informationjava.lang.Exception
- when a problem occurs in the method implementationpublic void handleApplicationStarted(ApplicationInfo application) throws java.lang.Exception
AssetManager.handleStackStarted(StackInfo)
instead.java.lang.Exception
public void handleStackStopped(StackInfo stack) throws java.lang.Exception
stack
- the stack informationjava.lang.Exception
- when a problem occurs in the method implementationpublic void handleApplicationStopped(ApplicationInfo application) throws java.lang.Exception
AssetManager.handleStackStopped(StackInfo)
instead.java.lang.Exception
public void handleStackPolicyChanged(StackInfo stack, java.lang.String scheduleName) throws java.lang.Exception
stack
- the stack informationscheduleName
- the new active Policy schedulejava.lang.Exception
- when a problem occurs in the method implementationpublic void handleApplicationPolicyChanged(ApplicationInfo application, java.lang.String scheduleName) throws java.lang.Exception
AssetManager.handleStackPolicyChanged(StackInfo, String)
instead.java.lang.Exception
public abstract void handleAllocation(AllocationMapInfo allocation) throws java.lang.Exception
allocation
- the new allocationjava.lang.Exception
- when a problem occurs in the method implementationpublic abstract void handleFailback() throws java.lang.Exception
java.lang.Exception
- when a problem occurs in the method implementationpublic void handleComponentInstanceUpdated(ActivationInfo info) throws java.lang.Exception
Container.updateActivationInfoProperties(ActivationInfo)
method.info
- the component's new activation informationjava.lang.Exception
- when a problem occurs in the method implementationpublic void handleArchiveScaled(boolean scaledUp, java.lang.String archiveName, java.lang.String archiveId, java.lang.String component) throws java.lang.Exception
scaledUp
- whether the archive was scaled up or down.archiveName
- the archive namearchiveId
- the archive idcomponent
- the componentjava.lang.Exception
- when a problem occurs in the method implementationprotected java.lang.String decrypt(java.lang.String encrypted)
encrypted
- the encrypted string valuejava.lang.IllegalArgumentException
- if the encrypted string value is badprotected java.util.Properties decrypt(java.util.Properties properties)
properties
- the properties to be decryptedjava.lang.IllegalArgumentException
- if any value of the Properties value is badCopyright © 2014 TIBCO Software, Inc. All Rights Reserved.