org.ow2.jonas.ear.internal
Class JOnASEARService

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.ear.internal.JOnASEARService
All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, org.ow2.jonas.ear.EarService, JOnASEARServiceMBean, org.ow2.jonas.service.Service

public class JOnASEARService
extends org.ow2.jonas.lib.service.AbsServiceImpl
implements org.ow2.jonas.ear.EarService, JOnASEARServiceMBean

JOnAS EAR Service Implementation class. This class provides an implementation of the ear service.

Author:
Florent Benoit, Ludovic Bert Contributor(s): Adriana Danes: highlight configuration properties Eric Hardesty: added ability to include rar files in an ear Michel-Ange Anton : new JSR77 MBean

Field Summary
protected static String APPS_DIR
          The name of the apps directory.
protected static String JONAS_BASE
          The name of the JONAS_BASE directory.
protected static String WORK_APPS_DIR
          The name of the working apps directory.
protected static String WORK_DIR
          The name of the working directory.
 
Fields inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
JOnASEARService()
          Initialize some Maps at instantiation time.
 
Method Summary
 void checkRequirements()
          
 String deployEar(Context ctx)
          Deploy an EAR file with sending JAR file to the EJB container and WAR file to the WEB container and RAR file to the resource service.
 String deployEar(String fileName)
          Deploy an ear with its given fileName.
protected  void doStart()
          Start the EAR service.
protected  void doStop()
          Stop the EAR service.
 String getAppsDirectory()
          Return the Apps directory.
 List getAutoloadDirectories()
          Return the list of "autoload" directories for applications.
 Integer getCurrentNumberOfEars()
           
 List getDeployableEars()
          Return the list of installed Applications ready to deploy.
 List getDeployedEars()
          Return the list of all loaded Applications.
 Set getEarNames()
          This method is added temporarily.
 List getInstalledEars()
          Return the list of installed Applications.
 Boolean isEarDeployed(String fileName)
          Test if the specified filename is already deployed or not.
 boolean isEarDeployedByUnpackName(String unpackName)
          Test if the specified unpack name is already deployed or not.
 boolean isEarLoaded(String fileName)
          Test if the specified filename is already deployed or not.
 void setAutoloaddir(String directoriesValue)
           
 void setDeployerManager(org.ow2.util.ee.deploy.api.deployer.IDeployerManager deployerManager)
           
 void setDescriptors(String descriptors)
           
 void setEasyBeansService(org.ow2.jonas.ejb.easybeans.IEasyBeansService service)
           
 void setEjbService(org.ow2.jonas.ejb.EJBService ejbService)
           
 void setJmxService(org.ow2.jonas.jmx.JmxService jmxService)
           
 void setParsingwithvalidation(boolean validate)
           
 void setResourceService(org.ow2.jonas.resource.ResourceService resourceService)
           
 void setWebContainerService(org.ow2.jonas.web.JWebContainerService webContainerService)
           
 void setWsService(org.ow2.jonas.ws.WebServicesService wsService)
           
 void unDeployEar(Context ctx)
          Undeploy an EAR by sending the request to the EJB container and to the WEB container and the Resource service.
 void unDeployEar(String fileName)
          Undeploy an EAR by delegating the operation to the unDeployEar() method.
 void unsetDeployerManager()
          Unbind the IDeployerManager.
 void unsetEasyBeansService()
          Unbind the IEasyBeansService.
 void unsetEjbService()
          Unbind the EJBService.
 void unsetResourceService()
          Unbind the ResourceService.
 void unsetWebContainerService()
          Unbind the JWebContainerService.
 void unsetWsService()
          Unbind the WebServicesService.
 
Methods inherited from class org.ow2.jonas.lib.service.AbsServiceImpl
convertToList, doInit, getDomainName, getJonasServerName, getName, getServerProperties, init, isOSGi, 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

JONAS_BASE

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


APPS_DIR

protected static final String APPS_DIR
The name of the apps directory.


WORK_DIR

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


WORK_APPS_DIR

protected static final String WORK_APPS_DIR
The name of the working apps directory.

Constructor Detail

JOnASEARService

public JOnASEARService()
Initialize some Maps at instantiation time.

Method Detail

setParsingwithvalidation

public void setParsingwithvalidation(boolean validate)
Parameters:
validate - Use a validating parser ?

setDescriptors

public void setDescriptors(String descriptors)
Parameters:
descriptors - EARs to be deployed at startup.

setAutoloaddir

public void setAutoloaddir(String directoriesValue)
Parameters:
directoriesValue - Autoload directories

checkRequirements

public void checkRequirements()
                       throws org.ow2.jonas.service.ServiceException

Specified by:
checkRequirements in interface org.ow2.jonas.service.Service
Overrides:
checkRequirements in class org.ow2.jonas.lib.service.AbsServiceImpl
Throws:
org.ow2.jonas.service.ServiceException
See Also:
AbsServiceImpl.checkRequirements()

doStop

protected void doStop()
               throws org.ow2.jonas.service.ServiceException
Stop the EAR service.

Specified by:
doStop in class org.ow2.jonas.lib.service.AbsServiceImpl
Throws:
org.ow2.jonas.service.ServiceException - if the stop failed.

deployEar

public String deployEar(Context ctx)
                 throws org.ow2.jonas.ear.EarServiceException
Deploy an EAR file with sending JAR file to the EJB container and WAR file to the WEB container and RAR file to the resource service.

Specified by:
deployEar in interface org.ow2.jonas.ear.EarService
Parameters:
ctx - the context which contains the configuration in order to deploy an EAR.
Returns:
The OBJECT_NAME of the J2EE Application MBean associated to the deployed EAR the Application Container
Throws:
org.ow2.jonas.ear.EarServiceException - if the deployment of the EAR failed.

deployEar

public String deployEar(String fileName)
                 throws Exception
Deploy an ear with its given fileName.

Specified by:
deployEar in interface org.ow2.jonas.ear.EarService
Parameters:
fileName - file to deploy (ear)
Returns:
The ObjectName of the J2EE Application MBean associated to the deployed EAR
Throws:
Exception - if the deployment of the EAR failed.
See Also:
EarService.deployEar(java.lang.String)

doStart

protected void doStart()
                throws org.ow2.jonas.service.ServiceException
Start the EAR service.

Specified by:
doStart in class org.ow2.jonas.lib.service.AbsServiceImpl
Throws:
org.ow2.jonas.service.ServiceException - if the startup failed.

unDeployEar

public void unDeployEar(Context ctx)
                 throws org.ow2.jonas.ear.EarServiceException
Undeploy an EAR by sending the request to the EJB container and to the WEB container and the Resource service.

Specified by:
unDeployEar in interface org.ow2.jonas.ear.EarService
Parameters:
ctx - the context which contains the configuration in order to undeploy an EAR.
Throws:
org.ow2.jonas.ear.EarServiceException - if the undeployment of the EAR failed.

unDeployEar

public void unDeployEar(String fileName)
                 throws Exception
Undeploy an EAR by delegating the operation to the unDeployEar() method. This is used for JMX management.

Specified by:
unDeployEar in interface org.ow2.jonas.ear.EarService
Parameters:
fileName - the fileName of the ear which must be be undeployed.
Throws:
Exception - if the undeployment of the EAR failed.
See Also:
EarService.unDeployEar(java.lang.String)

getCurrentNumberOfEars

public Integer getCurrentNumberOfEars()
Specified by:
getCurrentNumberOfEars in interface JOnASEARServiceMBean
Returns:
current number of ears deployed in the JOnAS server

getInstalledEars

public List getInstalledEars()
                      throws Exception
Return the list of installed Applications. The EAR files or the directories with expanded Applications are searched in JONAS_BASE/apps and all Applications directories 'autoload'.

Specified by:
getInstalledEars in interface JOnASEARServiceMBean
Returns:
The list of EAR files or the directories with expanded Applications found
Throws:
Exception - if the list can't be retrieved

getEarNames

public Set getEarNames()
This method is added temporarily. It will disapear when Ears will have their associated MBeans (when Ears will become manageable)

Specified by:
getEarNames in interface JOnASEARServiceMBean
Returns:
the names of the ears currently deployed in the JOnAS server

isEarLoaded

public boolean isEarLoaded(String fileName)
Test if the specified filename is already deployed or not. This method is a management method provided by the EarServerice MBean.

Specified by:
isEarLoaded in interface JOnASEARServiceMBean
Parameters:
fileName - the name of the ear file.
Returns:
true if the ear is deployed, else false.

isEarDeployed

public Boolean isEarDeployed(String fileName)
Test if the specified filename is already deployed or not. This method is defined in the EarService interface.

Specified by:
isEarDeployed in interface org.ow2.jonas.ear.EarService
Parameters:
fileName - the name of the ear file.
Returns:
true if the ear is deployed, else false.

isEarDeployedByUnpackName

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

Specified by:
isEarDeployedByUnpackName in interface org.ow2.jonas.ear.EarService
Parameters:
unpackName - the name of the ear file.
Returns:
true if the ear is deployed, else false.

getDeployedEars

public List getDeployedEars()
Return the list of all loaded Applications.

Specified by:
getDeployedEars in interface JOnASEARServiceMBean
Returns:
The list of deployed Applications

getDeployableEars

public List getDeployableEars()
                       throws Exception
Return the list of installed Applications ready to deploy.

Specified by:
getDeployableEars in interface JOnASEARServiceMBean
Returns:
The list of deployable Applications
Throws:
Exception - if the list can't be built

getAutoloadDirectories

public List getAutoloadDirectories()
Return the list of "autoload" directories for applications.

Specified by:
getAutoloadDirectories in interface JOnASEARServiceMBean
Returns:
The list of all "autoload" directories

getAppsDirectory

public String getAppsDirectory()
Return the Apps directory.

Specified by:
getAppsDirectory in interface JOnASEARServiceMBean
Returns:
The Apps directory

setJmxService

public void setJmxService(org.ow2.jonas.jmx.JmxService jmxService)
Parameters:
jmxService - the jmxService to set

setEjbService

public void setEjbService(org.ow2.jonas.ejb.EJBService ejbService)
Parameters:
ejbService - the ejbService to set

unsetEjbService

public void unsetEjbService()
Unbind the EJBService.


setWebContainerService

public void setWebContainerService(org.ow2.jonas.web.JWebContainerService webContainerService)
Parameters:
webContainerService - the webContainerService to set

unsetWebContainerService

public void unsetWebContainerService()
Unbind the JWebContainerService.


setWsService

public void setWsService(org.ow2.jonas.ws.WebServicesService wsService)
Parameters:
wsService - the wsService to set

unsetWsService

public void unsetWsService()
Unbind the WebServicesService.


setResourceService

public void setResourceService(org.ow2.jonas.resource.ResourceService resourceService)
Parameters:
resourceService - the resourceService to set

unsetResourceService

public void unsetResourceService()
Unbind the ResourceService.


setEasyBeansService

public void setEasyBeansService(org.ow2.jonas.ejb.easybeans.IEasyBeansService service)
Parameters:
service - the EJB3 Service to be injected.

unsetEasyBeansService

public void unsetEasyBeansService()
Unbind the IEasyBeansService.


setDeployerManager

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

unsetDeployerManager

public void unsetDeployerManager()
Unbind the IDeployerManager.



Copyright © 2008 OW2 Consortium. All Rights Reserved.