org.objectweb.jonas_ejb.container
Class JContainer

java.lang.Object
  |
  +--org.objectweb.jonas_ejb.container.JContainer
All Implemented Interfaces:
Container

public class JContainer
extends java.lang.Object
implements Container

This class represents an EJB container. A container is where an enterprise Bean object lives. All beans from a same ejb-jar file are installed in a single container. For each EJB installed, the container provides a factory and makes it available in the JNDI name space. The JContainer basically manages a set of BeanFactory objects.

Author:
Philippe Coq, Jeff Mesnil (Security), Christophe Ney (Making easier Enhydra integration), Philippe Durieux (New architecture for local interfaces), Florent Benoit, Ludovic Bert (Ear service, ejb-link)

Field Summary
static java.lang.String DEFAULT_FACTORY_CLASS_NAME
          This class is the default factory class name used for the Entity bean.
 java.lang.String fileName
           
 java.lang.String myname
           
 JStatefulPool statefulSessionPool
           
 
Constructor Summary
JContainer(java.lang.String name, java.lang.String file, java.lang.ClassLoader ld)
          constructor
 
Method Summary
 BeanFactory addBean(BeanDesc dd)
          Adds beans in container.
protected  void checkSecurity(java.lang.String methodSignature)
          Check Security.
 BeanFactory getBeanFactory(java.lang.String ejbName)
           
 int getBeanNb()
           
 java.lang.ClassLoader getClassLoader()
           
 ContainerNaming getContainerNaming()
          used internally by all the EJB Container classes.
 java.util.Set getDataSourceDependence(java.lang.String dsName)
          Management method used by the EJBServiceImpl MBean.
 java.lang.String getEarFileName()
          get the name of the ear application containing this container.
 int getEntityBMPNb()
           
 int getEntityCMPNb()
           
 java.lang.String getFileName()
           
 java.util.Set getJmsConnectionFactoryDependence(java.lang.String cfName)
          Management method used by the EJBServiceImpl MBean.
 java.util.Set getJmsDestinationDependence(java.lang.String destName)
          Management method used by the EJBServiceImpl MBean.
 JmsManager getJmsManager()
          return the JmsManager object used internally by all the EJB Container classes.
 java.util.Set getMailFactoryDependence(java.lang.String mfName)
          Management method used by the EJBServiceImpl MBean.
 int getMessageDrivenNb()
           
 java.security.Guard getMethodGuard()
           
 java.lang.String getName()
           
 PrincipalFactory getPrincipalFactory()
           
 java.security.Guard getRoleGuard()
           
 int getStatefulSessionNb()
           
 int getStatelessSessionNb()
           
 long getSwapTime()
           
 javax.transaction.TransactionManager getTransactionManager()
          return the Transaction Manager used internally by all the EJB Container classes.
 java.lang.String[] listBeanNames()
           
 void registerBF(BeanFactory bf)
          register a BeanFactory
 void registerEJB(JEntitySwitch ejb)
          register an Entity that must be passivated
 void remove()
          Remove the JOnAS container and unregister all beans.
 void setBeanEnvironment(javax.naming.Context ctx, BeanDesc dd)
          Set the bean environment args ctx Context for this bean args dd Bean Deployment Descriptor throws NamingException if could not rebind objects
 void setContainerNaming(ContainerNaming naming)
          set the ContainerNaming object Called by the EJB Server when starting the service.
 void setEarFileName(java.lang.String fileName)
          set the name of the ear application containing this container.
 void setJmsManager(JmsManager jms)
          set the JmsManager object Called by the EJB Server when starting ths service.
 void setMethodGuard(java.security.Guard methodGuard)
          Set a MethodGuard
 void setPrincipalFactory(PrincipalFactory pf)
          Set the PrincipalFactory.
 void setRoleGuard(java.security.Guard roleGuard)
          Set the Role Guard
 void setSwapTime(int t)
          Take into account the swapping time for the bean.
 void setThreadPoolSize(int sz)
          set the Thread pool size.
 void setTransactionManager(javax.transaction.TransactionManager tm)
          set the Transaction Manager.
 void syncAll(boolean passivate)
          Try to passivate all entity bean instances
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FACTORY_CLASS_NAME

