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

📄 webspheredeploymenttool.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.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.util.Enumeration;import java.util.Hashtable;import java.util.Iterator;import java.util.jar.JarEntry;import java.util.jar.JarFile;import java.util.jar.JarOutputStream;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;/** * Websphere deployment tool that augments the ejbjar task. * Searches for the websphere specific deployment descriptors and * adds them to the final ejb jar file. Websphere has two specific descriptors for session * beans: * <ul> *    <li>ibm-ejb-jar-bnd.xmi</li> *    <li>ibm-ejb-jar-ext.xmi</li> * </ul> * and another two for container managed entity beans: * <ul> *    <li>Map.mapxmi</li> *    <li>Schema.dbxmi</li> * </ul> * In terms of WebSphere, the generation of container code and stubs is * called <code>deployment</code>. This step can be performed by the websphere * element as part of the jar generation process. If the switch * <code>ejbdeploy</code> is on, the ejbdeploy tool from the websphere toolset * is called for every ejb-jar. Unfortunately, this step only works, if you * use the ibm jdk. Otherwise, the rmic (called by ejbdeploy) throws a * ClassFormatError. Be sure to switch ejbdeploy off, if run ant with * sun jdk. * */public class WebsphereDeploymentTool extends GenericDeploymentTool {    /** ID for ejb 1.1 */    public static final String PUBLICID_EJB11         = "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN";    /** ID for ejb 2.0 */    public static final String PUBLICID_EJB20         = "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN";    /** Schema directory */    protected static final String SCHEMA_DIR = "Schema/";    protected static final String WAS_EXT = "ibm-ejb-jar-ext.xmi";    protected static final String WAS_BND = "ibm-ejb-jar-bnd.xmi";    protected static final String WAS_CMP_MAP = "Map.mapxmi";    protected static final String WAS_CMP_SCHEMA = "Schema.dbxmi";    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();    /** Instance variable that stores the suffix for the websphere jarfile. */    private String jarSuffix = ".jar";    /** 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 keepGeneric = false;    private boolean alwaysRebuild = true;    private boolean ejbdeploy = true;    /** Indicates if the old CMP location convention is to be used. */    private boolean newCMP = false;    /** The classpath to the websphere classes. */    private Path wasClasspath = null;    /** The DB Vendor name, the EJB is persisted against */    private String dbVendor;    /** The name of the database to create. (For top-down mapping only) */    private String dbName;    /** The name of the schema to create. (For top-down mappings only) */    private String dbSchema;    /** true - Only generate the deployment code, do not run RMIC or Javac */    private boolean codegen;    /** true - Only output error messages, suppress informational messages */    private boolean quiet = true;    /** true - Disable the validation steps */    private boolean novalidate;    /** true - Disable warning and informational messages */    private boolean nowarn;    /** true - Disable informational messages */    private boolean noinform;    /** true - Enable internal tracing */    private boolean trace;    /** Additional options for RMIC */    private String rmicOptions;    /** true- Use the WebSphere 3.5 compatible mapping rules */    private boolean use35MappingRules;    /** the scratchdir for the ejbdeploy operation */    private String tempdir = "_ejbdeploy_temp";    /** the home directory for websphere */    private File websphereHome;    /**     * Get the classpath to the websphere classpaths.     * @return the websphere classpath.     */    public Path createWASClasspath() {        if (wasClasspath == null) {            wasClasspath = new Path(getTask().getProject());        }        return wasClasspath.createPath();    }    /**     * Set the websphere classpath.     * @param wasClasspath the websphere classpath.     */    public void setWASClasspath(Path wasClasspath) {        this.wasClasspath = wasClasspath;    }    /** Sets the DB Vendor for the Entity Bean mapping ; optional.     * <p>     * Valid options can be obtained by running the following command:     * <code>     * &lt;WAS_HOME&gt;/bin/EJBDeploy.[sh/bat] -help     * </code>     * </p>     * <p>     * This is also used to determine the name of the Map.mapxmi and     * Schema.dbxmi files, for example Account-DB2UDB_V81-Map.mapxmi     * and Account-DB2UDB_V81-Schema.dbxmi.     * </p>     *     * @param dbvendor database vendor type     */    public void setDbvendor(String dbvendor) {        this.dbVendor = dbvendor;    }    /**     * Sets the name of the Database to create; optional.     *     * @param dbName name of the database     */    public void setDbname(String dbName) {        this.dbName = dbName;    }    /**     * Sets the name of the schema to create; optional.     *     * @param dbSchema name of the schema     */    public void setDbschema(String dbSchema) {        this.dbSchema = dbSchema;    }    /**     * Flag, default false, to only generate the deployment     * code, do not run RMIC or Javac     *     * @param codegen option     */    public void setCodegen(boolean codegen) {        this.codegen = codegen;    }    /**     * Flag, default true, to only output error messages.     *     * @param quiet option     */    public void setQuiet(boolean quiet) {        this.quiet = quiet;    }    /**     * Flag to disable the validation steps; optional, default false.     *     * @param novalidate option     */    public void setNovalidate(boolean novalidate) {        this.novalidate = novalidate;    }    /**     * Flag to disable warning and informational messages; optional, default false.     *     * @param nowarn option     */    public void setNowarn(boolean nowarn) {        this.nowarn = nowarn;    }    /**     * Flag to disable informational messages; optional, default false.     *     * @param noinform if true disables informational messages     */    public void setNoinform(boolean noinform) {        this.noinform = noinform;    }    /**     * Flag to enable internal tracing when set, optional, default false.     *     * @param trace a <code>boolean</code> vaule.     */    public void setTrace(boolean trace) {        this.trace = trace;    }    /**     * Set the rmic options.     *     * @param options the options to use.     */    public void setRmicoptions(String options) {        this.rmicOptions = options;    }    /**     * Flag to use the WebSphere 3.5 compatible mapping rules ; optional, default false.     *     * @param attr a <code>boolean</code> value.     */    public void setUse35(boolean attr) {        use35MappingRules = attr;    }    /**     * Set the rebuild flag to false to only update changes in the jar rather     * than rerunning ejbdeploy; optional, default true.     * @param rebuild a <code>boolean</code> value.     */    public void setRebuild(boolean rebuild) {        this.alwaysRebuild = rebuild;    }    /**     * String value appended to the basename of the deployment     * descriptor to create the filename of the WebLogic EJB     * jar file. Optional, default '.jar'.     * @param inString the string to use as the suffix.     */    public void setSuffix(String inString) {        this.jarSuffix = inString;    }

⌨️ 快捷键说明

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