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 Form| Modifier 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 String |
STATUS_STRING_DISABLED
Enabled status String
|
static String |
STATUS_STRING_ENABLED
Disabled status String
|
static 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 Properties |
decrypt(Properties properties)
Helper method to allow "CRYPT::" prefixed encrypted values in Properties to be decrypted before use.
|
protected String |
decrypt(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.
|
String |
getDetailTemplate()
Gets the Velocity template used for the detail view of the Asset Managers page in the Administration Tool.
|
static 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.
|
String |
getStatusString()
Returns the String representation of the status code.
|
AssetManagementStrategy |
getStrategy()
Gets the AssetManagementStrategy implementation.
|
abstract String |
getSummary()
Gets a summary status of the Asset Manager that is available from the Administration Tool and the Admin API.
|
abstract void |
handleAlert(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,
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,
String archiveName,
String archiveId,
String component)
This method gets called when an archived is scaled.
|
abstract void |
handleBrokerAdded(Properties broker)
This method gets called when the Primary or Failover Broker is added to this Broker.
|
abstract void |
handleBrokerRemoved(Properties broker)
This method gets called when the Primary or Failover Broker was removed from this Broker.
|
abstract void |
handleClientAdded(Properties props)
This method gets called when a VirtualRouter client was added to the Broker.
|
abstract void |
handleClientRemoved(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,
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,
String description,
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(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, toStringpublic static final int STATUS_DISABLED
public static final int STATUS_ENABLED
public static final int STATUS_ERROR
public static final String STATUS_STRING_DISABLED
public static final String STATUS_STRING_ENABLED
public static final 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 String getDetailTemplate()
public void setDetailTemplate(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 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 String getStatusString()
AssetManager.STATUS_STRING_ENABLED, AssetManager.STATUS_STRING_DISABLED, and AssetManager.STATUS_ERROR.public void postAlert(int severity,
String description,
Properties props)
throws Exception
severity - the severity of the alert: AssetManager.ALERT_HIGH_SEVERITY, AssetManager.ALERT_MED_SEVERITY, or AssetManager.ALERT_LOW_SEVERITYdescription - the alert descriptionprops - additional alert propertiesExceptionpublic abstract String getSummary()
public abstract void init()
throws Exception
UserArtifactException - if initialization failspublic abstract void destroy()
UserArtifactpublic abstract void handleEngineAdded(FabricEngineInfo engine) throws Exception
engine - the Engine informationException - when a problem occurs in the method implementationpublic abstract void handleEngineRemoved(FabricEngineInfo engine) throws Exception
engine - the Engine informationException - when a problem occurs in the method implementationpublic abstract void handleEngineDaemonAdded(FabricEngineDaemonInfo daemon) throws Exception
engine - the Engine Daemon informationException - when a problem occurs in the method implementationpublic abstract void handleEngineDaemonRemoved(FabricEngineDaemonInfo daemon) throws Exception
engine - the Engine Daemon informationException - when a problem occurs in the method implementationpublic void handleEngineDaemonDrainingStarted(FabricEngineDaemonInfo daemon) throws Exception
engine - the Engine Daemon informationException - when a problem occurs in the method implementationpublic void handleEngineDaemonDrainingStopped(FabricEngineDaemonInfo daemon) throws Exception
engine - the Engine Daemon informationException - when a problem occurs in the method implementationpublic abstract void handleBrokerAdded(Properties broker) throws Exception
broker - the Broker propertiesException - when a problem occurs in the method implementationpublic abstract void handleBrokerRemoved(Properties broker) throws Exception
broker - the Broker propertiesException - when a problem occurs in the method implementationpublic abstract void handleClientAdded(Properties props) throws Exception
props - the client propertiesException - when a problem occurs in the method implementationpublic abstract void handleClientRemoved(Properties props) throws Exception
props - the client propertiesException - when a problem occurs in the method implementationpublic abstract void handleAlert(Properties props) throws Exception
FabricServerEvent.ALERT_DESCRIPTION and FabricServerEvent.ALERT_SEVERITY
respectively.props - the alert propertiesException - when a problem occurs in the method implementationpublic void handleComponentInstanceAdded(ActivationInfo component) throws Exception
component - the component activation informationException - when a problem occurs in the method implementationpublic void handleDomainInstanceAdded(ActivationInfo component) throws Exception
AssetManager.handleComponentInstanceAdded(ActivationInfo) instead.component - Exceptionpublic void handleComponentInstanceRemoved(ActivationInfo component) throws Exception
component - the component activation informationException - when a problem occurs in the method implementationpublic void handleDomainInstanceRemoved(ActivationInfo component) throws Exception
AssetManager.handleComponentInstanceRemoved(ActivationInfo) instead.Exceptionpublic abstract void handleEffectivePolicyChanged()
throws Exception
Exception - when a problem occurs in the method implementationpublic void handleStackStarted(StackInfo stack) throws Exception
stack - the stack informationException - when a problem occurs in the method implementationpublic void handleApplicationStarted(ApplicationInfo application) throws Exception
AssetManager.handleStackStarted(StackInfo) instead.Exceptionpublic void handleStackStopped(StackInfo stack) throws Exception
stack - the stack informationException - when a problem occurs in the method implementationpublic void handleApplicationStopped(ApplicationInfo application) throws Exception
AssetManager.handleStackStopped(StackInfo) instead.Exceptionpublic void handleStackPolicyChanged(StackInfo stack, String scheduleName) throws Exception
stack - the stack informationscheduleName - the new active Policy scheduleException - when a problem occurs in the method implementationpublic void handleApplicationPolicyChanged(ApplicationInfo application, String scheduleName) throws Exception
AssetManager.handleStackPolicyChanged(StackInfo, String) instead.Exceptionpublic abstract void handleAllocation(AllocationMapInfo allocation) throws Exception
allocation - the new allocationException - when a problem occurs in the method implementationpublic abstract void handleFailback()
throws Exception
Exception - when a problem occurs in the method implementationpublic void handleComponentInstanceUpdated(ActivationInfo info) throws Exception
Container.updateActivationInfoProperties(ActivationInfo)
method.info - the component's new activation informationException - when a problem occurs in the method implementationpublic void handleArchiveScaled(boolean scaledUp,
String archiveName,
String archiveId,
String component)
throws Exception
scaledUp - whether the archive was scaled up or down.archiveName - the archive namearchiveId - the archive idcomponent - the componentException - when a problem occurs in the method implementationprotected String decrypt(String encrypted)
encrypted - the encrypted string valueIllegalArgumentException - if the encrypted string value is badprotected Properties decrypt(Properties properties)
properties - the properties to be decryptedIllegalArgumentException - if any value of the Properties value is badCopyright © 2016 TIBCO Software, Inc. All Rights Reserved.