org.ow2.jonas.ejb.easybeans
Class EasyBeansService

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.ow2.jonas.lib.reconfig.ReconfigEmitter
          extended by org.ow2.jonas.lib.service.AbsServiceImpl
              extended by org.ow2.jonas.ejb.easybeans.EasyBeansService
All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, IEasyBeansService, Service

public class EasyBeansService
extends AbsServiceImpl
implements IEasyBeansService

Implementation of the service that runs the EasyBeans EJB3 container.

Author:
Florent Benoit Contributors: S. Ali Tokmen (versioning)

Field Summary
static String EASYBEANS_CLUSTER_CONFIG_FILE
          Name of the configuration file of EasyBeans for JOnAS with a support of clustering.
static String EASYBEANS_CONFIG_FILE
          Name of the configuration file of EasyBeans for JOnAS.
protected static String JONAS_BASE
          The name of the JONAS_BASE directory.
protected static String WORK_DIR
          The name of the working directory.
protected static String WORK_EJB3S_DIR
          The name of the working ejb3s directory.
 
Fields inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
EasyBeansService(org.osgi.framework.BundleContext bundleContext)
          Constructor in OSGi mode.
 
Method Summary
 void addConfigurationExtension(org.ow2.easybeans.server.EasyBeansConfigurationExtension extension)
          Add a new extension to Embedded, that will be used for the next EZBContainer creation.
 void addContainer(org.ow2.easybeans.api.EZBContainer ejbContainer)
          Adds the given container.
 org.ow2.easybeans.resolver.api.EZBApplicationJNDIResolver buildApplicationJNDIResolver()
           
 ClassLoader buildByteCodeEnhancementClassLoader(URL[] urls, ClassLoader parentClassLoader)
          Allow to build a classloader that provide JPA classtransformers and bytecode modifications.
 org.ow2.easybeans.deployment.api.EZBInjectionHolder buildInjectionHolder(org.ow2.easybeans.persistence.api.EZBPersistenceUnitManager persistenceUnitManager, org.ow2.easybeans.resolver.api.EZBJNDIResolver jndiResolver)
           
protected  void configureExtraDialects()
          Configure some dialects that may be used with some databases used by JOnAS.
protected  void doStart()
          Abstract start-up method to be implemented by sub-classes.
protected  void doStop()
          Abstract method for service stopping to be implemented by sub-classes.
 CmiService getCmiService()
          Return a reference to the CMI service.
 org.ow2.easybeans.api.EZBServer getEasyBeansServer()
          TODO Remove it when EarDeployer will use EasyBeans Deployer.
static JNamingManager getNamingManager()
          Returns the NamingManger.
 org.ow2.easybeans.api.naming.EZBNamingStrategy getNamingStrategy(String prefix, org.ow2.easybeans.api.naming.EZBNamingStrategy oldNamingStrategy)
          Build a new Strategy for the given prefix and the old strategy.
 org.ow2.easybeans.persistence.api.EZBPersistenceUnitManager getPersistenceUnitManager(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable, ClassLoader appClassLoader)
          Gets the persistence unit manager for the given EAR and classloader.
 org.ow2.easybeans.persistence.api.EZBPersistenceUnitManager getPersistenceUnitManager(org.ow2.util.archive.api.IArchive archive, ClassLoader classLoader)
          Gets the persistence unit manager for the given archive and classloader.
 IResourceCheckerManager getResourceCheckerManager()
           
 ResourceService getResourceService()
           
 VersioningService getVersioningService()
           
protected  void initWorkingDirectory()
          Create working directory for EJB3.
 boolean isEJB3DeployedByWorkName(String unpackName)
          Test if the specified unpack name is already deployed or not.
 void registerEmbeddedService()
          Register Embedded as an OSGi service.
 void removeConfigurationExtension(org.ow2.easybeans.server.EasyBeansConfigurationExtension extension)
          Disengage the given extension
 void removeContainer(org.ow2.easybeans.api.EZBContainer ejbContainer)
          Remove the given container.
 void setCmiService(CmiService cmiService)
          Set a reference to the CMI service.
 void setCommonsModelerExtService(org.ow2.util.jmx.api.ICommonsModelerExtService commonsModelerExtService)
           
 void setDeployerManager(org.ow2.util.ee.deploy.api.deployer.IDeployerManager deployerManager)
           
 void setEventService(org.ow2.util.event.api.IEventService eventService)
           
 void setJ2EEServer(J2EEServerService j2eeServer)
           
 void setJmxService(JmxService jmxService)
           
 void setNamingManager(JNamingManager naming)
          Sets the NamingManger.
 void setResourceCheckerManager(IResourceCheckerManager resourceCheckerManager)
          Sets the resource checker manager.
 void setResourceService(ResourceService resourceService)
           
 void setVersioningService(VersioningService versioningService)
           