public static final java.lang.String DEFAULT_FACTORY_CLASS_NAME
This class is the default factory class name used for the Entity bean.

myname

public java.lang.String myname

fileName

public java.lang.String fileName

statefulSessionPool

public JStatefulPool statefulSessionPool
Constructor Detail

JContainer

public JContainer(java.lang.String name,
                  java.lang.String file,
                  java.lang.ClassLoader ld)
constructor
Method Detail

listBeanNames

public java.lang.String[] listBeanNames()
Specified by:
listBeanNames in interface Container
Returns:
List of beans hosted in this Container

getName

public java.lang.String getName()
Specified by:
getName in interface Container
Returns:
name of this Container

getFileName

public java.lang.String getFileName()
Specified by:
getFileName in interface Container
Returns:
the file name of the container (.xml or .jar)

setMethodGuard

public void setMethodGuard(java.security.Guard methodGuard)
Set a MethodGuard
Specified by:
setMethodGuard in interface Container
Parameters:
methodGuard - The Guard to be set for methods.

getMethodGuard

public java.security.Guard getMethodGuard()
Specified by:
getMethodGuard in interface Container
Returns:
the Method Guard of the Container

setRoleGuard

public void setRoleGuard(java.security.Guard roleGuard)
Set the Role Guard
Specified by:
setRoleGuard in interface Container
Parameters:
roleGuard - The Guard to be set for roles.

getRoleGuard

public java.security.Guard getRoleGuard()
Specified by:
getRoleGuard in interface Container
Returns:
the Role Guard of the Container

getClassLoader

public java.lang.ClassLoader getClassLoader()
Specified by:
getClassLoader in interface Container
Returns:
the classloader used for this Container

setPrincipalFactory

public void setPrincipalFactory(PrincipalFactory pf)
Set the PrincipalFactory. This factory can be JOnAS Server dependant. The Container makes no assumption on how to get the Principal.
Specified by:
setPrincipalFactory in interface Container
Parameters:
pf - the PrincipalFactory

getPrincipalFactory

public PrincipalFactory getPrincipalFactory()
Specified by:
getPrincipalFactory in interface Container
Returns:
the PrincipalFactory of the Container

setContainerNaming

public void setContainerNaming(ContainerNaming naming)
set the ContainerNaming object Called by the EJB Server when starting the service.
Specified by:
setContainerNaming in interface Container
Parameters:
naming - the ContainerNaming object

getContainerNaming

public ContainerNaming getContainerNaming()
used internally by all the EJB Container classes.
Specified by:
getContainerNaming in interface Container
Returns:
the ContainerNaming object

setThreadPoolSize

public void setThreadPoolSize(int sz)
set the Thread pool size.
Specified by:
setThreadPoolSize in interface Container
Parameters:
sz - number of threads in the pool.

syncAll

public void syncAll(boolean passivate)
Try to passivate all entity bean instances
Specified by:
syncAll in interface Container
Parameters:
passivate - true if bean instances will be released after having been written on storage.

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager tm)
set the Transaction Manager. Called by the EJB Server when starting the service.
Specified by:
setTransactionManager in interface Container
Parameters:
tm - the Transaction Manager.

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
return the Transaction Manager used internally by all the EJB Container classes.
Specified by:
getTransactionManager in interface Container
Returns:
the Transaction Manager

setJmsManager

public void setJmsManager(JmsManager jms)
set the JmsManager object Called by the EJB Server when starting ths service.
Specified by:
setJmsManager in interface Container
Parameters:
jms - the JmsManager

getJmsManager

