org.objectweb.jonas.web
Interface JWebContainerService

All Superinterfaces:
Service
All Known Subinterfaces:
CatalinaJWebContainerService
All Known Implementing Classes:
AbsJWebContainerServiceImpl, CatalinaJWebContainerServiceImpl, CatalinaJWebContainerServiceWrapper, CatalinaJWebContainerServiceWrapper

public interface JWebContainerService
extends Service

JOnAS WEB Container Service interface. This interface provides a description of a web container service.

Author:
Ludovic Bert, Florent Benoit

Method Summary
 void deployWars(javax.naming.Context ctx)
          Deploy the given wars of an ear file with the specified parent classloader (ejb classloader or ear classloader).
 java.net.URLClassLoader getClassLoader(java.net.URL warURL, java.lang.String earAppName, java.lang.ClassLoader ejbClassLoader)
          Return the class loader of the given warURL.
 java.lang.ClassLoader getContextLinkedClassLoader(java.net.URL warURL)
           
 java.lang.String getDefaultHost()
          Return the Default host name of the web container.
 java.lang.String getDefaultHttpPort()
          Return the Default HTTP port number of the web container (can be null if multiple HTTP connector has been set).
 java.lang.String getDefaultHttpsPort()
          Return the Default HTTPS port number of the web container (can be null if multiple HTTPS connector has been set).
 War getWar(java.net.URL url)
          Get the war identified by its URL (.war).
 java.lang.String getWebappsDirectory()
          Return the WebApps directory.
 boolean isWarLoaded(java.lang.String fileName)
          Test if the specified filename is already deployed or not
 void registerWarMBean(java.lang.String fileName)
          Register a WAR by delegating the operation to the registerWar() method.
 void removeCache(java.lang.ClassLoader earClassLoader)
          Make a cleanup of the cache of deployment descriptor.
 void unDeployWars(java.net.URL[] urls)
          Undeploy the given wars of an ear file with the specified parent classloader (ejb classloader or ear classloader).
 void unRegisterWarMBean(java.lang.String fileName)
          Unregister a WAR by delegating the operation to the unRegisterWar() method.
 
Methods inherited from interface org.objectweb.jonas.service.Service
getName, init, isStarted, setName, start, stop
 

Method Detail

deployWars

public void deployWars(javax.naming.Context ctx)
                throws JWebContainerServiceException
Deploy the given wars of an ear file with the specified parent classloader (ejb classloader or ear classloader). (This method is only used for the ear applications, not for the web applications).

Parameters:
ctx - the context containing the configuration to deploy the wars.
This context contains the following parameters :
- urls the list of the urls of the wars to deploy.
- earURL the URL of the ear application file.
- parentClassLoader the parent classLoader of the wars.
- earClassLoader the ear classLoader of the j2ee app.
- altDDs the optional URI of deployment descriptor.
- contextRoots the optional context root of the wars.
Throws:
JWebContainerServiceException - if an error occurs during the deployment.

unDeployWars

public void unDeployWars(java.net.URL[] urls)
Undeploy the given wars of an ear file with the specified parent classloader (ejb classloader or ear classloader). (This method is only used for the ear applications, not for the war applications).

Parameters:
urls - the list of the urls of the wars to undeploy.

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 .

Parameters:
earClassLoader - the ClassLoader of the ear application to remove from the cache.

getDefaultHost

public java.lang.String getDefaultHost()
                                throws JWebContainerServiceException
Return the Default host name of the web container.

Returns:
the Default host name of the web container.
Throws:
JWebContainerServiceException - when it is impossible to get the Default Host.

getDefaultHttpPort

public java.lang.String getDefaultHttpPort()
                                    throws JWebContainerServiceException
Return the Default HTTP port number of the web container (can be null if multiple HTTP connector has been set).

Returns:
the Default HTTP port number of the web container.
Throws:
JWebContainerServiceException - when it is impossible to get the Default Http port.

getDefaultHttpsPort

public java.lang.String getDefaultHttpsPort()
                                     throws JWebContainerServiceException
Return the Default HTTPS port number of the web container (can be null if multiple HTTPS connector has been set).

Returns:
the Default HTTPS port number of the web container.
Throws:
JWebContainerServiceException - when it is impossible to get the Default Https port.

getClassLoader

public java.net.URLClassLoader getClassLoader(java.net.URL warURL,
                                              java.lang.String earAppName,
                                              java.lang.ClassLoader ejbClassLoader)
                                       throws JWebContainerServiceException
Return the class loader of the given warURL. Unpack the associated war and build the loader if it's not in the cache.

Parameters:
warURL - the url of the war we want to get the loader
earAppName - the name of the ear application containing the war. May be null in non ear case.
ejbClassLoader - the ejb class loader of the ear. May be null in non ear case.
Returns:
the class loader of the given warURL.
Throws:
JWebContainerServiceException - if the process failed.

getContextLinkedClassLoader

public java.lang.ClassLoader getContextLinkedClassLoader(java.net.URL warURL)
Parameters:
warURL - the URL of the webapp
Returns:
Returns the ClassLoader used to link a JNDI environnment to a webapp

getWar

public War getWar(java.net.URL url)
Get the war identified by its URL (.war).

Parameters:
url - the URL of the war to get.
Returns:
the war indentified by its URL, or null if the war is not found.

getWebappsDirectory

public java.lang.String getWebappsDirectory()
Return the WebApps directory.

Returns:
The WebApps directory

registerWarMBean

public void registerWarMBean(java.lang.String fileName)
                      throws java.rmi.RemoteException,
                             JWebContainerServiceException
Register a WAR by delegating the operation to the registerWar() method. This is used for JMX management.

Parameters:
fileName - the name of the war to deploy.
Throws:
java.rmi.RemoteException - if rmi call failed.
JWebContainerServiceException - if the registration failed.

isWarLoaded

public boolean isWarLoaded(java.lang.String fileName)
Test if the specified filename is already deployed or not

Parameters:
fileName - the name of the war file.
Returns:
true if the war is deployed, else false.

unRegisterWarMBean

public void unRegisterWarMBean(java.lang.String fileName)
                        throws java.rmi.RemoteException,
                               JWebContainerServiceException
Unregister a WAR by delegating the operation to the unRegisterWar() method. This is used for JMX management.

Parameters:
fileName - the name of the war to undeploy.
Throws:
java.rmi.RemoteException - if rmi call failed.
JWebContainerServiceException - if the unregistration failed.