org.jboss.web
Class AbstractWebContainer

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.deployment.SubDeployerSupport (src) 
              extended byorg.jboss.web.AbstractWebContainer
All Implemented Interfaces:
MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src) , SubDeployer (src)
Direct Known Subclasses:
Tomcat5 (src)

public abstract class AbstractWebContainer
extends SubDeployerSupport (src)

A template pattern class for web container integration into JBoss. This class should be subclasses by web container providers wishing to integrate their container into a JBoss server.

See Also:
AbstractWebDeployer (src)

Nested Class Summary
static interface AbstractWebContainer.WebDescriptorParser (src)
           
 
Nested classes inherited from class org.jboss.deployment.SubDeployerSupport (src)
SubDeployerSupport.ClassConfiguration (src)
 
Field Summary
protected  boolean acceptNonWarDirs
          A flag indicating if local dirs with WEB-INF/web.xml should be treated as wars
protected  java.lang.String defaultSecurityDomain
          The default security-domain name to use
static java.lang.String DEPLOYER
           
protected  java.util.HashMap deploymentMap
          A mapping of deployed warUrl strings to the WebApplication object
static java.lang.String ERROR
           
protected  boolean java2ClassLoadingCompliance
          The parent class loader first model flag
protected  boolean lenientEjbLink
          If true, ejb-links that don't resolve don't cause an error (fallback to jndi-name)
protected  boolean unpackWars
          A flag indicating if war archives should be unpacked
static java.lang.String WEB_APP
           
static java.lang.String WEB_MODULE
           
 
Fields inherited from class org.jboss.deployment.SubDeployerSupport (src)
CONFIGURATION, mainDeployer, nativePrefix, nativeSuffix, relativeOrder, suffixes, tempDeployDir
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.deployment.SubDeployer (src)
CREATE_NOTIFICATION, DESTROY_NOTIFICATION, INIT_NOTIFICATION, RELATIVE_ORDER_100, RELATIVE_ORDER_200, RELATIVE_ORDER_300, RELATIVE_ORDER_400, RELATIVE_ORDER_500, RELATIVE_ORDER_600, RELATIVE_ORDER_700, RELATIVE_ORDER_800, RELATIVE_ORDER_900, START_NOTIFICATION, STOP_NOTIFICATION
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
AbstractWebContainer()
           
 
Method Summary
 boolean accepts(DeploymentInfo (src)  sdi)
          The accepts method is called by MainDeployer to determine which deployer is suitable for a DeploymentInfo.
 void addDeployedApp(java.net.URL warURL, WebApplication (src)  webApp)
           
 void create(DeploymentInfo (src)  di)
          Create a WebModule service, register it under the name "jboss.web.deployment:war="+di.shortName and invoke the ServiceController.create(jmxname, depends) using the depends found in the WebMetaData.
 void destroy(DeploymentInfo (src)  di)
          Invokes the ServiceController.destroy(jmxName) to destroy the WebModule and its dependents.
 boolean getAcceptNonWarDirs()
          Get the flag indicating if local dirs with WEB-INF/web.xml should be treated as wars
static java.net.URL[] getClassLoaderURLs(java.lang.ClassLoader cl)
          Use reflection to access a URL[] getURLs method so that non-URLClassLoader class loaders that support this method can provide info.
 java.lang.String[] getCompileClasspath(java.lang.ClassLoader loader)
          A utility method that walks up the ClassLoader chain starting at the given loader and queries each ClassLoader for a 'URL[] getURLs()' method from which a complete classpath of URL strings is built.
 org.w3c.dom.Element getConfig()
          An accessor for any configuration element set via setConfig.
 java.lang.String getDefaultSecurityDomain()
          Get the default security domain implementation to use if a war does not declare a security-domain.
 WebApplication (src) getDeployedApp(java.lang.String warUrl)
          Get the WebApplication object for a deployed war.
 java.util.Iterator getDeployedApplications()
          Returns the applications deployed by the web container subclasses.