public JmsManager getJmsManager()
return the JmsManager object used internally by all the EJB Container classes.
Specified by:
getJmsManager in interface Container
Following copied from interface: org.objectweb.jonas_ejb.container.Container
Returns:
the JmsManager object

setEarFileName

public void setEarFileName(java.lang.String fileName)
set the name of the ear application containing this container.
Specified by:
setEarFileName in interface Container
Parameters:
fileName - the name of the ear application containing this container.

getEarFileName

public java.lang.String getEarFileName()
get the name of the ear application containing this container.
Specified by:
getEarFileName in interface Container
Parameters:
fileName - the name of the ear application containing this container.

remove

public void remove()
Remove the JOnAS container and unregister all beans.
Specified by:
remove in interface Container

addBean

public BeanFactory addBean(BeanDesc dd)
Adds beans in container. This method is not part of JContainer interface, although it is used by JOnAS Server, because we don't want to get all BeanDesc classes (jonas_ejb.deployment.api) LATER: Replace this by setDeploymentDesc ?
Parameters:
desc - The Bean Deployment Descriptor
Throws:
javax.ejb.EJBException -  

getBeanFactory

public BeanFactory getBeanFactory(java.lang.String ejbName)

getBeanNb

public int getBeanNb()
Returns:
total Number of Beans

getEntityBMPNb

public int getEntityBMPNb()
Returns:
int Number of BMP type currently in this container

getEntityCMPNb

public int getEntityCMPNb()
Returns:
int Number of CMP type currently in this container

getStatefulSessionNb

public int getStatefulSessionNb()
Returns:
int Number of SBF type currently in this container

getStatelessSessionNb

public int getStatelessSessionNb()
Returns:
int Number of SBL type currently in this container

getMessageDrivenNb

public int getMessageDrivenNb()
Returns:
int Number of MDB type currently in this container

getSwapTime

public long getSwapTime()
Returns:
passivation time out for this container

getDataSourceDependence

public java.util.Set getDataSourceDependence(java.lang.String dsName)
Management method used by the EJBServiceImpl MBean. Determine which are the ejbs using a given data source.
Parameters:
dsName - JNDI name of the data source
Returns:
a set of Properties describing the beans that use the data source

getJmsDestinationDependence

public java.util.Set getJmsDestinationDependence(java.lang.String destName)
Management method used by the EJBServiceImpl MBean. Determine which are the beans using a JMS destination.
Parameters:
destName - JNDI name of a JMS destination
Returns:
a set of Properties describing the ejbs that use the JMS destination.

getJmsConnectionFactoryDependence

public java.util.Set getJmsConnectionFactoryDependence(java.lang.String cfName)
Management method used by the EJBServiceImpl MBean. Determine which are the ejbs using a JMS Connection Factory.
Parameters:
cfName - JNDI name of a JMS Connection Factory.
Returns:
a set of Properties describing the beans that use the JMS Connection Factory.

getMailFactoryDependence

public java.util.Set getMailFactoryDependence(java.lang.String mfName)
Management method used by the EJBServiceImpl MBean. Determine which are the ejbs using a Mail Factory.
Parameters:
mfName - JNDI name of a Mail Factory.
Returns:
a set of Properties describing the beans that use the given Mail Factory.

registerEJB

public void registerEJB(JEntitySwitch ejb)
register an Entity that must be passivated

registerBF

public void registerBF(BeanFactory bf)
register a BeanFactory

setSwapTime

public void setSwapTime(int t)
Take into account the swapping time for the bean.
Parameters:
time - in seconds (time = 0 no time out)

setBeanEnvironment

public void setBeanEnvironment(javax.naming.Context ctx,
                               BeanDesc dd)
                        throws javax.naming.NamingException
Set the bean environment args ctx Context for this bean args dd Bean Deployment Descriptor throws NamingException if could not rebind objects

checkSecurity

protected void checkSecurity(java.lang.String methodSignature)
Check Security. No control for Message Driven Beans