org.fusesource.commons.management
Interface ManagementStrategy

All Known Implementing Classes:
AbstractManagementStrategy, ManagementStrategyImpl

public interface ManagementStrategy

A ManagementStrategy provides an abstraction for a high level, common set of management functions:

ManagementStrategy implementations decide how such functions are exposed (e.g. via JMX or another technology). Applications should allow for injection of a strategy implementation.


Method Summary
 Statistic createStatistic(java.lang.String name, java.lang.Object owner, Statistic.UpdateMode updateMode)
          Creates a statistic; a representation of raw statistical data.
<T> T
getManagedObjectName(java.lang.Object managableObject, java.lang.String customName, java.lang.Class<T> nameType)
          Construct an object name, where either the object to be managed and/or a custom name component are provided
 boolean isManaged(java.lang.Object managableObject, java.lang.Object name)
          Determines if an object or name is managed.
 void manageNamedObject(java.lang.Object managedObject, java.lang.Object preferedName)
          Adds a managed object allowing the ManagementStrategy implementation to record or expose the object as it sees fit.
 void manageObject(java.lang.Object managedObject)
          Adds a managed object allowing the ManagementStrategy implementation to record or expose the object as it sees fit.
 void notify(java.util.EventObject event)
          Management events provide a single model for capturing information about execution points in the application code.
 void unmanageNamedObject(java.lang.Object name)
          Removes a managed object by name.
 void unmanageObject(java.lang.Object managedObject)
          Removes the managed object.
 

Method Detail

manageObject

void manageObject(java.lang.Object managedObject)
                  throws java.lang.Exception
Adds a managed object allowing the ManagementStrategy implementation to record or expose the object as it sees fit.

Parameters:
managedObject - the managed object
Throws:
java.lang.Exception - can be thrown if the object could not be added

manageNamedObject

void manageNamedObject(java.lang.Object managedObject,
                       java.lang.Object preferedName)
                       throws java.lang.Exception
Adds a managed object allowing the ManagementStrategy implementation to record or expose the object as it sees fit.

Parameters:
managedObject - the managed object
preferedName - representing the preferred name, maybe a String, or a JMX ObjectName
Throws:
java.lang.Exception - can be thrown if the object could not be added

getManagedObjectName

<T> T getManagedObjectName(java.lang.Object managableObject,
                           java.lang.String customName,
                           java.lang.Class<T> nameType)
                       throws java.lang.Exception
Construct an object name, where either the object to be managed and/or a custom name component are provided

Parameters:
managableObject - the object to be managed
customName - a custom name component
nameType - the name type required
Returns:
an object name of the required type if supported, otherwise null
Throws:
java.lang.Exception - can be thrown if the object name could not be created

unmanageObject

void unmanageObject(java.lang.Object managedObject)
                    throws java.lang.Exception
Removes the managed object.

Parameters:
managedObject - the managed object
Throws:
java.lang.Exception - can be thrown if the object could not be removed

unmanageNamedObject

void unmanageNamedObject(java.lang.Object name)
                         throws java.lang.Exception
Removes a managed object by name.

Parameters:
name - an object name previously created by this strategy.
Throws:
java.lang.Exception - can be thrown if the object could not be removed

isManaged

boolean isManaged(java.lang.Object managableObject,
                  java.lang.Object name)
Determines if an object or name is managed.

Parameters:
managableObject - the object to consider
name - the name to consider
Returns:
true if the given object or name is managed

notify

void notify(java.util.EventObject event)
            throws java.lang.Exception
Management events provide a single model for capturing information about execution points in the application code. Management strategy implementations decide if and where to record these events. Applications communicate events to management strategy implementations via the notify(EventObject) method.

Parameters:
event - the event
Throws:
java.lang.Exception - can be thrown if the notification failed

createStatistic

Statistic createStatistic(java.lang.String name,
                          java.lang.Object owner,
                          Statistic.UpdateMode updateMode)
Creates a statistic; a representation of raw statistical data.

Parameters:
name - The unique name assigned to the statistic usage.
owner - The object whose identity is to be associated with the metric.
updateMode - The update mode to be assigned to the returned statistic.
Returns:
the statistic
See Also:
Statistic.UpdateMode


Copyright © 2009 FuseSource. All Rights Reserved.