abstract  AbstractWebDeployer (src) getDeployer(DeploymentInfo (src)  di)
           
 boolean getJava2ClassLoadingCompliance()
          Get the flag indicating if the normal Java2 parent first class loading model should be used over the servlet 2.3 web container first model.
 boolean getLenientEjbLink()
          Get the flag indicating if ejb-link errors should be ignored in favour of trying the jndi-name in jboss-web.xml
 java.lang.String getSubjectAttributeName()
          Get the session attribute number under which the caller Subject is stored
 boolean getUnpackWars()
          Set the flag indicating if war archives should be unpacked.
 void init(DeploymentInfo (src)  di)
          Sub-classes should override this method to provide custom 'init' logic.
 boolean isDeployed(java.lang.String warUrl)
          See if a war is deployed.
protected  void parseMetaData(java.lang.String ctxPath, java.net.URL warURL, java.lang.String warName, WebMetaData (src)  metaData)
          This method creates a context-root string from either the WEB-INF/jboss-web.xml context-root element is one exists, or the filename portion of the warURL.
protected  void processNestedDeployments(DeploymentInfo (src)  di)
          WARs do not have nested deployments
 WebApplication (src) removeDeployedApp(java.net.URL warURL)
           
 void setAcceptNonWarDirs(boolean flag)
          Set the flag indicating if local dirs with WEB-INF/web.xml should be treated as wars
 void setConfig(org.w3c.dom.Element config)
          This method is invoked to import an arbitrary XML configuration tree.
 void setDefaultSecurityDomain(java.lang.String defaultSecurityDomain)
          Set the default security domain implementation to use if a war does not declare a security-domain.
 void setJava2ClassLoadingCompliance(boolean flag)
          Set the flag indicating if the normal Java2 parent first class loading model should be used over the servlet 2.3 web container first model.
 void setLenientEjbLink(boolean flag)
          Set the flag indicating if ejb-link errors should be ignored in favour of trying the jndi-name in jboss-web.xml
 void setSubjectAttributeName(java.lang.String subjectAttributeName)
          Set the session attribute number under which the caller Subject is stored
 void setUnpackWars(boolean flag)
          Get the flag indicating if war archives should be unpacked.
 void start(DeploymentInfo (src)  di)
          Invokes the ServiceController.start(jmxName) to start the WebModule after its dependencies are satisfied.
protected  void startService()
          Performs SubDeployer registration.
 void stop(DeploymentInfo (src)  di)
          Invokes the ServiceController.start(jmxName) to stop the WebModule and its dependents.
 
Methods inherited from class org.jboss.deployment.SubDeployerSupport (src)
addDeployableFiles, addDeployableJar, createService, deployUrl, destroyService, emitNotification, getRelativeOrder, getSuffixes, isDeployable, setRelativeOrder, setSuffixes, stopService
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, destroy, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.deployment.SubDeployer (src)
getServiceName
 

Field Detail

DEPLOYER

public static final java.lang.String DEPLOYER
See Also:
Constant Field Values (src)

WEB_APP

public static final java.lang.String WEB_APP
See Also:
Constant Field Values (src)

WEB_MODULE

public static final java.lang.String WEB_MODULE
See Also:
Constant Field Values (src)

ERROR

public static final java.lang.String ERROR
See Also:
Constant Field Values (src)

deploymentMap

protected java.util.HashMap deploymentMap
A mapping of deployed warUrl strings to the WebApplication object


java2ClassLoadingCompliance

protected boolean java2ClassLoadingCompliance
The parent class loader first model flag


unpackWars

protected boolean unpackWars
A flag indicating if war archives should be unpacked


acceptNonWarDirs

protected boolean acceptNonWarDirs
A flag indicating if local dirs with WEB-INF/web.xml should be treated as wars


lenientEjbLink

protected boolean lenientEjbLink
If true, ejb-links that don't resolve don't cause an error (fallback to jndi-name)


defaultSecurityDomain

protected java.lang.String defaultSecurityDomain
The default security-domain name to use

Constructor Detail

AbstractWebContainer

