org.objectweb.jonas_ejb.container
Class JFactory

java.lang.Object
  |
  +--org.objectweb.jonas_ejb.container.JFactory
All Implemented Interfaces:
BeanFactory
Direct Known Subclasses:
JEntityFactory, JMdbFactory, JSessionFactory

public abstract class JFactory
extends java.lang.Object
implements BeanFactory

This class is a factory for beans.

Author:
Philippe Durieux

Field Summary
protected  java.lang.Class beanclass
           
protected  JContainer cont
           
protected  BeanDesc dd
           
protected  java.util.Properties ejb10Env
           
protected  java.lang.String ejbname
           
protected  javax.naming.Context JNDICtx
           
protected  ContainerNaming naming
           
protected  javax.transaction.TransactionManager tm
           
protected  boolean txbeanmanaged
           
 
Constructor Summary
JFactory()
          constructor (for entity) must be without parameters (required by Jorm)
JFactory(BeanDesc dd, JContainer cont)
          constructor (for session)
 
Method Summary
protected  void checkJonasVersion(java.lang.String clName)
          Check if the given class have been generated by GenIC tool with a correct version.
protected  void checkTransactionContainer(RequestCtx rctx)
          Process Transaction Attribute before calling a business method
 JContainer getContainer()
          Returns the JContainer
static javax.naming.InitialContext getCorbaInitialContext()
           
 BeanDesc getDeploymentDescriptor()
          Get the Deployement descriptor of this Ejb
 java.util.Properties getEjb10Environment()
           
 java.lang.String getEJBName()
          get the bean name
 java.util.Hashtable getEnv()
          Return the JNDI Environment
 javax.naming.InitialContext getInitialContext()
          Returns the InitialContext
abstract  int getPoolSize()
          Get the size of the instance pool for this bean
 javax.transaction.TransactionManager getTransactionManager()
          returns the TransactionManager
 void init(BeanDesc dd, JContainer cont)
          Init this object
protected  boolean isClassAvailable(java.lang.String className, boolean unique)
          Assess availability of a class in a given class loader
 boolean isTxBeanManaged()
           
 java.lang.ClassLoader myClassLoader()
           
 void postInvoke(RequestCtx rctx)
          Common postInvoke
 void postInvokeRemote(RequestCtx rctx)
          postInvoke for Remote access
 RequestCtx preInvoke(int txa, java.lang.String secu)
          Common preInvoke
 RequestCtx preInvokeRemote(int txa, java.lang.String secu)
          preInvoke for Remote access
 void resetComponentContext(javax.naming.Context oldctx)
          reset old Component Context for JNDI environment
 javax.naming.Context setComponentContext()
          set the Component Context for JNDI environment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jonas_ejb.container.BeanFactory
getHome, getLocalHome, reduceCache, stop, sync
 

Field Detail

cont

protected JContainer cont

naming

protected ContainerNaming naming

tm

protected javax.transaction.TransactionManager tm

JNDICtx

protected javax.naming.Context JNDICtx

ejbname

protected java.lang.String ejbname

dd

protected BeanDesc dd

ejb10Env

protected java.util.Properties ejb10Env

txbeanmanaged

protected boolean txbeanmanaged

beanclass

protected java.lang.Class beanclass
Constructor Detail

JFactory

public JFactory()
constructor (for entity) must be without parameters (required by Jorm)

JFactory

public JFactory(BeanDesc dd,
                JContainer cont)
constructor (for session)
Method Detail

init

public void init(BeanDesc dd,
                 JContainer cont)
Init this object
Parameters:
dd - the deployment descriptor
cont - the Container

isClassAvailable

protected boolean isClassAvailable(java.lang.String className,
                                   boolean unique)
Assess availability of a class in a given class loader
Parameters:
className - the name of the class without the .class extension
unique - flag indicating if the class should be found only once in the classloader
Returns:
True if class is available in the current class loader.

getEJBName

public java.lang.String getEJBName()
Description copied from interface: BeanFactory
get the bean name
Specified by:
getEJBName in interface BeanFactory
Returns:
the bean name