protected  void setWorkCleanerService(WorkCleanerService workCleanerService)
          Method called when the workCleanerService is bound to the component.
 void unsetResourceCheckerManager()
          Unset the resource checker manager.
 void unsetVersioningService()
          Sets the versioning service to null.
 
Methods inherited from class org.ow2.jonas.lib.service.AbsServiceImpl
convertToList, doInit, getDomainName, getJonasServerName, getName, getServerProperties, init, isStarted, setName, setServerProperties, start, stop, throwRequirementException, toString
 
Methods inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
initLogger, sendReconfigNotification, sendSaveNotification
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ow2.jonas.service.Service
getName, init, isStarted, setName, start, stop
 

Field Detail

EASYBEANS_CONFIG_FILE

public static final String EASYBEANS_CONFIG_FILE
Name of the configuration file of EasyBeans for JOnAS.

See Also:
Constant Field Values

EASYBEANS_CLUSTER_CONFIG_FILE

public static final String EASYBEANS_CLUSTER_CONFIG_FILE
Name of the configuration file of EasyBeans for JOnAS with a support of clustering.

See Also:
Constant Field Values

JONAS_BASE

protected static final String JONAS_BASE
The name of the JONAS_BASE directory.


WORK_DIR

protected static final String WORK_DIR
The name of the working directory.


WORK_EJB3S_DIR

protected static final String WORK_EJB3S_DIR
The name of the working ejb3s directory.

Constructor Detail

EasyBeansService

public EasyBeansService(org.osgi.framework.BundleContext bundleContext)
Constructor in OSGi mode. It provides the bundle context.

Parameters:
bundleContext - the given bundle context.
Method Detail

doStart

protected void doStart()
                throws ServiceException
Abstract start-up method to be implemented by sub-classes.

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

doStop

protected void doStop()
               throws ServiceException
Abstract method for service stopping to be implemented by sub-classes.

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

configureExtraDialects

protected void configureExtraDialects()
Configure some dialects that may be used with some databases used by JOnAS.


getEasyBeansServer

public org.ow2.easybeans.api.EZBServer getEasyBeansServer()
TODO Remove it when EarDeployer will use EasyBeans Deployer.

Specified by:
getEasyBeansServer in interface IEasyBeansService
Returns:
the Embedded instance used by this service.

setJmxService

public void setJmxService(JmxService jmxService)
Parameters:
jmxService - the jmxService to set

setDeployerManager

public void setDeployerManager(org.ow2.util.ee.deploy.api.deployer.IDeployerManager deployerManager)
Parameters:
deployerManager - the deployerManagerService to set

getNamingManager

public static JNamingManager getNamingManager()
Returns the NamingManger.

Returns:
the NamingManger

setNamingManager

public void setNamingManager(JNamingManager naming)
Sets the NamingManger.

Parameters:
naming - the NamingManger to set

setResourceService

public void setResourceService(ResourceService resourceService)
Parameters:
resourceService - the resourceService to set

getResourceService

public ResourceService getResourceService()
Returns:
the resourceService

setCmiService

public void setCmiService(CmiService cmiService)
Set a reference to the CMI service.

Parameters:
cmiService - a reference to the CMI service

getCmiService

public CmiService getCmiService()
Return a reference to the CMI service.

Returns:
a reference to the CMI service

addContainer

public void addContainer(org.ow2.easybeans.api.EZBContainer ejbContainer)
Adds the given container.

Specified by:
addContainer in interface IEasyBeansService
Parameters:
ejbContainer - the EJB3 bundle container to add

removeContainer

public void removeContainer(org.ow2.easybeans.api.EZBContainer ejbContainer)
Remove the given container.

Specified by:
removeContainer in interface IEasyBeansService
Parameters:
ejbContainer - the given container

initWorkingDirectory

protected void initWorkingDirectory()
Create working directory for EJB3.


setWorkCleanerService

protected void setWorkCleanerService(WorkCleanerService workCleanerService)
Method called when the workCleanerService is bound to the component.

Parameters:
workCleanerService - the workCleanerService reference

isEJB3DeployedByWorkName

public boolean isEJB3DeployedByWorkName(String unpackName)
Test if the specified unpack name is already deployed or not. This method is defined in the IEasyBeansService interface.

Specified by:
isEJB3DeployedByWorkName in interface IEasyBeansService
Parameters:
unpackName - the name of the EJB3 file.
Returns:
true if the EJB3 is deployed, else false.

registerEmbeddedService

public void registerEmbeddedService()
Register Embedded as an OSGi service.

Specified by:
registerEmbeddedService in interface IEasyBeansService

setVersioningService