public AbstractWebContainer()
Method Detail

getJava2ClassLoadingCompliance

public boolean getJava2ClassLoadingCompliance()
Get the flag indicating if the normal Java2 parent first class loading model should be used over the servlet 2.3 web container first model.

Returns:
true for parent first, false for the servlet 2.3 model

setJava2ClassLoadingCompliance

public void setJava2ClassLoadingCompliance(boolean flag)
Set the flag indicating if the normal Java2 parent first class loading model should be used over the servlet 2.3 web container first model.

Parameters:
flag - true for parent first, false for the servlet 2.3 model

getUnpackWars

public boolean getUnpackWars()
Set the flag indicating if war archives should be unpacked. This may need to be set to false as long extraction paths under deploy can show up as deployment failures on some platforms.

Returns:
true is war archives should be unpacked

setUnpackWars

public void setUnpackWars(boolean flag)
Get the flag indicating if war archives should be unpacked. This may need to be set to false as long extraction paths under deploy can show up as deployment failures on some platforms.

Parameters:
flag - , true is war archives should be unpacked

getAcceptNonWarDirs

public boolean getAcceptNonWarDirs()
Get the flag indicating if local dirs with WEB-INF/web.xml should be treated as wars

Returns:
true if local dirs with WEB-INF/web.xml should be treated as wars

setAcceptNonWarDirs

public void setAcceptNonWarDirs(boolean flag)
Set the flag indicating if local dirs with WEB-INF/web.xml should be treated as wars

Parameters:
flag - - true if local dirs with WEB-INF/web.xml should be treated as wars

getLenientEjbLink

public boolean getLenientEjbLink()
Get the flag indicating if ejb-link errors should be ignored in favour of trying the jndi-name in jboss-web.xml

Returns:
the LenientEjbLink flag

setLenientEjbLink

public void setLenientEjbLink(boolean flag)
Set the flag indicating if ejb-link errors should be ignored in favour of trying the jndi-name in jboss-web.xml


getDefaultSecurityDomain

public java.lang.String getDefaultSecurityDomain()
Get the default security domain implementation to use if a war does not declare a security-domain.

Returns:
jndi name of the security domain binding to use.

setDefaultSecurityDomain

public void setDefaultSecurityDomain(java.lang.String defaultSecurityDomain)
Set the default security domain implementation to use if a war does not declare a security-domain.

Parameters:
defaultSecurityDomain - - jndi name of the security domain binding to use.

getSubjectAttributeName

public java.lang.String getSubjectAttributeName()
Get the session attribute number under which the caller Subject is stored


setSubjectAttributeName

public void setSubjectAttributeName(java.lang.String subjectAttributeName)
Set the session attribute number under which the caller Subject is stored


getDeployer

public abstract AbstractWebDeployer (src)  getDeployer(DeploymentInfo (src)  di)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

accepts

public boolean accepts(DeploymentInfo (src)  sdi)
Description copied from interface: SubDeployer (src)
The accepts method is called by MainDeployer to determine which deployer is suitable for a DeploymentInfo.

Parameters:
sdi - a DeploymentInfo value
Returns:
a boolean value

init

public void init(DeploymentInfo (src)  di)
          throws DeploymentException (src) 
Description copied from class: SubDeployerSupport (src)
Sub-classes should override this method to provide custom 'init' logic.

This method calls the processNestedDeployments(di) method and then issues a JMX notification of type SubDeployer.INIT_NOTIFICATION. This behaviour can overridden by concrete sub-classes. If further initialization needs to be done, and you wish to preserve the functionality, be sure to call super.init(di) at the end of your implementation.

Specified by:
init in interface SubDeployer (src)
Overrides:
init in class SubDeployerSupport (src)
Throws:
DeploymentException (src)

create

public void create(DeploymentInfo (src)  di)
            throws DeploymentException (src) 
Create a WebModule service, register it under the name "jboss.web.deployment:war="+di.shortName and invoke the ServiceController.create(jmxname, depends) using the depends found in the WebMetaData.

