|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.management.NotificationBroadcasterSupport | +--org.sape.carbon.services.management.interceptor.DefaultManagementInterceptorImpl
This is an interceptor implementation that provides JMX integration for Carbon Components. It handles the DynamicMBean interface's methods and provides an XML based storage mechanism for MBeanInfo configurations.
To configure this interceptor add the following to a component template configuration:<!-- The JMX Assistant --> <DecoratorConfiguration> <Factory> org.sape.carbon.services.management.interceptor.ManagementInterceptorFactory </Factory> <CustomConfiguration ConfigurationInterface="org.sape.carbon.services.management.interceptor.ManagementInterceptorConfiguration"> <MBeanServerServiceLocation>/manage/DefaultMBeanServer</MBeanServerServiceLocation> <SendNotifications>true</SendNotifications> </CustomConfiguration> </DecoratorConfiguration>Copyright 2002 Sapient
Nested Class Summary | |
static class |
DefaultManagementInterceptorImpl.MBeanFeatureInfoComparator
This comporator may be used to order all types of MBeanFeatureInfo objects by name. |
Field Summary | |
protected Component |
component
A reference to the component that is being monitored by this interceptor. |
private Class |
componentFunctionalInterface
Holds the component functional interface. |
private ManagementInterceptorConfiguration |
config
Holds the configuration of the interceptor. |
private org.apache.commons.logging.Log |
log
Provides a handle to Apache-commons logger |
protected javax.management.MBeanInfo |
mBeanInfo
A cached copy of the MBeanInfo for this registered component. |
private String |
mbeanServerServiceName
Name of the mbean server service. |
static String |
METADATA_CONFIG_LOCATION
Config location of the management information classes. |
protected Interceptor |
nextInterceptor
The next interceptor in the chain |
private long |
notificationSequence
This long tracks the next sequence number to send in a notification |
protected javax.management.ObjectName |
objectName
The ObjectName of the registered component. |
private static String |
PROPERTY_ENVIRONMENT
Key to the environment of the MBean. |
private static String |
PROPERTY_INSTANCE
Key to the instance of the MBean. |
private static String |
PROPERTY_NAME
Key to the name of the MBean. |
private static String |
PROPERTY_TYPE
Key to the type of the MBean. |
private static String |
PROPERTY_VMID
Key to the virtual machine id of the MBean. |
private boolean |
shouldSendNotifications
Indicates if this should send notifications. |
private static String |
UNIQUE_ID
Key to the unique id of the MBean. |
Fields inherited from class javax.management.NotificationBroadcasterSupport |
|
Constructor Summary | |
DefaultManagementInterceptorImpl(ManagementInterceptorConfiguration config,
Class componentFunctionalInterface)
Constructs a ManagementInterceptor that can act as the DynamicMBean Implementation for a component. |
Method Summary | |
private void |
addConfigurationAttributes(Class configurationClass,
List attributesSet)
Introspects on the class type of a configuration in order to define the MBeanInfo metadata about it. |
protected javax.management.MBeanInfo |
buildMBeanInfo(Component component)
This method essentially aggregates all MBean Information about each interface that a component implements into a single MBeanInfo object. |
Object |
getAttribute(String attribute)
Obtains the value of a specific attribute of the Dynamic MBean. |
javax.management.AttributeList |
getAttributes(String[] attributes)
Enables the values of several attributes of the Dynamic MBean. |
Class |
getComponentType()
Gets the class of this component. |
Class[] |
getExposedInterfaces()
This should return the list of interfaces that a decorator wishes to expose through the component proxy. |
javax.management.MBeanInfo |
getMBeanInfo()
This method returns the MBeanInfo object representing the managable interfaces that are exposed by the Component being assisted. |
Object |
invoke(Invocation invocation)
Intercepts calls to the LifecycleInterceptor interface in
order to handle deregistering the MBean from the MBeanServer when
the component is destroyed. |
Object |
invoke(String actionName,
Object[] params,
String[] signature)
Handles the invocation of operations on the component represented by this MBean Assistant. |
private javax.management.MBeanParameterInfo[] |
loadParameters(MBeanInfoConfiguration.MBeanParameterInfoConfiguration[] config)
Loads an array ParameterInfoConfiguration into a JMX ParameterInfo. |
void |
sendEvent(ComponentEvent componentEvent)
Sends the supplied event to any listeners who may be listening for events on the managed component. |
void |
setAttribute(javax.management.Attribute attribute)
Sets the value of a specific attribute of the Dynamic MBean |
javax.management.AttributeList |
setAttributes(javax.management.AttributeList attributeList)
Sets as many attributes as it can from the provided list and returns a list of the attributes that were successfully set. |
void |
setComponentReference(Component component)
Called after creation to pass a reference to the component to each of its assistants. |
void |
setNextInterceptor(Interceptor interceptor)
This method sets the next interceptor as the next in the chain from the current interceptor. |
Methods inherited from class javax.management.NotificationBroadcasterSupport |
addNotificationListener, getNotificationInfo, removeNotificationListener, sendNotification |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private org.apache.commons.logging.Log log
private long notificationSequence
protected Component component
protected javax.management.ObjectName objectName
protected javax.management.MBeanInfo mBeanInfo
protected Interceptor nextInterceptor
private static final String PROPERTY_NAME
private static final String PROPERTY_TYPE
private static final String PROPERTY_ENVIRONMENT
private static final String PROPERTY_INSTANCE
private static final String PROPERTY_VMID
private static final String UNIQUE_ID
private String mbeanServerServiceName
private boolean shouldSendNotifications
private ManagementInterceptorConfiguration config
private Class componentFunctionalInterface
public static final String METADATA_CONFIG_LOCATION
Constructor Detail |
public DefaultManagementInterceptorImpl(ManagementInterceptorConfiguration config, Class componentFunctionalInterface)
config
- the configuration for a management interceptorcomponentFunctionalInterface
- the functional interface to
the componentMethod Detail |
public void setNextInterceptor(Interceptor interceptor)
setNextInterceptor
in interface Interceptor
interceptor
- the next interceptor in the chainpublic Object getAttribute(String attribute) throws javax.management.AttributeNotFoundException, javax.management.MBeanException, javax.management.ReflectionException
getAttribute
in interface javax.management.DynamicMBean
attribute
- The name of the attribute to be retrieved
javax.management.AttributeNotFoundException
- Thrown when
the specified attribute is not available
javax.management.MBeanException
- Wraps a
java.lang.Exception
thrown by the
MBean's getter.
javax.management.ReflectionException
- Wraps a
java.lang.Exception
thrown while
trying to invoke the getter.public javax.management.AttributeList getAttributes(String[] attributes)
getAttributes
in interface javax.management.DynamicMBean
attributes
- an array of string attributes to be retrieved.
public javax.management.MBeanInfo getMBeanInfo()
This method returns the MBeanInfo object representing the managable interfaces that are exposed by the Component being assisted. This metadata will include information about all manageable roles that this component has been configured to play.
getMBeanInfo
in interface javax.management.DynamicMBean
public Class getComponentType()
getComponentType
in interface ManagementInterceptor
protected javax.management.MBeanInfo buildMBeanInfo(Component component)
This method essentially aggregates all MBean Information about each
interface that a component implements into a single MBeanInfo object.
This is done by loading configuration documents for each interface that
implement a set of configuration
versions of the various
Info metadata objects. These objects are then read in to their MBeanInfo
metadata counterparts and aggregated into big lists. Then the final step
is to place them into one large MBeanInfo object and return them.
By aggregating the supported management interface for any number of roles that the component can handle we can give a JMX console user the full power of Carbon's generic delegation and configuratively additive functionality.
component
- the Component that is being represented by this
ManagementInterceptor
private void addConfigurationAttributes(Class configurationClass, List attributesSet)
configurationClass
- the Class type to construct metadata forattributesSet
- the set of attributes that will be added to for
each attribute in the supplied configuration.private javax.management.MBeanParameterInfo[] loadParameters(MBeanInfoConfiguration.MBeanParameterInfoConfiguration[] config)
Loads an array ParameterInfoConfiguration into a JMX ParameterInfo.
config
- the array of parameter info configurations to be
translated into the strictly JMX MBeanParameterInfo
objects.
public Class[] getExposedInterfaces()
getExposedInterfaces
in interface Decorator
public Object invoke(String actionName, Object[] params, String[] signature) throws javax.management.MBeanException, javax.management.ReflectionException
Handles the invocation of operations on the component represented by this MBean Assistant.
invoke
in interface javax.management.DynamicMBean
actionName
- The name of the action to be invoked.params
- An array containing the parameters to be set when the
action is invoked.signature
- An array containing the signature of the action.
The class objects will be loaded through the same class loader as
the one used for loading the MBean on which the action is invoked.
javax.management.MBeanException
- Wraps a java.lang.Exception
thrown by the MBean's invoked method.
javax.management.ReflectionException
- Wraps an exception
during reflectionpublic void setAttribute(javax.management.Attribute attribute) throws javax.management.AttributeNotFoundException, javax.management.InvalidAttributeValueException, javax.management.MBeanException, javax.management.ReflectionException
setAttribute
in interface javax.management.DynamicMBean
attribute
- The identification of the attribute to
be set and the value it is to be set to.
javax.management.AttributeNotFoundException
- Thrown when
the specified attribute is not found
javax.management.InvalidAttributeValueException
- Thrown
when the value that is being set was not valid for the
attribute
javax.management.MBeanException
- Wraps a
java.lang.Exception
thrown by the
MBean's setter.
javax.management.ReflectionException
- Wraps a
java.lang.Exception
thrown while
trying to invoke the MBean's setter.public javax.management.AttributeList setAttributes(javax.management.AttributeList attributeList)
setAttributes
in interface javax.management.DynamicMBean
attributeList
- the list of attributes to set.
public void setComponentReference(Component component)
setComponentReference
in interface Decorator
component
- a reference to the component that this interceptor is
assistingpublic Object invoke(Invocation invocation) throws Throwable
LifecycleInterceptor
interface in
order to handle deregistering the MBean from the MBeanServer when
the component is destroyed.
invoke
in interface Interceptor
invocation
- the invocation to execute
Throwable
- indicates an error in the invokation chainpublic void sendEvent(ComponentEvent componentEvent)
sendEvent
in interface EventManager
componentEvent
- The event that occured on the component.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |