Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   *
   * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.
   *
   * The contents of this file are subject to the terms of either the GNU
   * General Public License Version 2 only ("GPL") or the Common Development
   * and Distribution License("CDDL") (collectively, the "License").  You
   * may not use this file except in compliance with the License.  You can
  * obtain a copy of the License at
  * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
  * or packager/legal/LICENSE.txt.  See the License for the specific
  * language governing permissions and limitations under the License.
  *
  * When distributing the software, include this License Header Notice in each
  * file and include the License file at packager/legal/LICENSE.txt.
  *
  * GPL Classpath Exception:
  * Oracle designates this particular file as subject to the "Classpath"
  * exception as provided by Oracle in the GPL Version 2 section of the License
  * file that accompanied this code.
  *
  * Modifications:
  * If applicable, add the following below the License Header, with the fields
  * enclosed by brackets [] replaced by your own identifying information:
  * "Portions Copyright [year] [name of copyright owner]"
  *
  * Contributor(s):
  * If you wish your version of this file to be governed by only the CDDL or
  * only the GPL Version 2, indicate your decision by adding "[Contributor]
  * elects to include this software in this distribution under the [CDDL or GPL
  * Version 2] license."  If you don't indicate a single choice of license, a
  * recipient has the option to distribute your version of this file under
  * either the CDDL, the GPL Version 2 or to extend the choice of license to
  * its licensees as provided above.  However, if you add GPL Version 2 code
  * and therefore, elected the GPL Version 2 license, then the option applies
  * only if the new code is made subject to such option by the copyright
  * holder.
  */
 
 package com.sun.enterprise.web;
 
 
 import java.io.File;

Represents the configuration parameters required in order to create and install a web module (web application) into the server runtime.
 
 public class WebModuleConfig {
 
     // ----------------------------------------------------- Instance Variables
 
    
The config bean containing the properties specified in the web-module element in server.xml.
 
     private Application _wmBean = null;

    
The parent directory under which the work directory for files generated by the web application (i.e compiled JSP class files etc) resides.
 
     private String _baseDir = null;

    
The work directory
 
     private String workDir = null;
            
    
The directory under which the work directory for files generated by the web application (i.e compiled JSP class files etc) resides.
 
     private String _workDir = null;
    
    
The source directory for the web application
 
     private File _dir = null;
    
    
The objectType property
 
     private String _objectType = null;
    
    
The parent classloader for the web application.
 
     private ClassLoader _parentLoader = null;

    
Deployment descriptor information about the web application.
 
    private WebBundleDescriptorImpl _wbd = null;

    
keep a list of virtual servers that this webmodule is associated with
    private String _vsIDs;
    // START S1AS 6178005
    private String stubBaseDir;
    // END S1AS 6178005
    private ClassLoader _appClassLoader = null;
    // ------------------------------------------------------------- Properties
    public ClassLoader getAppClassLoader() {
        return ;
    }
    public void setAppClassLoader(ClassLoader _appClassLoader) {
        this. = _appClassLoader;
    }
    
    
Set the elements of information specified in the web-module element in server.xml.
    public void setBean(Application wmBean) {
         = wmBean;
    }


    
Return the configuration information specified in server.xml.
    public Application getBean() {
        return ;
    }

    
Return the name of the web application (as specified in server.xml)

Returns:
[$appID:]$moduleID
    public String getName() {
        String name = null;
        if ( != null) {
            name = .getModuleID();
        }
        return name;
    }

    
Return the context path at which the web application is deployed.
    public String getContextPath() {
        String ctxPath = null;
        if ( != null) {
                ctxPath = .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;
    }
    
    
Set the directory in which the web application is deployed.
    public void setLocation(File sourceDir) {
         = sourceDir;
    }

    
Return the directory in which the web application is deployed.
    public File getLocation() {
        return ;
    }

    
Return the list of virtual servers to which the web application is deployed.
    public String getVirtualServers() {
        return ;
    }

    
Return the list of virtual servers to which the web application is deployed.
    public void setVirtualServers(String virtualServers) {
         = virtualServers;
    }
    
    
Set the parent classloader for the web application.
    public void setParentLoader(ClassLoader parentLoader) {
         = parentLoader;
    }

    
Return the parent classloader for the web application.
    public ClassLoader getParentLoader() {
        return ;
    }

    
Sets the deployment context for this web application.
    public void setDeploymentContext(DeploymentContext deploymentContext) {
        synchronized (this) {
            this. = deploymentContext;
        }
    }

    
Gets the deployment context of this web application.
        synchronized (this) {
            return ;
        }
    }

    
Sets the work directory for this web application.
    public synchronized void setWorkDir(String workDir) {
        this. = workDir;
    }

    
Gets the work directory for this web application. The work directory is either generated/jsp/$appID/$moduleID or generated/jsp/$moduleID
    public synchronized String getWorkDir() {
        if ( == null) {
            if ( != null &&
                    .getScratchDir(
                        "jsp") != null) {
                 = .getScratchDir("jsp").getPath();
            } else {
                 = getWebDir();
            }
        }
        return ;
    }
    // START S1AS 6178005
    
Gets the stub path of this web application.

Returns:
Stub path of this web application
    public String getStubPath() {
        return getWebDir();
    }
    // END S1AS 6178005
    
    
Sets the parent of the work directory for this web application. The actual work directory is a subdirectory named after the web application.

Parameters:
baseDir The new base directory under which the actual work directory will be created
    public void setWorkDirBase(String baseDir) {
        synchronized (this) {
             = baseDir;
        }
    }
    // START S1AS 6178005
    
Sets the base directory of this web application's stub path.

Parameters:
stubBaseDir Stub path
    public void setStubBaseDir(String stubBaseDir) {
        this. = stubBaseDir;
    }
    // END S1AS 6178005

    
Return the object representation of the deployment descriptor specified for the web application.
        return ;
    }

    
Set the deployment descriptor object describing the contents of the web application.

Parameters:
wbd The deployment descriptor object
    public void setDescriptor(WebBundleDescriptorImpl wbd) {
         = wbd;
    }
        
    
Return the objectType property
    public String getObjectType() {
        return ;
    }

    
Set the objectType property.

Parameters:
objectType objectType property
    public void setObjectType(String objectType) {
         = objectType;
    }
        
    /*
     * Appends this web module's id to the given base directory path, and
     * returns it.
     *
     * @param baseDir Base directory path
     */
    private String getWebDir(String baseDir) {
        if (baseDir == null) {
            return null;
        }
        StringBuilder dir = new StringBuilder(baseDir);
        dir.append(.);
        if (app != null && !app.isVirtual()) {
            dir.append(FileUtils.makeFriendlyFilename(
                app.getRegistrationName()));
            dir.append(.);
            dir.append(FileUtils.makeFriendlyFilename(
                .getModuleDescriptor().getArchiveUri()));
        } else {
            dir.append(FileUtils.makeLegalNoBlankFileName(
                .getModuleID()));
        }
        return dir.toString();
    }
New to GrepCode? Check out our FAQ X