public void setVersioningService(VersioningService versioningService)
Parameters:
versioningService - The versioning service to set.

unsetVersioningService

public void unsetVersioningService()
Sets the versioning service to null.


getVersioningService

public VersioningService getVersioningService()
Returns:
The versioning service.

setJ2EEServer

public void setJ2EEServer(J2EEServerService j2eeServer)
Parameters:
j2eeServer - the j2eeServer to set

addConfigurationExtension

public void addConfigurationExtension(org.ow2.easybeans.server.EasyBeansConfigurationExtension extension)
Add a new extension to Embedded, that will be used for the next EZBContainer creation.

Parameters:
extension - Configuration extension to be added

removeConfigurationExtension

public void removeConfigurationExtension(org.ow2.easybeans.server.EasyBeansConfigurationExtension extension)
Disengage the given extension

Parameters:
extension -

setEventService

public void setEventService(org.ow2.util.event.api.IEventService eventService)
Parameters:
eventService - the EventService to set

setCommonsModelerExtService

public void setCommonsModelerExtService(org.ow2.util.jmx.api.ICommonsModelerExtService commonsModelerExtService)
Parameters:
commonsModelerExtService - the CommonsModelerExtService to set

buildByteCodeEnhancementClassLoader

public ClassLoader buildByteCodeEnhancementClassLoader(URL[] urls,
                                                       ClassLoader parentClassLoader)
Allow to build a classloader that provide JPA classtransformers and bytecode modifications.

Specified by:
buildByteCodeEnhancementClassLoader in interface IEasyBeansService
Parameters:
urls - the array of URLs to use
parentClassLoader - the parent classloader
Returns:
a classloader.

buildInjectionHolder

public org.ow2.easybeans.deployment.api.EZBInjectionHolder buildInjectionHolder(org.ow2.easybeans.persistence.api.EZBPersistenceUnitManager persistenceUnitManager,
                                                                                org.ow2.easybeans.resolver.api.EZBJNDIResolver jndiResolver)
Specified by:
buildInjectionHolder in interface IEasyBeansService
Parameters:
persistenceUnitManager - the Persistence Unit Manager (if any)
jndiResolver - the JNDI resolver (if any)
Returns:
a new Injection holder.

buildApplicationJNDIResolver

public org.ow2.easybeans.resolver.api.EZBApplicationJNDIResolver buildApplicationJNDIResolver()
Specified by:
buildApplicationJNDIResolver in interface IEasyBeansService
Returns:
a new JNDI application resolver.

getPersistenceUnitManager

public org.ow2.easybeans.persistence.api.EZBPersistenceUnitManager getPersistenceUnitManager(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable,
                                                                                             ClassLoader appClassLoader)
                                                                                      throws org.ow2.easybeans.persistence.api.PersistenceXmlFileAnalyzerException
Gets the persistence unit manager for the given EAR and classloader.

Specified by:
getPersistenceUnitManager in interface IEasyBeansService
Parameters:
earDeployable - the ear deployable
appClassLoader - the classloader used as deployable
Returns:
the given persistence unit manager
Throws:
org.ow2.easybeans.persistence.api.PersistenceXmlFileAnalyzerException

getPersistenceUnitManager

public org.ow2.easybeans.persistence.api.EZBPersistenceUnitManager getPersistenceUnitManager(org.ow2.util.archive.api.IArchive archive,
                                                                                             ClassLoader classLoader)
                                                                                      throws org.ow2.easybeans.persistence.api.PersistenceXmlFileAnalyzerException
Gets the persistence unit manager for the given archive and classloader.

Specified by:
getPersistenceUnitManager in interface IEasyBeansService
Parameters:
archive - the archive
classLoader - the classloader used to analyze persistence
Returns:
the given persistence unit manager
Throws:
org.ow2.easybeans.persistence.api.PersistenceXmlFileAnalyzerException

getNamingStrategy

public org.ow2.easybeans.api.naming.EZBNamingStrategy getNamingStrategy(String prefix,
                                                                        org.ow2.easybeans.api.naming.EZBNamingStrategy oldNamingStrategy)
Build a new Strategy for the given prefix and the old strategy.

Specified by:
getNamingStrategy in interface IEasyBeansService
Parameters:
prefix - the given prefix
oldNamingStrategy - the strategy
Returns:
the new strategy

getResourceCheckerManager

public IResourceCheckerManager getResourceCheckerManager()
Returns:
the resource checker manager

setResourceCheckerManager

public void setResourceCheckerManager(IResourceCheckerManager resourceCheckerManager)
Sets the resource checker manager.

Parameters:
resourceCheckerManager - the given instance

unsetResourceCheckerManager

public void unsetResourceCheckerManager()
Unset the resource checker manager.



Copyright © 2010 OW2 Consortium. All Rights Reserved.