eXo Kernel :: Container 2.5.0-GA

org.exoplatform.container.jmx
Class MX4JComponentAdapter<T>

java.lang.Object
  extended by org.exoplatform.container.AbstractComponentAdapter<T>
      extended by org.exoplatform.container.jmx.MX4JComponentAdapter<T>
All Implemented Interfaces:
Serializable, javax.enterprise.context.spi.Contextual<T>, javax.enterprise.inject.spi.PassivationCapable, ComponentAdapter<T>
Direct Known Subclasses:
ManageableComponentAdapter

public class MX4JComponentAdapter<T>
extends AbstractComponentAdapter<T>
implements javax.enterprise.context.spi.Contextual<T>, javax.enterprise.inject.spi.PassivationCapable

Version:
$Revision: 1.5 $
Author:
James Strachan, Mauro Talevi, Jeppe Cramon, Benjamin Mestrallet
See Also:
Serialized Form

Field Summary
protected  ExoContainer exocontainer
          .
protected  T instance_
           
protected  boolean isInitialized
           
protected  boolean isSingleton
          Indicates whether or not it should be managed as a singleton
protected  Lock lock
           
protected  AtomicReference<Class<? extends Annotation>> scope
          The scope of the adapter
 
Constructor Summary
  MX4JComponentAdapter(ExoContainer holder, ConcurrentContainer container, Object key, Class<T> implementation)
           
protected MX4JComponentAdapter(ExoContainer holder, ConcurrentContainer container, Object key, Class<T> implementation, Lock lock)
           
 
Method Summary
protected  T create()
          Must be used to create Singleton or Prototype only
 T create(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          
protected  T createInstance(javax.enterprise.context.spi.Context ctx)
           
 void destroy(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          
 boolean equals(Object obj)
          
 T getComponentInstance()
          Retrieve the component instance.
 String getId()
          
 Class<? extends Annotation> getScope()
          Gives the scope of the adapter
protected static Method getSetMethod(Class<?> clazz, String name, Class<?> pluginClass)
          Finds the best "set method" according to the given method name and type of plugin
 int hashCode()
          
 boolean isSingleton()
          Indicates whether or not this adapter is a singleton
protected  boolean manageScope(boolean isSingleton, boolean isInitialized, boolean hasInjectableConstructor, boolean isInjectPresent)
          Defines the scope of the component
 
Methods inherited from class org.exoplatform.container.AbstractComponentAdapter
checkTypeCompatibility, getComponentImplementation, getComponentKey, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

instance_

protected transient volatile T instance_

lock

protected final transient Lock lock

isSingleton

protected volatile boolean isSingleton
Indicates whether or not it should be managed as a singleton


isInitialized

protected transient volatile boolean isInitialized

scope

protected final transient AtomicReference<Class<? extends Annotation>> scope
The scope of the adapter


exocontainer

protected final transient ExoContainer exocontainer
.

Constructor Detail

MX4JComponentAdapter

public MX4JComponentAdapter(ExoContainer holder,
                            ConcurrentContainer container,
                            Object key,
                            Class<T> implementation)

MX4JComponentAdapter

protected MX4JComponentAdapter(ExoContainer holder,
                               ConcurrentContainer container,
                               Object key,
                               Class<T> implementation,
                               Lock lock)
Method Detail

getComponentInstance

public T getComponentInstance()
Description copied from interface: ComponentAdapter
Retrieve the component instance. This method will usually create a new instance each time it is called, but that is not required.

Returns:
the component instance.

getScope

public Class<? extends Annotation> getScope()
Gives the scope of the adapter


createInstance

protected T createInstance(javax.enterprise.context.spi.Context ctx)

isSingleton

public boolean isSingleton()
Indicates whether or not this adapter is a singleton


getSetMethod

protected static Method getSetMethod(Class<?> clazz,
                                     String name,
                                     Class<?> pluginClass)
Finds the best "set method" according to the given method name and type of plugin

Parameters:
clazz - the Class of the target component
name - the name of the method
pluginClass - the Class of the plugin
Returns:
the "set method" corresponding to the given context

create

protected T create()
Must be used to create Singleton or Prototype only


create

public T create(javax.enterprise.context.spi.CreationalContext<T> creationalContext)

Specified by:
create in interface javax.enterprise.context.spi.Contextual<T>

destroy

public void destroy(T instance,
                    javax.enterprise.context.spi.CreationalContext<T> creationalContext)

Specified by:
destroy in interface javax.enterprise.context.spi.Contextual<T>

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

getId

public String getId()

Specified by:
getId in interface javax.enterprise.inject.spi.PassivationCapable

manageScope

protected boolean manageScope(boolean isSingleton,
                              boolean isInitialized,
                              boolean hasInjectableConstructor,
                              boolean isInjectPresent)
Defines the scope of the component

Returns:
true if the component is considered as a singleton, false otherwise.

eXo Kernel :: Container 2.5.0-GA

Copyright © 2014 eXo Platform SAS. All Rights Reserved.