org.objectweb.jonas.container
Class EJBServiceImpl

java.lang.Object
  |
  +--org.objectweb.jonas.service.AbsServiceImpl
        |
        +--org.objectweb.jonas.container.EJBServiceImpl
All Implemented Interfaces:
EJBService, EJBServiceImplMBean, Service

public class EJBServiceImpl
extends AbsServiceImpl
implements EJBService, EJBServiceImplMBean

Implementation of the EJB Container Service for jonas. This class works only with jonas_ejb classes.

Author:
Philippe Coq Contributor(s): Jeff Mesnil: Security Markus Karg: Novell port Christophe Ney: for making easier Enhydra integration Adriana Danes: complete managemenet methods getXXXDependence highlight configuration properties Florent Benoit & Ludovic Bert : Ear service, deployJars, undeployJars

Field Summary
static java.lang.String AUTOLOADDIR
           
static java.lang.String CLASS
           
static java.lang.String DESCRIPTORS
           
protected static java.lang.String EJBJARS_DIR
          The name of the webapps directory.
protected static java.lang.String JONAS_ROOT
          The name of the JONAS_ROOT directory.
static java.lang.String MDBTHREADPOOLSIZE
           
static java.lang.String PARSINGWITHVALIDATION
           
 
Constructor Summary
EJBServiceImpl()
           
 
Method Summary
 Container createContainer(javax.naming.Context ctx)
          Add beans from a .jar file today, this is called internally from doStart() or from createContainer(String file) in case of jonas admin.
 void createContainer(java.lang.String ejbJarFile)
          MBean method Start (or restart if already start) a new container application
 void deployJars(javax.naming.Context ctx)
          Deploy the given ejb-jars of an ear file with the specified parent classloader (ear classloader).
 void doInit(javax.naming.Context ctx)
          Init the Service.
 void doStart()
          Start the Service Initialization of the service is already done.
 void doStop()
          Stop the service: - Remove all JOnAS Containers.
 Container getContainer(java.lang.String fileName)
          Get the Container by its file name (.xml or .jar) AD.
 java.lang.Integer getCurrentNumberOfContainer()
          MBean method
 java.util.Set getDataSourceDependence(java.lang.String dsName)
          MBean method
 java.util.Set getJmsConnectionFactoryDependence(java.lang.String cfName)
          Management method
 java.util.Set getJmsDestinationDependence(java.lang.String destName)
          Manangement method
 java.util.Set getMailFactoryDependence(java.lang.String mfName)
          Management method
 java.lang.Integer getTotalCurrentNumberOfBeanType()
          MBean method
 java.lang.Integer getTotalCurrentNumberOfBMPType()
          MBean method
 java.lang.Integer getTotalCurrentNumberOfCMPType()
          MBean method
 java.lang.Integer getTotalCurrentNumberOfMDBType()
          MBean method
 java.lang.Integer getTotalCurrentNumberOfSBFType()
          MBean method
 java.lang.Integer getTotalCurrentNumberOfSBLType()
          MBean method
 Container[] listContainers()
          List JOnAS container created by EJB Service
 void removeCache(java.lang.ClassLoader earClassLoader)
          Make a cleanup of the cache of deployment descriptor.
 void removeContainer(Container cont)
          Remove a JOnAS container
 void removeContainer(Container cont, boolean isEarCase)
          Remove the specified container.
 void removeContainer(java.lang.String fileName)
          MBean method remove a container application
 void syncAllEntities(boolean passivate)
          Synchronized all entity bean containers
 void unDeployJars(java.net.URL[] urls)
          Undeploy the given ejb-jars of an ear file.
 
Methods inherited from class org.objectweb.jonas.service.AbsServiceImpl
getName, init, isStarted, setName, start, stop
 
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.service.Service
getName, init, isStarted, setName, start, stop
 

Field Detail

JONAS_ROOT

protected static final java.lang.String JONAS_ROOT
The name of the JONAS_ROOT directory.

EJBJARS_DIR

protected static final java.lang.String EJBJARS_DIR
The name of the webapps directory.

AUTOLOADDIR

public static final java.lang.String AUTOLOADDIR

MDBTHREADPOOLSIZE

public static final java.lang.String MDBTHREADPOOLSIZE

PARSINGWITHVALIDATION

public static final java.lang.String PARSINGWITHVALIDATION

DESCRIPTORS

public static final java.lang.String DESCRIPTORS

CLASS

public static final java.lang.String CLASS
Constructor Detail

EJBServiceImpl

public EJBServiceImpl()
Method Detail

doInit

public void doInit(javax.naming.Context ctx)
            throws ServiceException
Init the Service. Configuration information is passed thru a Context object.
Overrides:
doInit in class AbsServiceImpl

doStart

public void doStart()
             throws ServiceException
Start the Service Initialization of the service is already done.
Overrides:
doStart in class AbsServiceImpl

doStop

public void doStop()
Stop the service: - Remove all JOnAS Containers. - Unbinds all the EJBHome names from JNDI
Overrides:
doStop in class AbsServiceImpl

createContainer

public Container createContainer(javax.naming.Context ctx)
                          throws java.lang.Exception
Add beans from a .jar file today, this is called internally from doStart() or from createContainer(String file) in case of jonas admin.
Specified by:
createContainer in interface EJBService
Returns:
the created container.
Throws:
java.lang.Exception - if an error occur during the creation of the container.

getContainer

public Container getContainer(java.lang.String fileName)
Get the Container by its file name (.xml or .jar) AD. Keep only one Enumeration of containers
Specified by:
getContainer in interface EJBService

removeContainer

public void removeContainer(Container cont)
Remove a JOnAS container
Specified by:
removeContainer in interface EJBService
Following copied from interface: org.objectweb.jonas.container.EJBService
Parameters:
cont - JOnAS container to remove.