Specified by:
create in interface SubDeployer (src)
Overrides:
create in class SubDeployerSupport (src)
Parameters:
di - - The deployment info for the war
Throws:
DeploymentException (src)

start

public void start(DeploymentInfo (src)  di)
           throws DeploymentException (src) 
Invokes the ServiceController.start(jmxName) to start the WebModule after its dependencies are satisfied.

Specified by:
start in interface SubDeployer (src)
Overrides:
start in class SubDeployerSupport (src)
Parameters:
di - - The deployment info for the war
Throws:
DeploymentException (src)

stop

public void stop(DeploymentInfo (src)  di)
          throws DeploymentException (src) 
Invokes the ServiceController.start(jmxName) to stop the WebModule and its dependents.

Specified by:
stop in interface SubDeployer (src)
Overrides:
stop in class SubDeployerSupport (src)
Parameters:
di - - The deployment info for the war
Throws:
DeploymentException (src)

destroy

public void destroy(DeploymentInfo (src)  di)
             throws DeploymentException (src) 
Invokes the ServiceController.destroy(jmxName) to destroy the WebModule and its dependents.

Specified by:
destroy in interface SubDeployer (src)
Overrides:
destroy in class SubDeployerSupport (src)
Parameters:
di - - The deployment info for the war
Throws:
DeploymentException (src)

isDeployed

public boolean isDeployed(java.lang.String warUrl)
See if a war is deployed.


addDeployedApp

public void addDeployedApp(java.net.URL warURL,
                           WebApplication (src)  webApp)

getDeployedApp

public WebApplication (src)  getDeployedApp(java.lang.String warUrl)
Get the WebApplication object for a deployed war.

Parameters:
warUrl - the war url string as originally passed to deploy().
Returns:
The WebApplication created during the deploy step if the warUrl is valid, null if no such deployment exists.

removeDeployedApp

public WebApplication (src)  removeDeployedApp(java.net.URL warURL)

getDeployedApplications

public java.util.Iterator getDeployedApplications()
Returns the applications deployed by the web container subclasses.

Returns:
An Iterator of WebApplication objects for the deployed wars.

getConfig

public org.w3c.dom.Element getConfig()
An accessor for any configuration element set via setConfig. This method always returns null and must be overriden by subclasses to return a valid value.


setConfig

public void setConfig(org.w3c.dom.Element config)
This method is invoked to import an arbitrary XML configuration tree. Subclasses should override this method if they support such a configuration capability. This implementation does nothing.


getClassLoaderURLs

public static java.net.URL[] getClassLoaderURLs(java.lang.ClassLoader cl)
Use reflection to access a URL[] getURLs method so that non-URLClassLoader class loaders that support this method can provide info.


getCompileClasspath

public java.lang.String[] getCompileClasspath(java.lang.ClassLoader loader)
A utility method that walks up the ClassLoader chain starting at the given loader and queries each ClassLoader for a 'URL[] getURLs()' method from which a complete classpath of URL strings is built.


processNestedDeployments

protected void processNestedDeployments(DeploymentInfo (src)  di)
                                 throws DeploymentException (src) 
WARs do not have nested deployments

Overrides:
processNestedDeployments in class SubDeployerSupport (src)
Parameters:
di -
Throws:
DeploymentException (src)

startService

protected void startService()
                     throws java.lang.Exception
Description copied from class: SubDeployerSupport (src)
Performs SubDeployer registration.

Overrides:
startService in class SubDeployerSupport (src)
Throws:
java.lang.Exception

parseMetaData

protected void parseMetaData(java.lang.String ctxPath,
                             java.net.URL warURL,
                             java.lang.String warName,
                             WebMetaData (src)  metaData)
                      throws DeploymentException (src) 
This method creates a context-root string from either the WEB-INF/jboss-web.xml context-root element is one exists, or the filename portion of the warURL. It is called if the DeploymentInfo webContext value is null which indicates a standalone war deployment. A war name of ROOT.war is handled as a special case of a war that should be installed as the default web context.

Throws:
DeploymentException (src)