org.objectweb.jonas.resource
Class ResourceServiceImpl

java.lang.Object
  extended byorg.objectweb.jonas.management.ReconfigDispatcher
      extended byorg.objectweb.jonas.service.AbsServiceImpl
          extended byorg.objectweb.jonas.resource.ResourceServiceImpl
All Implemented Interfaces:
javax.management.NotificationBroadcaster, ReconfigDispatcherMBean, ResourceService, ResourceServiceImplMBean, Service

public class ResourceServiceImpl
extends AbsServiceImpl
implements ResourceService, ResourceServiceImplMBean

JCA resource service implmentation

Author:
Philippe Coq Contributor(s): JOnAS 2.4 Sebastien Chassande-Barrioz (sebastien.chassande@inrialpes.fr) JOnAS 3.0 Eric Hardesty (Eric.Hardesty@bull.com)

Field Summary
static java.lang.String AUTOLOADDIR
           
static java.lang.String CLASS
           
static java.lang.String JNDI_NAME
           
 java.lang.String MANAGED_CONNECTION_FACTORY_CLASS
           
static java.lang.String MONITOR_FACTORY
           
static java.lang.String PARSINGWITHVALIDATION
           
static java.lang.String PRINTWRITER
           
static java.lang.String RESOURCE_LIST
           
 
Fields inherited from class org.objectweb.jonas.management.ReconfigDispatcher
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
ResourceServiceImpl()
           
 
Method Summary
 void createResourceAdapter(javax.naming.Context ctx)
          Create a Resource Adapter
 void deployRars(javax.naming.Context ctx)
          Deploy the given rars of an ear file with the specified parent classloader (ear classloader).
 void doInit(javax.naming.Context ctx)
          - Get the global jndi context - Get the list of the resource adapters.
 void doStart()
          Abstract start-up method to be implemented by sub-classes
 void doStop()
          Abstract method for service stopping to be implemented by sub-classes
static java.lang.Object getConnectionFactory(java.lang.String jndiName)
          get the ResourceAdapter matching the raname will be used in ConnectionFactoryJNDIHandler class at lookup time
 java.lang.Integer getCurrentNumberOfResource()
          MBean method
 void processRar(JClassLoader cls, java.lang.String resFileName, org.objectweb.jonas_rar.deployment.xml.JonasResource jonasra)
          Process the specified rar, extracting all the jars files to be included in the classloader and all the native files needed by the rar.
 void unDeployRars(java.net.URL[] urls)
          Undeploy the given rars of an ear file.
 
Methods inherited from class org.objectweb.jonas.service.AbsServiceImpl
getName, init, isStarted, setName, start, stop
 
Methods inherited from class org.objectweb.jonas.management.ReconfigDispatcher
addNotificationListener, getFilter, getHandback, getListener, getNotificationInfo, initLogger, removeNotificationListener, sendReconfigNotification, sendSaveNotification
 
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

RESOURCE_LIST

public static final java.lang.String RESOURCE_LIST
See Also:
Constant Field Values

CLASS

public static final java.lang.String CLASS
See Also:
Constant Field Values

AUTOLOADDIR

public static final java.lang.String AUTOLOADDIR
See Also:
Constant Field Values

PARSINGWITHVALIDATION

public static final java.lang.String PARSINGWITHVALIDATION
See Also:
Constant Field Values

MANAGED_CONNECTION_FACTORY_CLASS

public final java.lang.String MANAGED_CONNECTION_FACTORY_CLASS
See Also:
Constant Field Values

JNDI_NAME

public static final java.lang.String JNDI_NAME
See Also:
Constant Field Values

PRINTWRITER

public static final java.lang.String PRINTWRITER
See Also:
Constant Field Values

MONITOR_FACTORY

public static final java.lang.String MONITOR_FACTORY
See Also:
Constant Field Values
Constructor Detail

ResourceServiceImpl

public ResourceServiceImpl()
Method Detail

doInit

public void doInit(javax.naming.Context ctx)
- Get the global jndi context - Get the list of the resource adapters. The list is reachable in the Context parameter under the name RESOURCE_LIST. - Get the transaction manager into the jndi - Instanciate the connection manager

Specified by:
doInit in class AbsServiceImpl
Parameters:
ctx - configuration of the service

doStart

public void doStart()
             throws ServiceException
Description copied from class: AbsServiceImpl
Abstract start-up method to be implemented by sub-classes

Specified by:
doStart in class AbsServiceImpl
Throws:
ServiceException - service start-up failed

doStop

public void doStop()
            throws ServiceException
Description copied from class: AbsServiceImpl
Abstract method for service stopping to be implemented by sub-classes

Specified by:
doStop in class AbsServiceImpl
Throws:
ServiceException - service stopping failed

createResourceAdapter

public void createResourceAdapter(javax.naming.Context ctx)
                           throws java.lang.Exception
Description copied from interface: ResourceService
Create a Resource Adapter

Specified by:
createResourceAdapter in interface ResourceService
Throws:
java.lang.Exception

processRar

public void processRar(JClassLoader cls,
                       java.lang.String resFileName,
                       org.objectweb.jonas_rar.deployment.xml.JonasResource jonasra)
                throws ResourceServiceException
Process the specified rar, extracting all the jars files to be included in the classloader and all the native files needed by the rar.

Parameters:
cls - the current classloader
resFileName - rar file to process
jonasra - the jonas-ra.xml properties
Throws:
ResourceServiceException - if an error occurs during the extracting.

deployRars

public void deployRars(javax.naming.Context ctx)
                throws ResourceServiceException
Deploy the given rars of an ear file with the specified parent classloader (ear classloader). (This method is only used for for ear applications).

Specified by:
deployRars in interface ResourceService
Parameters:
ctx - the context containing the configuration to deploy the rars.
This context contains the following parameters :
- urls the list of the urls of the rars to deploy.
- earRootURL the URL of the ear application file.
- earClassLoader the ear classLoader of the j2ee app.
- altDDs the optional URI of deployment descriptor.
Throws:
ResourceServiceException - if an error occurs during the deployment.

unDeployRars

public void unDeployRars(java.net.URL[] urls)
Undeploy the given rars of an ear file. (This method is only used for the ear applications).

Specified by:
unDeployRars in interface ResourceService
Parameters:
urls - the list of the urls of the rars to undeploy.

getConnectionFactory

public static java.lang.Object getConnectionFactory(java.lang.String jndiName)
get the ResourceAdapter matching the raname will be used in ConnectionFactoryJNDIHandler class at lookup time


getCurrentNumberOfResource

public java.lang.Integer getCurrentNumberOfResource()
MBean method

Specified by:
getCurrentNumberOfResource in interface ResourceServiceImplMBean
Returns:
Integer Total Number of Resourcesource available in JOnAS