|
|||||||||
| Home >> All >> org >> apache >> geronimo >> gbean >> [ runtime overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.geronimo.gbean.runtime
Class GBeanInstance

java.lang.Objectorg.apache.geronimo.gbean.runtime.GBeanInstance
- All Implemented Interfaces:
- org.apache.geronimo.kernel.management.EventProvider, org.apache.geronimo.kernel.management.ManagedObject, org.apache.geronimo.kernel.management.StateManageable
- public final class GBeanInstance
- extends java.lang.Object
- implements org.apache.geronimo.kernel.management.ManagedObject, org.apache.geronimo.kernel.management.StateManageable, org.apache.geronimo.kernel.management.EventProvider
- extends java.lang.Object
A GBeanInstance is a J2EE Management Managed Object, and is standard base for Geronimo services.
- Version:
- $Rev: 106387 $ $Date: 2004-11-23 22:16:54 -0800 (Tue, 23 Nov 2004) $
| Nested Class Summary | |
static class |
GBeanInstance.GBeanInstanceLifecycleController
|
| Field Summary | |
private java.util.Map |
attributeIndex
Attributes supported by this GBeanMBean by (String) name. |
private GBeanAttribute[] |
attributes
Attributes lookup table |
private java.lang.ClassLoader |
classLoader
The classloader used for all invocations and creating targets. |
private java.lang.reflect.Constructor |
constructor
The constructor used to create the instance |
private static int |
CREATING
|
private boolean |
dead
Has this instance been destroyed? |
private static int |
DESTROYED
|
private static int |
DESTROYING
|
private boolean |
enabled
Is this gbean enabled? A disabled gbean can not be started. |
private org.apache.geronimo.gbean.GBeanInfo |
gbeanInfo
Metadata describing the attributes, operations and references of this GBean |
private GBeanInstanceState |
gbeanInstanceState
This handles all state transiitions for this instance. |
private org.apache.geronimo.gbean.GBeanLifecycleController |
gbeanLifecycleController
The lifecycle controller given to the instance |
private int |
instanceState
The state of the internal gbean instance that we are wrapping. |
private org.apache.geronimo.kernel.Kernel |
kernel
The kernel in which this server is registered. |
private LifecycleBroadcaster |
lifecycleBroadcaster
The single listener to which we broadcast lifecycle change events. |
private static org.apache.commons.logging.Log |
log
|
private java.lang.String |
name
Our name |
private javax.management.ObjectName |
objectName
The unique name of this service. |
private java.util.Map |
operationIndex
Operations supported by this GBeanMBean by (GOperationSignature) name. |
private GBeanOperation[] |
operations
Operations lookup table |
static java.lang.String |
RAW_INVOKER
Attribute name used to retrieve the RawInvoker for the GBean |
private RawInvoker |
rawInvoker
A fast index based raw invoker for this GBean. |
private java.util.Map |
referenceIndex
References supported by this GBeanMBean by (String) name. |
private GBeanReference[] |
references
References lookup table |
private static int |
RUNNING
|
private boolean |
shouldFail
This is used to signal the creating thread that it should fail when it returns from usercode. |
private long |
startTime
The time this application started. |
private java.lang.Object |
target
Target instance of this GBean wrapper |
private java.lang.Class |
type
Java type of the wrapped GBean class |
| Constructor Summary | |
GBeanInstance(org.apache.geronimo.gbean.GBeanData gbeanData,
org.apache.geronimo.kernel.Kernel kernel,
org.apache.geronimo.kernel.DependencyManager dependencyManager,
LifecycleBroadcaster lifecycleBroadcaster,
java.lang.ClassLoader classLoader)
Construct a GBeanMBean using the supplied GBeanData and class loader |
|
| Method Summary | |
private void |
addManagedObjectAttributes(java.util.Map attributesMap)
|
private void |
addManagedObjectOperations(java.util.Map operationsMap)
|
private void |
checkIfShouldFail()
|
(package private) boolean |
createInstance()
|
(package private) boolean |
destroyInstance(boolean stop)
|
void |
die()
|
boolean |
equals(java.lang.Object obj)
Determine whether this Object is semantically equal to another Object. |
java.lang.Object |
getAttribute(int index)
Gets the attribute value using the attribute index. |
java.lang.Object |
getAttribute(java.lang.String attributeName)
Gets an attribute's value by name. |
private GBeanAttribute |
getAttributeByName(java.lang.String name)
|
java.util.Map |
getAttributeIndex()
Gets an unmodifiable map from attribute names to index number (Integer). |
java.lang.ClassLoader |
getClassLoader()
The class loader used to build this gbean. |
java.lang.String[] |
getEventTypes()
Gets the event types this object can fire. |
org.apache.geronimo.gbean.GBeanData |
getGBeanData()
Gets the gbean data for the gbean held by this gbean mbean. |
org.apache.geronimo.gbean.GBeanInfo |
getGBeanInfo()
Gets the GBeanInfo used to build this gbean. |
java.lang.String |
getName()
Gets the name of the GBean as defined in the gbean info. |
java.lang.String |
getObjectName()
Gets the unique name of this object. |
javax.management.ObjectName |
getObjectNameObject()
|
java.util.Map |
getOperationIndex()
Gets an unmodifiable map from operation signature (GOperationSignature) to index number (Integer). |
private GBeanReference |
getReferenceByName(java.lang.String name)
|
long |
getStartTime()
Gets the start time of this component |
int |
getState()
Gets the state of this component as an int. |
org.apache.geronimo.kernel.management.State |
getStateInstance()
Gets the state of this component as a State instance. |
java.lang.Object |
getTarget()
|
java.lang.Class |
getType()
The java type of the wrapped gbean instance |
int |
hashCode()
Get a value that represents this Object, as uniquely as possible within the confines of an int. |
java.lang.Object |
invoke(int index,
java.lang.Object[] arguments)
Invokes an opreation using the operation index. |
java.lang.Object |
invoke(java.lang.String operationName,
java.lang.Object[] arguments,
java.lang.String[] types)
Invokes an operation on the target gbean by method signature. |
boolean |
isDead()
Has this gbean instance been destroyed. |
boolean |
isEnabled()
Is this gbean enabled. |
boolean |
isEventProvider()
Determines if this object implemnts the event provider type defined in the J2EE Management specification. |
boolean |
isStateManageable()
Determines if this object implements the state manageable type defined in the J2EE Management specification. |
boolean |
isStatisticsProvider()
Determines if this object implements the statistics provider type defined in the J2EE Management specification. |
private org.apache.geronimo.gbean.GBeanInfo |
rebuildGBeanInfo(org.apache.geronimo.gbean.GConstructorInfo constructor,
java.lang.String j2eeType)
|
(package private) void |
referenceFailed()
Moves this GBeanInstance to the FAILED state. |
void |
setAttribute(int index,
java.lang.Object value)
Sets the attribute value using the attribute index. |
void |
setAttribute(java.lang.String attributeName,
java.lang.Object value)
Sets an attribute's value by name. |
void |
setEnabled(boolean enabled)
Changes the enabled status. |
void |
start()
Moves this GBeanInstance to the starting state and then attempts to move this MBean immediately to the running state. |
void |
startRecursive()
Starts this GBeanInstance and then attempts to start all of its start dependent children. |
void |
stop()
Moves this GBeanInstance to the STOPPING state, calls stop on all start dependent children, and then attempt to move this MBean to the STOPPED state. |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
log
private static final org.apache.commons.logging.Log log
DESTROYED
private static final int DESTROYED
- See Also:
- Constant Field Values
CREATING
private static final int CREATING
- See Also:
- Constant Field Values
RUNNING
private static final int RUNNING
- See Also:
- Constant Field Values
DESTROYING
private static final int DESTROYING
- See Also:
- Constant Field Values
RAW_INVOKER
public static final java.lang.String RAW_INVOKER
- Attribute name used to retrieve the RawInvoker for the GBean
- See Also:
- Constant Field Values
kernel
private final org.apache.geronimo.kernel.Kernel kernel
- The kernel in which this server is registered.
objectName
private final javax.management.ObjectName objectName
- The unique name of this service.
gbeanInstanceState
private final GBeanInstanceState gbeanInstanceState
- This handles all state transiitions for this instance.
constructor
private final java.lang.reflect.Constructor constructor
- The constructor used to create the instance
rawInvoker
private final RawInvoker rawInvoker
- A fast index based raw invoker for this GBean.
lifecycleBroadcaster
private final LifecycleBroadcaster lifecycleBroadcaster
- The single listener to which we broadcast lifecycle change events.
gbeanLifecycleController
private final org.apache.geronimo.gbean.GBeanLifecycleController gbeanLifecycleController
- The lifecycle controller given to the instance
attributes
private final GBeanAttribute[] attributes
- Attributes lookup table
attributeIndex
private final java.util.Map attributeIndex
- Attributes supported by this GBeanMBean by (String) name.
references
private final GBeanReference[] references
- References lookup table
referenceIndex
private final java.util.Map referenceIndex
- References supported by this GBeanMBean by (String) name.
operations
private final GBeanOperation[] operations
- Operations lookup table
operationIndex
private final java.util.Map operationIndex
- Operations supported by this GBeanMBean by (GOperationSignature) name.
classLoader
private final java.lang.ClassLoader classLoader
- The classloader used for all invocations and creating targets.
gbeanInfo
private final org.apache.geronimo.gbean.GBeanInfo gbeanInfo
- Metadata describing the attributes, operations and references of this GBean
name
private final java.lang.String name
- Our name
type
private final java.lang.Class type
- Java type of the wrapped GBean class
dead
private boolean dead
- Has this instance been destroyed?
instanceState
private int instanceState
- The state of the internal gbean instance that we are wrapping.
target
private java.lang.Object target
- Target instance of this GBean wrapper
startTime
private long startTime
- The time this application started.
enabled
private boolean enabled
- Is this gbean enabled? A disabled gbean can not be started.
shouldFail
private boolean shouldFail
- This is used to signal the creating thread that it should
fail when it returns from usercode. This is set when a
reference has gone offline during construction.
| Constructor Detail |
GBeanInstance
public GBeanInstance(org.apache.geronimo.gbean.GBeanData gbeanData, org.apache.geronimo.kernel.Kernel kernel, org.apache.geronimo.kernel.DependencyManager dependencyManager, LifecycleBroadcaster lifecycleBroadcaster, java.lang.ClassLoader classLoader) throws org.apache.geronimo.gbean.InvalidConfigurationException
- Construct a GBeanMBean using the supplied GBeanData and class loader
| Method Detail |
die
public void die()
throws org.apache.geronimo.kernel.GBeanNotFoundException
getName
public java.lang.String getName()
- Gets the name of the GBean as defined in the gbean info.
getClassLoader
public java.lang.ClassLoader getClassLoader()
- The class loader used to build this gbean. This class loader is set into the thread context
class loader before callint the target instace.
isDead
public boolean isDead()
- Has this gbean instance been destroyed. An destroyed gbean can no longer be used.
getType
public java.lang.Class getType()
- The java type of the wrapped gbean instance
getTarget
public java.lang.Object getTarget()
getObjectName
public final java.lang.String getObjectName()
- Description copied from interface:
org.apache.geronimo.kernel.management.ManagedObject - Gets the unique name of this object. The object name must comply with the ObjectName specification
in the JMX specification and the restrictions in the J2EEManagementInterface.
- Specified by:
getObjectNamein interfaceorg.apache.geronimo.kernel.management.ManagedObject
getObjectNameObject
public final javax.management.ObjectName getObjectNameObject()
isEnabled
public final boolean isEnabled()
- Is this gbean enabled. A disabled gbean can not be started.
setEnabled
public final void setEnabled(boolean enabled)
- Changes the enabled status.
isStateManageable
public final boolean isStateManageable()
- Description copied from interface:
org.apache.geronimo.kernel.management.ManagedObject - Determines if this object implements the state manageable type defined in the J2EE Management specification.
- Specified by:
isStateManageablein interfaceorg.apache.geronimo.kernel.management.ManagedObject
isStatisticsProvider
public boolean isStatisticsProvider()
- Description copied from interface:
org.apache.geronimo.kernel.management.ManagedObject - Determines if this object implements the statistics provider type defined in the J2EE Management specification.
- Specified by:
isStatisticsProviderin interfaceorg.apache.geronimo.kernel.management.ManagedObject
isEventProvider
public final boolean isEventProvider()
- Description copied from interface:
org.apache.geronimo.kernel.management.ManagedObject - Determines if this object implemnts the event provider type defined in the J2EE Management specification.
- Specified by:
isEventProviderin interfaceorg.apache.geronimo.kernel.management.ManagedObject
getEventTypes
public final java.lang.String[] getEventTypes()
- Description copied from interface:
org.apache.geronimo.kernel.management.EventProvider - Gets the event types this object can fire.
- Specified by:
getEventTypesin interfaceorg.apache.geronimo.kernel.management.EventProvider
getStartTime
public final long getStartTime()
- Description copied from interface:
org.apache.geronimo.kernel.management.StateManageable - Gets the start time of this component
- Specified by:
getStartTimein interfaceorg.apache.geronimo.kernel.management.StateManageable
getState
public int getState()
- Description copied from interface:
org.apache.geronimo.kernel.management.StateManageable - Gets the state of this component as an int.
The int return is required by the JSR77 specification.
- Specified by:
getStatein interfaceorg.apache.geronimo.kernel.management.StateManageable
getStateInstance
public final org.apache.geronimo.kernel.management.State getStateInstance()
- Description copied from interface:
org.apache.geronimo.kernel.management.StateManageable - Gets the state of this component as a State instance.
- Specified by:
getStateInstancein interfaceorg.apache.geronimo.kernel.management.StateManageable
getAttributeIndex
public java.util.Map getAttributeIndex()
- Gets an unmodifiable map from attribute names to index number (Integer). This index number
can be used to efficiently set or retrieve an attribute value.
getOperationIndex
public java.util.Map getOperationIndex()
- Gets an unmodifiable map from operation signature (GOperationSignature) to index number (Integer).
This index number can be used to efficciently invoke the operation.
getGBeanInfo
public org.apache.geronimo.gbean.GBeanInfo getGBeanInfo()
- Gets the GBeanInfo used to build this gbean.
start
public final void start()
- Moves this GBeanInstance to the starting state and then attempts to move this MBean immediately
to the running state.
- Specified by:
startin interfaceorg.apache.geronimo.kernel.management.StateManageable
startRecursive
public final void startRecursive()
- Starts this GBeanInstance and then attempts to start all of its start dependent children.
- Specified by:
startRecursivein interfaceorg.apache.geronimo.kernel.management.StateManageable
stop
public final void stop()
- Moves this GBeanInstance to the STOPPING state, calls stop on all start dependent children, and then attempt
to move this MBean to the STOPPED state.
- Specified by:
stopin interfaceorg.apache.geronimo.kernel.management.StateManageable
referenceFailed
final void referenceFailed()
- Moves this GBeanInstance to the FAILED state. There are no calls to dependent children, but they will be
notified using standard J2EE management notification.
getGBeanData
public org.apache.geronimo.gbean.GBeanData getGBeanData()
- Gets the gbean data for the gbean held by this gbean mbean.
getAttribute
public java.lang.Object getAttribute(int index) throws java.lang.Exception
- Gets the attribute value using the attribute index. This is the most efficient way to get
an attribute as it avoids a HashMap lookup.
getAttribute
public java.lang.Object getAttribute(java.lang.String attributeName) throws org.apache.geronimo.kernel.NoSuchAttributeException, java.lang.Exception
- Gets an attribute's value by name. This get style is less efficient becuse the attribute must
first be looked up in a HashMap.
setAttribute
public void setAttribute(int index,
java.lang.Object value)
throws java.lang.Exception,
java.lang.IndexOutOfBoundsException
- Sets the attribute value using the attribute index. This is the most efficient way to set
an attribute as it avoids a HashMap lookup.
setAttribute
public void setAttribute(java.lang.String attributeName, java.lang.Object value) throws java.lang.Exception, org.apache.geronimo.kernel.NoSuchAttributeException
- Sets an attribute's value by name. This set style is less efficient becuse the attribute must
first be looked up in a HashMap.
getAttributeByName
private GBeanAttribute getAttributeByName(java.lang.String name) throws org.apache.geronimo.kernel.NoSuchAttributeException
invoke
public java.lang.Object invoke(int index, java.lang.Object[] arguments) throws java.lang.Exception
- Invokes an opreation using the operation index. This is the most efficient way to invoke
an operation as it avoids a HashMap lookup.
invoke
public java.lang.Object invoke(java.lang.String operationName, java.lang.Object[] arguments, java.lang.String[] types) throws java.lang.Exception, org.apache.geronimo.kernel.NoSuchOperationException
- Invokes an operation on the target gbean by method signature. This style if invocation is
inefficient, because the target method must be looked up in a hashmap using a freshly constructed
GOperationSignature object.
getReferenceByName
private GBeanReference getReferenceByName(java.lang.String name)
createInstance
boolean createInstance()
throws java.lang.Exception
checkIfShouldFail
private void checkIfShouldFail()
throws java.lang.Exception
destroyInstance
boolean destroyInstance(boolean stop)
throws java.lang.Exception
addManagedObjectAttributes
private void addManagedObjectAttributes(java.util.Map attributesMap)
addManagedObjectOperations
private void addManagedObjectOperations(java.util.Map operationsMap)
rebuildGBeanInfo
private org.apache.geronimo.gbean.GBeanInfo rebuildGBeanInfo(org.apache.geronimo.gbean.GConstructorInfo constructor, java.lang.String j2eeType)
equals
public boolean equals(java.lang.Object obj)
- Description copied from class:
java.lang.Object - Determine whether this Object is semantically equal
to another Object.
There are some fairly strict requirements on this method which subclasses must follow:
- It must be transitive. If
a.equals(b)andb.equals(c), thena.equals(c)must be true as well. - It must be symmetric.
a.equals(b)andb.equals(a)must have the same value. - It must be reflexive.
a.equals(a)must always be true. - It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
a.equals(null)must be false.- It must be consistent with hashCode(). That is,
a.equals(b)must implya.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.
This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for
a.equals(b)to be true even thougha.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.In general, the Collections API (
java.util) use theequalsmethod rather than the==operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.The default implementation returns
this == o. - It must be transitive. If
hashCode
public int hashCode()
- Description copied from class:
java.lang.Object - Get a value that represents this Object, as uniquely as
possible within the confines of an int.
There are some requirements on this method which subclasses must follow:
- Semantic equality implies identical hashcodes. In other
words, if
a.equals(b)is true, thena.hashCode() == b.hashCode()must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal. - It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.
Notice that since
hashCodeis used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.The default implementation returns
System.identityHashCode(this) - Semantic equality implies identical hashcodes. In other
words, if
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
|
|||||||||
| Home >> All >> org >> apache >> geronimo >> gbean >> [ runtime overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.geronimo.gbean.runtime.GBeanInstance