org.objectweb.easybeans.container.session
Class SessionFactory<PoolType>

java.lang.Object
  extended by org.objectweb.easybeans.container.AbsFactory
      extended by org.objectweb.easybeans.container.session.SessionFactory<PoolType>
Type Parameters:
PoolType - the type of bean instance.
All Implemented Interfaces:
Factory
Direct Known Subclasses:
StatefulSessionFactory, StatelessSessionFactory

public abstract class SessionFactory<PoolType>
extends AbsFactory

This class manages the session bean and its creation/lifecycle.

Author:
Florent Benoit

Field Summary
private  java.lang.Class<PoolType> beanClass
          Class used to build bean's instance.
private  java.lang.String className
          Name of the class of the managed bean.
private  EZBContainer container
          Container that created this factory.
private  java.util.Map<java.lang.Long,java.lang.reflect.Method> hashes
          Keep a direct reference to the method so that we don't need to compute each time the method object to invoke.
http://java.sun.com/j2se/1.5.0/docs/guide/rmi/spec/rmi-stubs24.html
private  javax.naming.Context javaContext
          Context for java: lookups.
private static JLog logger
          Logger.
private static NamingManager namingManager
          Reference on the naming manager.
private  Pool<PoolType,java.lang.Long> pool
          Pool that manage beans instance.
private  SessionBeanInfo sessionBeanInfo
          Session Desc (deployment info).
 
Constructor Summary
SessionFactory(java.lang.String className, EZBContainer container)
          Builds a new factory with a given name and its container.
 
Method Summary
protected  java.lang.Class<PoolType> getBeanClass()
          Gets the bean's class.
 IBeanInfo getBeanInfo()
          Gets the bean information.
 java.lang.String getClassName()
          Gets the className used by this factory.
 EZBContainer getContainer()
          Gets the container used by this factory.
protected  java.util.Map<java.lang.Long,java.lang.reflect.Method> getHashes()
          Gets the computed hashes.
 javax.naming.Context getJavaContext()
          Gets the java: context.
protected static NamingManager getNamingManager()
          Gets the reference on the naming manager.
protected  Pool<PoolType,java.lang.Long> getPool()
          Gets the pool used by this factory.
 SessionBeanInfo getSessionBeanInfo()
           
protected  void setBeanClass(java.lang.Class<PoolType> beanClass)
          Sets the bean class that will be used to build bean's instance.
protected  void setHashes(java.util.Map<java.lang.Long,java.lang.reflect.Method> hashes)
          Sets the hashes for the current bean class.
 void setJavaContext(javax.naming.Context javaContext)
          Sets the java: context.
protected  void setPool(Pool<PoolType,java.lang.Long> pool)
          Sets the pool used by this factory.
 void setSessionBeanInfo(SessionBeanInfo sessionBeanInfo)
          Sets the information object for a session bean.
 void stop()
          Stops the factory.
 
Methods inherited from class org.objectweb.easybeans.container.AbsFactory
rpcInvoke
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static JLog logger
Logger.


className

private java.lang.String className
Name of the class of the managed bean.


container

private EZBContainer container
Container that created this factory.


hashes

private java.util.Map<java.lang.Long,java.lang.reflect.Method> hashes
Keep a direct reference to the method so that we don't need to compute each time the method object to invoke.
http://java.sun.com/j2se/1.5.0/docs/guide/rmi/spec/rmi-stubs24.html


pool

private Pool<PoolType,java.lang.Long> pool
Pool that manage beans instance.


beanClass

private java.lang.Class<PoolType> beanClass
Class used to build bean's instance.


javaContext

private javax.naming.Context javaContext
Context for java: lookups.


namingManager

private static NamingManager namingManager
Reference on the naming manager.


sessionBeanInfo

private SessionBeanInfo sessionBeanInfo
Session Desc (deployment info).

Constructor Detail

SessionFactory

public SessionFactory(java.lang.String className,
                      EZBContainer container)
               throws FactoryException
Builds a new factory with a given name and its container.

Parameters:
className - name of this factory (name of class that is managed)
container - the root component of this factory.
Throws:
FactoryException - if class can't be loaded.
Method Detail

getJavaContext

public javax.naming.Context getJavaContext()
Gets the java: context.

Returns:
java: context.

setJavaContext

public void setJavaContext(javax.naming.Context javaContext)
Sets the java: context.

Parameters:
javaContext - the java: context.

getBeanClass

protected java.lang.Class<PoolType> getBeanClass()
Gets the bean's class.

Returns:
bean class used to instantiate beans.

setBeanClass

protected void setBeanClass(java.lang.Class<PoolType> beanClass)
Sets the bean class that will be used to build bean's instance.

Parameters:
beanClass - the instance of the bean class name

setPool

protected void setPool(Pool<PoolType,java.lang.Long> pool)
Sets the pool used by this factory.

Parameters:
pool - the pool which managed bean instances

getHashes

protected java.util.Map<java.lang.Long,java.lang.reflect.Method> getHashes()
Gets the computed hashes.

Returns:
computed hashes

setHashes

protected void setHashes(java.util.Map<java.lang.Long,java.lang.reflect.Method> hashes)
Sets the hashes for the current bean class.

Parameters:
hashes - method hashes computed as RMI hashes

getNamingManager

protected static NamingManager getNamingManager()
Gets the reference on the naming manager.

Returns:
the reference on the naming manager.

stop

public void stop()
Stops the factory.


getContainer

public EZBContainer getContainer()
Gets the container used by this factory.

Returns:
container of this factory

getClassName

public java.lang.String getClassName()
Gets the className used by this factory.

Returns:
classname that will be instantiated to build bean instance.

getPool

protected Pool<PoolType,java.lang.Long> getPool()
Gets the pool used by this factory.

Returns:
pool.

getBeanInfo

public IBeanInfo getBeanInfo()
Description copied from interface: Factory
Gets the bean information.

Returns:
information of the current bean.

getSessionBeanInfo

public SessionBeanInfo getSessionBeanInfo()
Returns:
information of the current bean.

setSessionBeanInfo

public void setSessionBeanInfo(SessionBeanInfo sessionBeanInfo)
Sets the information object for a session bean.

Parameters:
sessionBeanInfo - information on the bean.