listContainers

public Container[] listContainers()
List JOnAS container created by EJB Service
Specified by:
listContainers in interface EJBService
Following copied from interface: org.objectweb.jonas.container.EJBService
Returns:
an array of Container objects

syncAllEntities

public void syncAllEntities(boolean passivate)
Synchronized all entity bean containers
Specified by:
syncAllEntities in interface EJBService
Parameters:
passivate - passivate instances after synchronization.

getCurrentNumberOfContainer

public java.lang.Integer getCurrentNumberOfContainer()
MBean method
Specified by:
getCurrentNumberOfContainer in interface EJBServiceImplMBean
Returns:
Integer Total Number of Container currently in JOnAS

getTotalCurrentNumberOfBeanType

public java.lang.Integer getTotalCurrentNumberOfBeanType()
MBean method
Specified by:
getTotalCurrentNumberOfBeanType in interface EJBServiceImplMBean
Returns:
Integer Total Number of Bean Type currently in JOnAS

getTotalCurrentNumberOfBMPType

public java.lang.Integer getTotalCurrentNumberOfBMPType()
MBean method
Specified by:
getTotalCurrentNumberOfBMPType in interface EJBServiceImplMBean
Returns:
Integer Total Number of Bmp Type currently in JOnAS

getTotalCurrentNumberOfCMPType

public java.lang.Integer getTotalCurrentNumberOfCMPType()
MBean method
Specified by:
getTotalCurrentNumberOfCMPType in interface EJBServiceImplMBean
Returns:
Integer Total Number of Cmp Type currently in JOnAS

getTotalCurrentNumberOfSBFType

public java.lang.Integer getTotalCurrentNumberOfSBFType()
MBean method
Specified by:
getTotalCurrentNumberOfSBFType in interface EJBServiceImplMBean
Returns:
Integer Total Number of Sbf Type currently in JOnAS

getTotalCurrentNumberOfSBLType

public java.lang.Integer getTotalCurrentNumberOfSBLType()
MBean method
Specified by:
getTotalCurrentNumberOfSBLType in interface EJBServiceImplMBean
Returns:
Integer Total Number of Sbl Type currently in JOnAS

getTotalCurrentNumberOfMDBType

public java.lang.Integer getTotalCurrentNumberOfMDBType()
MBean method
Specified by:
getTotalCurrentNumberOfMDBType in interface EJBServiceImplMBean
Returns:
Integer Total Number of Mdb Type currently in JOnAS

removeContainer

public void removeContainer(java.lang.String fileName)
MBean method remove a container application
Specified by:
removeContainer in interface EJBServiceImplMBean
Parameters:
String - ContainerName, the Name of this container

createContainer

public void createContainer(java.lang.String ejbJarFile)
                     throws java.rmi.RemoteException
MBean method Start (or restart if already start) a new container application
Specified by:
createContainer in interface EJBServiceImplMBean
Parameters:
String - ejbJarFile, the Name of the ejbJarFile for this container application.

getDataSourceDependence

public java.util.Set getDataSourceDependence(java.lang.String dsName)
MBean method
Specified by:
getDataSourceDependence in interface EJBServiceImplMBean
Returns:
the ObjectName of all the ejb using this datasource.

getJmsDestinationDependence

public java.util.Set getJmsDestinationDependence(java.lang.String destName)
Manangement method
Specified by:
getJmsDestinationDependence in interface EJBServiceImplMBean
Returns:
the ObjectName of all the ejb using this destination.

getJmsConnectionFactoryDependence

public java.util.Set getJmsConnectionFactoryDependence(java.lang.String cfName)
Management method
Specified by:
getJmsConnectionFactoryDependence in interface EJBServiceImplMBean
Returns:
the ObjectName of all the ejb using this Connection Factory.

getMailFactoryDependence

public java.util.Set getMailFactoryDependence(java.lang.String mfName)
Management method
Specified by:
getMailFactoryDependence in interface EJBServiceImplMBean
Returns:
the ObjectName of all the ejb using a given Mail Factory.

deployJars

public void deployJars(javax.naming.Context ctx)
                throws ServiceException
Deploy the given ejb-jars of an ear file with the specified parent classloader (ear classloader). (This method is only used for the ear applications, not for the ejb-jar applications).
Specified by:
deployJars in interface EJBService
Parameters:
ctx - the context containing the configuration to deploy the ejbjars.
This context contains the following parameters :
- earRootUrl the root of the ear application.
- earClassLoader the ear classLoader of the ear application.
- ejbClassLoader the ejb classLoader for the ejbjars.
- jarURLs the list of the urls of the ejb-jars to deploy.
- roleNames the role names of the security-role.
Returns:
ClassLoader the ejbClassLoader created.
Throws:
ServiceException - if an error occurs during the deployment.

unDeployJars

public void unDeployJars(java.net.URL[] urls)
Undeploy the given ejb-jars of an ear file. (This method is only used for the ear applications, not for the ejb-jar applications).
Specified by:
unDeployJars in interface EJBService
Parameters:
urls - the list of the urls of the ejb-jars to undeploy.

removeContainer

public void removeContainer(Container cont,
                            boolean isEarCase)
Remove the specified container.
Parameters:
cont - the container to remove.
isEarCase - true if only if the removeContainer method is called in the ear case, false otherwise.

removeCache

public void removeCache(java.lang.ClassLoader earClassLoader)
Make a cleanup of the cache of deployment descriptor. This method must be invoked after the ear deployment by the EAR service. the deployment of an ear by .
Specified by:
removeCache in interface EJBService
Parameters:
earClassLoader - the ClassLoader of the ear application to remove from the cache.