getPoolSize

public abstract int getPoolSize()
Description copied from interface: BeanFactory
Get the size of the instance pool for this bean
Specified by:
getPoolSize in interface BeanFactory
Returns:
the Instance pool size for this Ejb

getDeploymentDescriptor

public BeanDesc getDeploymentDescriptor()
Get the Deployement descriptor of this Ejb
Specified by:
getDeploymentDescriptor in interface BeanFactory
Returns:
BeanDesc The bean deployment descriptor

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Description copied from interface: BeanFactory
returns the TransactionManager
Specified by:
getTransactionManager in interface BeanFactory
Returns:
the TransactionManager

getContainer

public JContainer getContainer()
Description copied from interface: BeanFactory
Returns the JContainer
Specified by:
getContainer in interface BeanFactory
Returns:
the JContainer object

getEnv

public java.util.Hashtable getEnv()
Description copied from interface: BeanFactory
Return the JNDI Environment
Specified by:
getEnv in interface BeanFactory
Returns:
A Hashtable containing the JNDI Environment

getInitialContext

public javax.naming.InitialContext getInitialContext()
Description copied from interface: BeanFactory
Returns the InitialContext
Specified by:
getInitialContext in interface BeanFactory
Returns:
the InitialContext

getCorbaInitialContext

public static javax.naming.InitialContext getCorbaInitialContext()
                                                          throws javax.naming.NamingException
Returns:
an InitialContext to access CosNaming

getEjb10Environment

public java.util.Properties getEjb10Environment()
Returns:
the EJB 1.0 style environment associated with the Bean

isTxBeanManaged

public boolean isTxBeanManaged()
Returns:
true if transactions are managed inside the bean false if transactions are managed by the container

setComponentContext

public javax.naming.Context setComponentContext()
set the Component Context for JNDI environment
Returns:
previous Context

resetComponentContext

public void resetComponentContext(javax.naming.Context oldctx)
reset old Component Context for JNDI environment
Parameters:
oldctx - previous Component Context to restore.

preInvoke

public RequestCtx preInvoke(int txa,
                            java.lang.String secu)
Common preInvoke
Parameters:
txa - Transaction Attribute (Supports, Required, ...)
secu - Security String that uniquely identifies the method.
Returns:
A RequestCtx object
Throws:
javax.ejb.EJBException -  

postInvoke

public void postInvoke(RequestCtx rctx)
Common postInvoke
Parameters:
rctx - The RequestCtx that was returned at preInvoke()
Throws:
javax.ejb.EJBException -  

preInvokeRemote

public RequestCtx preInvokeRemote(int txa,
                                  java.lang.String secu)
                           throws java.rmi.RemoteException
preInvoke for Remote access
Parameters:
txa - Transaction Attribute (Supports, Required, ...)
secu - Security String that uniquely identifies the method.
Returns:
A RequestCtx object
Throws:
TransactionRequiredException -  
TransactionRolledbackException -  
NoSuchObjectException -  
java.rmi.RemoteException -  

postInvokeRemote

public void postInvokeRemote(RequestCtx rctx)
                      throws java.rmi.RemoteException
postInvoke for Remote access
Parameters:
rctx - The RequestCtx that was returned at preInvoke()
Throws:
TransactionRequiredException -  
TransactionRolledbackException -  
NoSuchObjectException -  
java.rmi.RemoteException -  

checkTransactionContainer

protected void checkTransactionContainer(RequestCtx rctx)
Process Transaction Attribute before calling a business method
Parameters:
rctx - the Request Context
Throws:
javax.ejb.EJBException -  
javax.ejb.TransactionRequiredLocalException -  

checkJonasVersion

protected void checkJonasVersion(java.lang.String clName)
Check if the given class have been generated by GenIC tool with a correct version. Trace an error message, if not.
Parameters:
clName - class name

myClassLoader

public java.lang.ClassLoader myClassLoader()
Returns:
the classloader for this container.