com.caucho.management.j2ee
Class J2EEManagedObject

java.lang.Object
  extended by com.caucho.management.j2ee.J2EEManagedObject
Direct Known Subclasses:
EJB, J2EEDeployedObject, J2EEDomain, J2EEResource, J2EEServer, JCAConnectionFactory, JCAManagedConnectionFactory, JDBCDataSource, JDBCDriver, JVM, ResourceAdapter, Servlet

public abstract class J2EEManagedObject
extends java.lang.Object

Base class management interface for all managed objects.


Field Summary
protected  javax.management.ObjectName _objectName
           
 
Constructor Summary
J2EEManagedObject()
           
 
Method Summary
protected  javax.management.ObjectName createObjectName(java.util.Hashtable<java.lang.String,java.lang.String> properties)
          Creates the object name.
protected abstract  java.lang.String getName()
          Returns the value to use for the the `name' key of the ObjectName.
 java.lang.String getObjectName()
           
 boolean isEventProvider()
          Returns true if the object provides events
protected  boolean isJ2EEApplication()
          Returns true if the ObjectName should include the J2EEApplication key.
protected  boolean isJ2EEServer()
          Returns true if the ObjectName should include the J2EEServer key.
 boolean isStateManageable()
          Returns true if the state is manageable
 boolean isStatisticsProvider()
          Returns true if the object provides statistics
protected  java.lang.String[] queryObjectNames(java.lang.String... pattern)
          Returns a list of ObjectNames that match the specified pattern composed of keys and values.
protected  java.lang.String[] queryObjectNamesSet(java.lang.String[][] patterns)
          Returns a list of ObjectNames that match the specified patterns.
protected  java.lang.String quote(java.lang.String value)
           
static
<T extends J2EEManagedObject>
T
register(T managedObject)
          Register a J2EEManagedObject.
static void unregister(J2EEManagedObject managedObject)
          Unregister a J2EEManagedObject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_objectName

protected javax.management.ObjectName _objectName
Constructor Detail

J2EEManagedObject

public J2EEManagedObject()
Method Detail

getObjectName

public java.lang.String getObjectName()

getName

protected abstract java.lang.String getName()
Returns the value to use for the the `name' key of the ObjectName. The returned value is raw, users of the method must escape the returned value for use in an ObjectName.


isJ2EEServer

protected boolean isJ2EEServer()
Returns true if the ObjectName should include the J2EEServer key. The default implementation returns true, derived class override to return false if there should not be a J2EEServer key.


isJ2EEApplication

protected boolean isJ2EEApplication()
Returns true if the ObjectName should include the J2EEApplication key. The default implementation returns true, derived class override to return false if there should not be a J2EEApplication key.


quote

protected java.lang.String quote(java.lang.String value)

createObjectName

protected javax.management.ObjectName createObjectName(java.util.Hashtable<java.lang.String,java.lang.String> properties)
                                                throws javax.management.MalformedObjectNameException
Creates the object name.

Throws:
javax.management.MalformedObjectNameException

queryObjectNames

protected java.lang.String[] queryObjectNames(java.lang.String... pattern)
Returns a list of ObjectNames that match the specified pattern composed of keys and values. The format of the arguments is key1, value1, [keyN, valueN]. The pattern does not need to include ",*", it is added automatically.


queryObjectNamesSet

protected java.lang.String[] queryObjectNamesSet(java.lang.String[][] patterns)
Returns a list of ObjectNames that match the specified patterns. Each pattern is an array of keys and values. The pattern does not need to include ",*", it is added automatically.


isStateManageable

public boolean isStateManageable()
Returns true if the state is manageable


isStatisticsProvider

public boolean isStatisticsProvider()
Returns true if the object provides statistics


isEventProvider

public boolean isEventProvider()
Returns true if the object provides events


register

public static <T extends J2EEManagedObject> T register(T managedObject)
Register a J2EEManagedObject. This method never throws an exception, any Throwable is caught and logged.

Returns:
the managed object if it is registered, null if there is an error.

unregister

public static void unregister(J2EEManagedObject managedObject)
Unregister a J2EEManagedObject. This method never throws an exception, any Throwable is caught and logged.

Parameters:
managedObject - the managed object, can be null in which case nothing is done.