⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 weblogicdeploymenttool.java

📁 Use the links below to download a source distribution of Ant from one of our mirrors. It is good pra
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/* *  Licensed to the Apache Software Foundation (ASF) under one or more *  contributor license agreements.  See the NOTICE file distributed with *  this work for additional information regarding copyright ownership. *  The ASF licenses this file to You under the Apache License, Version 2.0 *  (the "License"); you may not use this file except in compliance with *  the License.  You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 * *  Unless required by applicable law or agreed to in writing, software *  distributed under the License is distributed on an "AS IS" BASIS, *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *  See the License for the specific language governing permissions and *  limitations under the License. * */package org.apache.tools.ant.taskdefs.optional.ejb;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.util.Enumeration;import java.util.Hashtable;import java.util.Iterator;import java.util.Vector;import java.util.jar.JarEntry;import java.util.jar.JarFile;import java.util.jar.JarOutputStream;import javax.xml.parsers.SAXParser;import javax.xml.parsers.SAXParserFactory;import org.apache.tools.ant.AntClassLoader;import org.apache.tools.ant.BuildException;import org.apache.tools.ant.Project;import org.apache.tools.ant.taskdefs.Java;import org.apache.tools.ant.types.Environment;import org.apache.tools.ant.types.Path;import org.apache.tools.ant.util.FileUtils;import org.xml.sax.InputSource;/**    The weblogic element is used to control the weblogic.ejbc compiler for    generating weblogic EJB jars. Prior to Ant 1.3, the method of locating CMP    descriptors was to use the ejbjar naming convention. So if your ejb-jar was    called, Customer-ejb-jar.xml, your weblogic descriptor was called Customer-    weblogic-ejb-jar.xml and your CMP descriptor had to be Customer-weblogic-cmp-    rdbms-jar.xml. In addition, the &lt;type-storage&gt; element in the weblogic    descriptor had to be set to the standard name META-INF/weblogic-cmp-rdbms-    jar.xml, as that is where the CMP descriptor was mapped to in the generated    jar.*/public class WeblogicDeploymentTool extends GenericDeploymentTool {    /** EJB11 id */    public static final String PUBLICID_EJB11         = "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN";    /** EJB20 id */    public static final String PUBLICID_EJB20         = "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN";    /** Weblogic 5.1.0 id */    public static final String PUBLICID_WEBLOGIC_EJB510         = "-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN";    /** Weblogic 6.0.0 id */    public static final String PUBLICID_WEBLOGIC_EJB600         = "-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN";    /** Weblogic 7.0.0 id */    public static final String PUBLICID_WEBLOGIC_EJB700         = "-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB//EN";    /** Weblogic 5.1 dtd location */    protected static final String DEFAULT_WL51_EJB11_DTD_LOCATION         = "/weblogic/ejb/deployment/xml/ejb-jar.dtd";    /** Weblogic 6.0 ejb 1.1 dtd location */    protected static final String DEFAULT_WL60_EJB11_DTD_LOCATION         = "/weblogic/ejb20/dd/xml/ejb11-jar.dtd";    /** Weblogic 6.0 ejb 2.0 dtd location */    protected static final String DEFAULT_WL60_EJB20_DTD_LOCATION         = "/weblogic/ejb20/dd/xml/ejb20-jar.dtd";    protected static final String DEFAULT_WL51_DTD_LOCATION         = "/weblogic/ejb/deployment/xml/weblogic-ejb-jar.dtd";    protected static final String DEFAULT_WL60_51_DTD_LOCATION         = "/weblogic/ejb20/dd/xml/weblogic510-ejb-jar.dtd";    protected static final String DEFAULT_WL60_DTD_LOCATION         = "/weblogic/ejb20/dd/xml/weblogic600-ejb-jar.dtd";    protected static final String DEFAULT_WL70_DTD_LOCATION         = "/weblogic/ejb20/dd/xml/weblogic700-ejb-jar.dtd";    protected static final String DEFAULT_COMPILER = "default";    protected static final String WL_DD = "weblogic-ejb-jar.xml";    protected static final String WL_CMP_DD = "weblogic-cmp-rdbms-jar.xml";    protected static final String COMPILER_EJB11 = "weblogic.ejbc";    protected static final String COMPILER_EJB20 = "weblogic.ejbc20";    /** File utilities instance for copying jars */    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();    /** Instance variable that stores the suffix for the weblogic jarfile. */    private String jarSuffix = ".jar";    /** Instance variable that stores the location of the weblogic DTD file. */    private String weblogicDTD;    /** Instance variable that stores the location of the ejb 1.1 DTD file. */    private String ejb11DTD;    /** Instance variable that determines whether generic ejb jars are kept. */    private boolean keepgenerated = false;    /**     * Instance variable that stores the fully qualified classname of the     * weblogic EJBC compiler     */    private String ejbcClass = null;    private String additionalArgs = "";    /**     * additional args to pass to the spawned jvm     */    private String additionalJvmArgs = "";    private boolean keepGeneric = false;    private String compiler = null;    private boolean alwaysRebuild = true;    /** controls whether ejbc is run on the generated jar */    private boolean noEJBC = false;    /** Indicates if the old CMP location convention is to be used.  */    private boolean newCMP = false;    /** The classpath to the weblogic classes. */    private Path wlClasspath = null;    /** System properties for the JVM. */    private Vector sysprops = new Vector();    /**     * The weblogic.StdoutSeverityLevel to use when running the JVM that     * executes ejbc. Set to 16 to avoid the warnings about EJB Home and     * Remotes being in the classpath     */    private Integer jvmDebugLevel = null;    private File outputDir;    /**     * Add a nested sysproperty element.     * @param sysp the element to add.     */    public void addSysproperty(Environment.Variable sysp) {        sysprops.add(sysp);    }    /**     * Get the classpath to the weblogic classpaths.     * @return the classpath to configure.     */    public Path createWLClasspath() {        if (wlClasspath == null) {            wlClasspath = new Path(getTask().getProject());        }        return wlClasspath.createPath();    }    /**     * If set ejbc will use this directory as the output     * destination rather than a jar file. This allows for the     * generation of &quot;exploded&quot; jars.     * @param outputDir the directory to be used.     */    public void setOutputDir(File outputDir) {        this.outputDir = outputDir;    }    /**     * Optional classpath to WL6.0.     * Weblogic 6.0 will give a warning if the home and remote interfaces     * of a bean are on the system classpath used to run weblogic.ejbc.     * In that case, the standard weblogic classes should be set with     * this attribute (or equivalent nested element) and the     * home and remote interfaces located with the standard classpath     * attribute.     * @param wlClasspath the path to be used.     */    public void setWLClasspath(Path wlClasspath) {        this.wlClasspath = wlClasspath;    }    /**     * The compiler (switch <code>-compiler</code>) to use; optional.     * This allows for the selection of a different compiler     * to be used for the compilation of the generated Java     * files. This could be set, for example, to Jikes to     * compile with the Jikes compiler. If this is not set     * and the <code>build.compiler</code> property is set     * to jikes, the Jikes compiler will be used. If this     * is not desired, the value &quot;<code>default</code>&quot;     * may be given to use the default compiler.     * @param compiler the compiler to be used.     */    public void setCompiler(String compiler) {        this.compiler = compiler;    }    /**     * Set the rebuild flag to false to only update changes in the jar rather     * than rerunning ejbc; optional, default true.     * This flag controls whether weblogic.ejbc is always     * invoked to build the jar file. In certain circumstances,     * such as when only a bean class has been changed, the jar     * can be generated by merely replacing the changed classes     * and not rerunning ejbc. Setting this to false will reduce     * the time to run ejbjar.     * @param rebuild a <code>boolean</code> value.     */    public void setRebuild(boolean rebuild) {        this.alwaysRebuild = rebuild;    }    /**     * Sets the weblogic.StdoutSeverityLevel to use when running the JVM that     * executes ejbc; optional. Set to 16 to avoid the warnings about EJB Home and     * Remotes being in the classpath     * @param jvmDebugLevel the value to use.     */    public void setJvmDebugLevel(Integer jvmDebugLevel) {        this.jvmDebugLevel = jvmDebugLevel;    }    /**     * Get the debug level.     * @return the jvm debug level (may be null).     */    public Integer getJvmDebugLevel() {        return jvmDebugLevel;    }    /**     * Setter used to store the suffix for the generated weblogic jar file.     *     * @param inString the string to use as the suffix.     */    public void setSuffix(String inString) {        this.jarSuffix = inString;    }    /**     * controls whether the generic file used as input to     * ejbc is retained; defaults to false     *     * @param inValue true for keep generic     */    public void setKeepgeneric(boolean inValue) {        this.keepGeneric = inValue;    }    /**     * Controls whether weblogic will keep the generated Java     * files used to build the class files added to the     * jar. This can be useful when debugging; default is false.     *     * @param inValue either 'true' or 'false'     */    public void setKeepgenerated(String inValue) {        this.keepgenerated = Boolean.valueOf(inValue).booleanValue();    }    /**     * Any optional extra arguments pass to the weblogic.ejbc     * tool.     * @param args extra arguments to pass to the ejbc tool.     */    public void setArgs(String args) {        this.additionalArgs = args;    }    /**     * Set any additional arguments to pass to the weblogic JVM; optional.     * @param args the arguments to be passed to the JVM     */    public void setJvmargs(String args) {        this.additionalJvmArgs = args;    }    /**     * Set the classname of the ejbc compiler;  optional     * Normally ejbjar determines     * the appropriate class based on the DTD used for the EJB. The EJB 2.0 compiler     * featured in weblogic 6 has, however, been deprecated in version 7. When     * using with version 7 this attribute should be set to     * &quot;weblogic.ejbc&quot; to avoid the deprecation warning.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -