|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.picocontainer.behaviors.AbstractBehavior<T>
org.picocontainer.gems.jmx.JMXExposed<T>
public class JMXExposed<T>
ComponentAdapter
that is exposing a component as MBean in a MBeanServer.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.picocontainer.ComponentAdapter |
---|
ComponentAdapter.NOTHING |
Field Summary |
---|
Fields inherited from class org.picocontainer.behaviors.AbstractBehavior |
---|
delegate |
Constructor Summary | |
---|---|
JMXExposed(ComponentAdapter<T> delegate,
MBeanServer mBeanServer)
Construct a JMXExposed behaviour. |
|
JMXExposed(ComponentAdapter<T> delegate,
MBeanServer mBeanServer,
DynamicMBeanProvider[] providers)
Construct a JMXExposed behaviour |
Method Summary | |
---|---|
void |
dispose(Object component)
Invokes delegate dispose method if the delegate is a LifecycleStrategy Invoke the "dispose" method on the component instance if this is disposable. |
T |
getComponentInstance(PicoContainer container,
Type into)
Retrieve the component instance. |
String |
getDescriptor()
Get a string key descriptor of the component adapter. |
boolean |
hasLifecycle(Class<?> type)
Invokes delegate hasLifecycle(Class) method if the delegate is a LifecycleStrategy Test if a component instance has a lifecycle. |
Methods inherited from class org.picocontainer.behaviors.AbstractBehavior |
---|
accept, changeMonitor, componentHasLifecycle, currentMonitor, dispose, findAdapterOfType, getComponentImplementation, getComponentInstance, getComponentKey, getDelegate, start, start, stop, stop, toString, verify |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JMXExposed(ComponentAdapter<T> delegate, MBeanServer mBeanServer, DynamicMBeanProvider[] providers) throws NullPointerException
delegate
- The delegated ComponentAdapter
.mBeanServer
- The MBeanServer
used for registering the MBean.providers
- An array with providers for converting the component instance into a
DynamicMBean
.
NullPointerException
- Thrown if the MBeanServer
or the array with the DynamicMBeanProvider
instances is null.public JMXExposed(ComponentAdapter<T> delegate, MBeanServer mBeanServer) throws NullPointerException
DynamicMBeanComponentProvider
as default to
register any component instance in the MBeanServer
, that is already a
DynamicMBean
.
delegate
- The delegated ComponentAdapter
.mBeanServer
- The MBeanServer
used for registering the MBean.
NullPointerException
- Thrown if the MBeanServer
or the array with the DynamicMBeanProvider
instances is null.Method Detail |
---|
public T getComponentInstance(PicoContainer container, Type into) throws PicoCompositionException
MBeanServer
,
if a provider can return a DynamicMBean
for it.
Note, that you will have to wrap this ComponentAdapter
with a Cached
to avoid
the registration of the same component again.
getComponentInstance
in interface ComponentAdapter<T>
getComponentInstance
in class AbstractBehavior<T>
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.into
- the class that is about to be injected into. Use ComponentAdapter.NOTHING.class if this is not important to you.
PicoCompositionException
- Thrown by the delegate or if the registering of the
DynamicMBean
in the MBeanServer
fails.AbstractBehavior#getComponentInstance(org.picocontainer.PicoContainer, java.lang.Class)
public String getDescriptor()
ComponentAdapter
public void dispose(Object component)
AbstractBehavior
dispose
in interface LifecycleStrategy
dispose
in class AbstractBehavior<T>
component
- the instance of the component to disposepublic boolean hasLifecycle(Class<?> type)
AbstractBehavior
hasLifecycle
in interface LifecycleStrategy
hasLifecycle
in class AbstractBehavior<T>
type
- the component's type
true
if the component has a lifecycle
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |