|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.management.NotificationBroadcasterSupport
org.ow2.jonas.lib.reconfig.ReconfigEmitter
org.ow2.jonas.lib.service.AbsServiceImpl
org.ow2.jonas.web.base.BaseWebContainerService
public abstract class BaseWebContainerService
This abstract class provides an implementation for a dynamic JWebContainerService service.
| Nested Class Summary | |
|---|---|
class |
BaseWebContainerService.WebLoaderHolder
Holds the ClassLoader used to retrieve the WebApp JNDI Context and the JOnAS Webapp ClasLoader. |
| Field Summary | |
|---|---|
protected static String |
INEAR_WORK_WEBAPPS_DIR_SUFFIX
The name of the property used in work directory for EAR webapps (in ear case). |
protected JmxService |
jmxService
JMX Service. |
protected static String |
JONAS_BASE
The name of the JONAS_BASE directory. |
protected static String |
SINGLE_WORK_WEBAPPS_DIR_SUFFIX
The name of the property used in work directory for single webapps (not ear case). |
protected static String |
WORK_DIR
The name of the working directory. |
protected static String |
WORK_WEBAPPS_DIR
The name of the working apps directory. |
| Fields inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter |
|---|
RECONFIG_TYPE, SAVE_RECONFIG_TYPE |
| Constructor Summary | |
|---|---|
BaseWebContainerService()
Default constructor. |
|
| Method Summary | |
|---|---|
void |
bindJaxwsService(IJAXWSService jaxwsService)
Store the reference to the JAWS Service. |
protected URL |
checkWarDeployed(String fileName)
Check if the specified file is already deployed in the JOnAS server and return the URL of this deployed war file. |
protected URL |
checkWarFile(String fileName)
Check if the specified file name correspond to a file which is located relatively to where the JOnAS server is launched or in the $JONAS_BASE/web-apps. |
void |
deployWars(Context ctx)
Deploy the given wars of an ear file with the specified parent classloader (ejb classloader or ear classloader). |
protected abstract void |
doRegisterWar(Context ctx)
Create the environment and delegate the operation to the implementation of the web container. |
protected void |
doStart()
Start the service. |
protected void |
doStop()
Stop the service. |
protected abstract void |
doUnRegisterWar(Context ctx)
Delegate the unregistration to the implementation of the web container. |
protected ClassLoader |
getAppsClassLoader()
|
URLClassLoader |
getClassLoader(URL warURL,
org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable,
ClassLoader parentLoader)
Return the class loader of the given warURL. |
protected JComponentContextFactory |
getContextFactory()
|
ClassLoader |
getContextLinkedClassLoader(URL warURL)
|
protected String |
getContextRoot(String contextRoot,
URLClassLoader earClassLoader,
URL warURL,
WebContainerDeploymentDesc webDD)
Gets the context root for a WAR. |
Integer |
getCurrentNumberOfWars()
|
abstract String |
getDefaultHost()
Return the Default host name of the web container. |
abstract String |
getDefaultHttpPort()
Return the Default HTTP port number of the web container (can be null if multiple HTTP connector has been set). |
abstract String |
getDefaultHttpsPort()
Return the Default HTTPS port number of the web container (can be null if multiple HTTPS connector has been set). |
List<String> |
getDeployedWars()
Return the list of all loaded web applications. |
protected IJAXWSService |
getJAXWSService()
|
protected static org.objectweb.util.monolog.api.Logger |
getLogger()
|
protected JNamingManager |
getNaming()
|
String |
getServerName()
Gets the name of the server which is the web container. |
String |
getServerVersion()
Gets the version of the server which is the web container. |
protected URL |
getUnpackDir(URL warURL,
org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable)
Return the URL where warURL has been unpacked. |
VersioningService |
getVersioningService()
|
protected List |
getWar(String pContext)
Get a list of wars identified by their Context. |
War |
getWar(URL url)
Get the war identified by its URL (.war). |
protected Hashtable |
getWarBindings()
|
protected List |
getWarDeployed()
|
protected Hashtable |
getWarLoaders()
|
protected WebServicesService |
getWsService()
|
protected void |
initWorkingDirectory()
Create working directory for applications. |
boolean |
isVersioningEnabled()
|
boolean |
isWarDeployedByWorkName(String unpackName)
Test if the specified unpack name is already deployed or not. |
boolean |
isWarLoaded(String fileName)
Test if the specified filename is already deployed or not. |
protected void |
registerWar(Context ctx)
Create the environment and delegate the operation to the implementation of the web container. |
void |
registerWar(String fileName)
Register a WAR by delegating the operation to the registerWar() method. |
protected void |
registerWarMBean(War war,
String domainName,
String fileName)
Register War MBean. |
protected void |
registerWebServiceMBean(Object service,
String domainName)
Register WEB Container Service MBean. |
void |
removeCache(ClassLoader earClassLoader)
Make a cleanup of the cache of deployment descriptor. |
void |
setContextFactory(JComponentContextFactory contextFactory)
|
void |
setDeployerManager(org.ow2.util.ee.deploy.api.deployer.IDeployerManager deployerManager)
|
void |
setJmxService(JmxService jmxService)
|
void |
setNaming(JNamingManager naming)
|
void |
setParsingwithvalidation(boolean validate)
|
protected void |
setServerName(String serverName)
|
protected void |
setServerVersion(String serverVersion)
|
void |
setVersioningService(VersioningService versioningService)
|
void |
setWarDeployableMetadataFactory(org.ow2.util.ee.metadata.war.api.IWarDeployableMetadataFactory warDeployableMetadataFactory)
|
protected void |
setWebEnvironment(Context ctxParam,
org.ow2.easybeans.deployment.api.EZBInjectionHolder ezbInjectionHolder,
ClassLoader webAppClassLoader)
Set the environment of the web container inside the given context. |
void |
setWorkCleanerService(WorkCleanerService workCleanerService)
Method called when the workCleanerService is bound to the component. |
void |
setWsService(WebServicesService wsService)
|
void |
unbindJaxwsService(IJAXWSService jaxwsService)
Release the reference to the JAWS Service. |
void |
unDeployWars(URL[] urls)
Undeploy the given wars of an ear file with the specified parent classloader (ejb classloader or ear classloader). |
protected void |
unRegisterWar(Context ctx)
Delegate the unregistration to the implementation of the web container and delete the environment associated to the WAR file. |
void |
unRegisterWar(String fileName)
Unregister a WAR by delegating the operation to the unRegisterWar() method. |
protected void |
unregisterWarMBean(String domainName,
String fileName)
Unegister War MBean. |
protected void |
unregisterWebServiceMBean(String domainName)
Unregister WEB Container Service MBean. |
void |
unsetVersioningService()
Sets the versioning service to null. |
protected abstract void |
updateServerInfos()
Update info of the serverName and serverVersion. |
| 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 |
|---|
protected static final String JONAS_BASE
protected static final String WORK_DIR
protected static final String WORK_WEBAPPS_DIR
protected static final String SINGLE_WORK_WEBAPPS_DIR_SUFFIX
protected static final String INEAR_WORK_WEBAPPS_DIR_SUFFIX
protected JmxService jmxService
| Constructor Detail |
|---|
public BaseWebContainerService()
| Method Detail |
|---|
public void setParsingwithvalidation(boolean validate)
validate - must we parse web.xml files with validation ?
protected void doStart()
throws ServiceException
doStart in class AbsServiceImplServiceException - if the startup failed.
protected void doStop()
throws ServiceException
doStop in class AbsServiceImplServiceException - if the stop failed.
protected abstract void doRegisterWar(Context ctx)
throws JWebContainerServiceException
ctx - the context which contains the configuration in order to
deploy a WAR.
JWebContainerServiceException - if the registration of the WAR
failed.
protected abstract void doUnRegisterWar(Context ctx)
throws JWebContainerServiceException
ctx - the context which contains the configuration in order to
undeploy a WAR.
JWebContainerServiceException - if the unregistration failed.
protected URL getUnpackDir(URL warURL,
org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable)
throws JWebContainerServiceException
warURL - the URL of the warearDeployable - the EAR deployable (could be null)
JWebContainerServiceException - when it is impossible to retrieve
the unpacked URL.
public URLClassLoader getClassLoader(URL warURL,
org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable,
ClassLoader parentLoader)
throws JWebContainerServiceException
getClassLoader in interface JWebContainerServicewarURL - the url of the war we want to get the loaderearDeployable - If the WAR is in an EAR applicationparentLoader - the ejb class loader of the ear. May be null in non
ear case.
JWebContainerServiceException - if the process failed.public ClassLoader getContextLinkedClassLoader(URL warURL)
getContextLinkedClassLoader in interface JWebContainerServicewarURL - the URL of the webapp
protected void registerWar(Context ctx)
throws JWebContainerServiceException
ctx - the context which contains the configuration in order to
deploy a WAR.
JWebContainerServiceException - if the registration of the WAR
failed.
protected String getContextRoot(String contextRoot,
URLClassLoader earClassLoader,
URL warURL,
WebContainerDeploymentDesc webDD)
contextRoot - Current context root, null if none.earClassLoader - EAR classloader for the WAR, null if none.warURL - War file's URL.webDD - Deployment descriptor of the WAR file.
public void registerWar(String fileName)
throws RemoteException,
JWebContainerServiceException
registerWar in interface JWebContainerServicefileName - the name of the war to deploy.
RemoteException - if rmi call failed.
JWebContainerServiceException - if the registration failed.
protected void setWebEnvironment(Context ctxParam,
org.ow2.easybeans.deployment.api.EZBInjectionHolder ezbInjectionHolder,
ClassLoader webAppClassLoader)
throws JWebContainerServiceException
ctxParam - the java:comp/env/ environment where is stored the values
of the web container environment.ezbInjectionHolder - the easybeans injection handler.webAppClassLoader - the classloader of the web application.
JWebContainerServiceException - if the populating of the
environment failed.
protected void unRegisterWar(Context ctx)
throws JWebContainerServiceException
ctx - the context which contains the configuration in order to
undeploy a WAR.
JWebContainerServiceException - if the unregistration failed.
public void unRegisterWar(String fileName)
throws RemoteException,
JWebContainerServiceException
unRegisterWar in interface JWebContainerServicefileName - the name of the war to undeploy.
RemoteException - if rmi call failed.
JWebContainerServiceException - if the unregistration failed.
public void deployWars(Context ctx)
throws JWebContainerServiceException
deployWars in interface JWebContainerServicectx - the context containing the configuration to deploy the wars.
JWebContainerServiceException - if an error occurs during the
deployment.public void unDeployWars(URL[] urls)
unDeployWars in interface JWebContainerServiceurls - the list of the urls of the wars to undeploy.public War getWar(URL url)
url - the URL of the war to get.
protected List getWar(String pContext)
pContext - the context of the war to get.
public void removeCache(ClassLoader earClassLoader)
removeCache in interface JWebContainerServiceearClassLoader - the ClassLoader of the ear application to remove
from the cache.
protected URL checkWarFile(String fileName)
throws JWebContainerServiceException
fileName - the file to check if it exists.
JWebContainerServiceException - if the specified file does't
exists.
protected URL checkWarDeployed(String fileName)
throws JWebContainerServiceException
fileName - the name of the WAR file to check.
JWebContainerServiceException - if the file name doesn't correspond
to a deployed war.public Integer getCurrentNumberOfWars()
getCurrentNumberOfWars in interface BaseWebContainerServiceMBeanpublic boolean isWarLoaded(String fileName)
isWarLoaded in interface BaseWebContainerServiceMBeanisWarLoaded in interface JWebContainerServicefileName - the name of the war file.
public List<String> getDeployedWars()
getDeployedWars in interface BaseWebContainerServiceMBeanpublic String getServerName()
getServerName in interface BaseWebContainerServiceMBeanpublic String getServerVersion()
getServerVersion in interface BaseWebContainerServiceMBeanpublic boolean isWarDeployedByWorkName(String unpackName)
JWebContainerService interface.
isWarDeployedByWorkName in interface JWebContainerServiceunpackName - the name of the ear file.
protected abstract void updateServerInfos()
public abstract String getDefaultHost()
throws JWebContainerServiceException
getDefaultHost in interface JWebContainerServiceJWebContainerServiceException - when it is impossible to get the
Default Host.
public abstract String getDefaultHttpPort()
throws JWebContainerServiceException
getDefaultHttpPort in interface JWebContainerServiceJWebContainerServiceException - when it is impossible to get the
Default Http port.
public abstract String getDefaultHttpsPort()
throws JWebContainerServiceException
getDefaultHttpsPort in interface JWebContainerServiceJWebContainerServiceException - when it is impossible to get the
Default Https port.protected static org.objectweb.util.monolog.api.Logger getLogger()
protected JNamingManager getNaming()
protected void setServerName(String serverName)
serverName - The serverName to set.protected void setServerVersion(String serverVersion)
serverVersion - The serverVersion to set.protected JComponentContextFactory getContextFactory()
JComponentContextFactory.
protected void registerWebServiceMBean(Object service,
String domainName)
service - web container service to managedomainName - domain nameprotected void unregisterWebServiceMBean(String domainName)
domainName - domain name
protected void registerWarMBean(War war,
String domainName,
String fileName)
war - War instance to managedomainName - domain namefileName - the war file name
protected void unregisterWarMBean(String domainName,
String fileName)
domainName - domain namefileName - the war file namepublic void setJmxService(JmxService jmxService)
jmxService - the jmxService to setpublic void setWsService(WebServicesService wsService)
wsService - the wsService to setpublic void setNaming(JNamingManager naming)
naming - the naming to setpublic void setContextFactory(JComponentContextFactory contextFactory)
contextFactory - the contextFactory to setpublic void setDeployerManager(org.ow2.util.ee.deploy.api.deployer.IDeployerManager deployerManager)
deployerManager - the IDeployerManager to use.protected void initWorkingDirectory()
public void setWorkCleanerService(WorkCleanerService workCleanerService)
workCleanerService - the workCleanerService referenceprotected Hashtable getWarLoaders()
protected Hashtable getWarBindings()
protected List getWarDeployed()
protected WebServicesService getWsService()
protected ClassLoader getAppsClassLoader()
public void setVersioningService(VersioningService versioningService)
versioningService - The versioning service to set.public void unsetVersioningService()
public VersioningService getVersioningService()
public boolean isVersioningEnabled()
public void setWarDeployableMetadataFactory(org.ow2.util.ee.metadata.war.api.IWarDeployableMetadataFactory warDeployableMetadataFactory)
warDeployableMetadataFactory - the deployable metadata factory servicepublic void bindJaxwsService(IJAXWSService jaxwsService)
jaxwsService - jaxws Serviceprotected IJAXWSService getJAXWSService()
public void unbindJaxwsService(IJAXWSService jaxwsService)
jaxwsService - jaxws Service
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||