FileDocCategorySizeDatePackage
WebModuleConfig.javaAPI DocGlassfish v2 API10396Tue Jul 10 10:49:46 BST 2007com.sun.enterprise.web

WebModuleConfig

public class WebModuleConfig extends Object
Represents the configuration parameters required in order to create and install a web module (web application) in the iAS 7.0 server runtime.

Fields Summary
private com.sun.enterprise.config.serverbeans.WebModule
_wmBean
The config bean containing the properties specified in the web-module element in server.xml.
private String
_baseDir
The parent directory under which the work directory for files generated by the web application (i.e compiled JSP class files etc) resides.
private ClassLoader
_parentLoader
The parent classloader for the web application.
private com.sun.enterprise.deployment.WebBundleDescriptor
_wbd
Deployment descriptor information about the web application.
private String
_vsIDs
keep a list of virtual servers that this webmodule is associated with
private String
stubBaseDir
private static org.apache.catalina.util.StringManager
_sm
The string manager for this package.
Constructors Summary
Methods Summary
private java.lang.StringgetAppName()
Return the name of the application that this web module belongs to or null if this is a standalone web module.

        String name = null;
        if (_wbd != null) {
            Application app = _wbd.getApplication();
            if ((app != null) && !app.isVirtual()) {
                String appName = app.getRegistrationName();
                if ((appName != null) && (appName.length() > 0)) {
                    name = appName.trim();
                }
            }
        }
        return name;
    
public com.sun.enterprise.config.serverbeans.WebModulegetBean()
Return the configuration information specified in server.xml.

        return _wmBean;
    
public java.lang.StringgetContextPath()
Return the context path at which the web application is deployed.

        String ctxPath = null;
        if (_wmBean != null) {
                ctxPath = _wmBean.getContextRoot().trim();
                // Don't prefix a / if this web module is the default one
                // i.e. has an empty context-root
                if ((ctxPath.length() > 0) && !ctxPath.startsWith("/")) {
                    ctxPath = "/" + ctxPath;
                } else if (ctxPath.equals("/")) {
                    ctxPath = "";
                }
        }
        return ctxPath;
    
public com.sun.enterprise.deployment.WebBundleDescriptorgetDescriptor()
Return the object representation of the deployment descriptor specified for the web application.

        return _wbd;
    
public java.lang.StringgetLocation()
Return the directory in which the web application is deployed.

        String dir = null;
        if (_wmBean != null) {
            dir = _wmBean.getLocation();
        }
        return dir;
    
private java.lang.StringgetModuleName()
Return just the name of the web module.

        String name = null;
        if (_wmBean != null) {
            name = _wmBean.getName();
        }
        return name;
    
public java.lang.StringgetName()
Return the name of the web application (as specified in server.xml)

return
[$appID:]$moduleID

        String name = null;
        if (_wmBean != null) {
            StringBuffer buffer = new StringBuffer();
            String appName = getAppName();
            if (appName != null) {
                // Include the application id (if this is not a 
                // standalone web module)
                buffer.append(appName);
                buffer.append(Constants.NAME_SEPARATOR);
            }
            buffer.append(getModuleName());
            name = buffer.toString();
        }
        return name;
    
public java.lang.ClassLoadergetParentLoader()
Return the parent classloader for the web application.

        return _parentLoader;
    
public java.lang.StringgetStubPath()
Gets the stub path of this web application.

return
Stub path of this web application

        return getWebDir(stubBaseDir);
    
public java.lang.StringgetVirtualServers()
Return the list of virtual servers to which the web application is deployed.

        /*String vsIDs = null;
        if (_wmBean != null) {
            vsIDs = _wmBean.getVirtualServers();
        }
         */
        return _vsIDs;
    
private java.lang.StringgetWebDir(java.lang.String baseDir)


        String workDir = null;

        if (baseDir != null) {
            StringBuffer dir = new StringBuffer();
            dir.append(baseDir);

            // Append the application id (if this is not a standalone web
            // module)
            String appName = getAppName();
            if (appName != null) {
                dir.append(File.separator);
                dir.append(FileUtils.makeLegalNoBlankFileName(appName));
            }

            // Append the web module id
            String name = getModuleName();
            if (name != null) {
                dir.append(File.separator);
                if (appName == null) {
                    dir.append(FileUtils.makeLegalNoBlankFileName(name));
                } else {
                    // for embedded web module, we convert the 
                    // ".war" to "_war" when needed
                    dir.append(DeploymentUtils.getRelativeEmbeddedModulePath(
                        dir.toString(), name));
                }
            }
            workDir = dir.toString();
        }

        return workDir;
    
public java.lang.StringgetWorkDir()
Return the work directory for this web application. The work directory is either generated/j2ee-apps/$appID/$moduleID or generated/j2ee-modules/$moduleID

        return getWebDir(_baseDir);
    
public voidsetBean(com.sun.enterprise.config.serverbeans.WebModule wmBean)
Set the elements of information specified in the web-module element in server.xml.


    // ------------------------------------------------------------- Properties

                     
        
        _wmBean = wmBean;
    
public voidsetDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor wbd)
Set the deployment descriptor object describing the contents of the web application.

param
wbd The deployment descriptor object

        _wbd = wbd;
    
public voidsetParentLoader(java.lang.ClassLoader parentLoader)
Set the parent classloader for the web application.

        _parentLoader = parentLoader;
    
public voidsetStubBaseDir(java.lang.String stubBaseDir)
Sets the base directory of this web application's stub path.

param
stubPath Stub path

        this.stubBaseDir = stubBaseDir;
    
public voidsetVirtualServers(java.lang.String virtualServers)
Return the list of virtual servers to which the web application is deployed.

        _vsIDs = virtualServers;
    
public voidsetWorkDirBase(java.lang.String baseDir)
Set the base work directory for this web application. The actual work directory is a subdirectory (using the name of the web application) of this base directory.

param
baseDir The new base directory under which the actual work directory will be created

        _baseDir = baseDir;