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

📄 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 页
字号:
    /**     * This controls whether the generic file used as input to     * ejbdeploy is retained; optional, default false.     * @param inValue either 'true' or 'false'.     */    public void setKeepgeneric(boolean inValue) {        this.keepGeneric = inValue;    }    /**     * Decide, wether ejbdeploy should be called or not;     * optional, default true.     *     * @param ejbdeploy a <code>boolean</code> value.     */    public void setEjbdeploy(boolean ejbdeploy) {        this.ejbdeploy = ejbdeploy;    }    /**     * Setter used to store the location of the Sun's Generic EJB DTD. This     * can be a file on the system or a resource on the classpath.     *     * @param inString the string to use as the DTD location.     */    public void setEJBdtd(String inString) {        this.ejb11DTD = inString;    }    /**     * Set the value of the oldCMP scheme. This is an antonym for newCMP     * @ant.attribute ignore="true"     * @param oldCMP a <code>boolean</code> value.     */    public void setOldCMP(boolean oldCMP) {        this.newCMP = !oldCMP;    }    /**     * Set the value of the newCMP scheme. The old CMP scheme locates the     * websphere CMP descriptor based on the naming convention where the     * websphere CMP file is expected to be named with the bean name as the     * prefix. Under this scheme the name of the CMP descriptor does not match     * the name actually used in the main websphere EJB descriptor. Also,     * descriptors which contain multiple CMP references could not be used.     * @param newCMP a <code>boolean</code> value.     */    public void setNewCMP(boolean newCMP) {        this.newCMP = newCMP;    }    /**     * The directory, where ejbdeploy will write temporary files;     * optional, defaults to '_ejbdeploy_temp'.     * @param tempdir the directory name to use.     */    public void setTempdir(String tempdir) {        this.tempdir = tempdir;    }    /** {@inheritDoc}. */    protected DescriptorHandler getDescriptorHandler(File srcDir) {        DescriptorHandler handler = new DescriptorHandler(getTask(), srcDir);        // register all the DTDs, both the ones that are known and        // any supplied by the user        handler.registerDTD(PUBLICID_EJB11, ejb11DTD);        for (Iterator i = getConfig().dtdLocations.iterator(); i.hasNext();) {            EjbJar.DTDLocation dtdLocation = (EjbJar.DTDLocation) i.next();            handler.registerDTD(dtdLocation.getPublicId(), dtdLocation.getLocation());        }        return handler;    }    /**     * Get a description handler.     * @param srcDir the source directory.     * @return the handler.     */    protected DescriptorHandler getWebsphereDescriptorHandler(final File srcDir) {        DescriptorHandler handler =            new DescriptorHandler(getTask(), srcDir) {                protected void processElement() {                }            };        for (Iterator i = getConfig().dtdLocations.iterator(); i.hasNext();) {            EjbJar.DTDLocation dtdLocation = (EjbJar.DTDLocation) i.next();            handler.registerDTD(dtdLocation.getPublicId(), dtdLocation.getLocation());        }        return handler;    }    /**     * Add any vendor specific files which should be included in the EJB Jar.     * @param ejbFiles a hashtable entryname -> file.     * @param baseName a prefix to use.     */    protected void addVendorFiles(Hashtable ejbFiles, String baseName) {        String ddPrefix = (usingBaseJarName() ? "" : baseName);        String dbPrefix = (dbVendor == null) ? "" : dbVendor + "-";        // Get the Extensions document        File websphereEXT = new File(getConfig().descriptorDir, ddPrefix + WAS_EXT);        if (websphereEXT.exists()) {            ejbFiles.put(META_DIR + WAS_EXT,                websphereEXT);        } else {            log("Unable to locate websphere extensions. "                + "It was expected to be in "                + websphereEXT.getPath(), Project.MSG_VERBOSE);        }        File websphereBND = new File(getConfig().descriptorDir, ddPrefix + WAS_BND);        if (websphereBND.exists()) {            ejbFiles.put(META_DIR + WAS_BND,                websphereBND);        } else {            log("Unable to locate websphere bindings. "                + "It was expected to be in "                + websphereBND.getPath(), Project.MSG_VERBOSE);        }        if (!newCMP) {            log("The old method for locating CMP files has been DEPRECATED.",                Project.MSG_VERBOSE);            log("Please adjust your websphere descriptor and set "                + "newCMP=\"true\" to use the new CMP descriptor "                + "inclusion mechanism. ", Project.MSG_VERBOSE);        } else {            // We attempt to put in the MAP and Schema files of CMP beans            try {                // Add the Map file                File websphereMAP = new File(getConfig().descriptorDir,                    ddPrefix + dbPrefix + WAS_CMP_MAP);                if (websphereMAP.exists()) {                    ejbFiles.put(META_DIR + WAS_CMP_MAP,                        websphereMAP);                } else {                    log("Unable to locate the websphere Map: "                        + websphereMAP.getPath(), Project.MSG_VERBOSE);                }                File websphereSchema = new File(getConfig().descriptorDir,                    ddPrefix + dbPrefix + WAS_CMP_SCHEMA);                if (websphereSchema.exists()) {                    ejbFiles.put(META_DIR + SCHEMA_DIR + WAS_CMP_SCHEMA,                        websphereSchema);                } else {                    log("Unable to locate the websphere Schema: "                        + websphereSchema.getPath(), Project.MSG_VERBOSE);                }                // Theres nothing else to see here...keep moving sonny            } catch (Exception e) {                String msg = "Exception while adding Vendor specific files: "                    + e.toString();                throw new BuildException(msg, e);            }        }    }    /**     * Get the vendor specific name of the Jar that will be output. The     * modification date of this jar will be checked against the dependent     * bean classes.     */    File getVendorOutputJarFile(String baseName) {        return new File(getDestDir(), baseName + jarSuffix);    }    /**     * Gets the options for the EJB Deploy operation     *     * @return String     */    protected String getOptions() {        // Set the options        StringBuffer options = new StringBuffer();        if (dbVendor != null) {            options.append(" -dbvendor ").append(dbVendor);        }        if (dbName != null) {            options.append(" -dbname \"").append(dbName).append("\"");        }        if (dbSchema != null) {            options.append(" -dbschema \"").append(dbSchema).append("\"");        }        if (codegen) {            options.append(" -codegen");        }        if (quiet) {            options.append(" -quiet");        }        if (novalidate) {            options.append(" -novalidate");        }        if (nowarn) {            options.append(" -nowarn");        }        if (noinform) {            options.append(" -noinform");        }        if (trace) {            options.append(" -trace");        }        if (use35MappingRules) {            options.append(" -35");        }        if (rmicOptions != null) {            options.append(" -rmic \"").append(rmicOptions).append("\"");        }        return options.toString();    }    /**     * Helper method invoked by execute() for each websphere jar to be built.     * Encapsulates the logic of constructing a java task for calling     * websphere.ejbdeploy and executing it.     *     * @param sourceJar java.io.File representing the source (EJB1.1) jarfile.     * @param destJar java.io.File representing the destination, websphere     *      jarfile.     */    private void buildWebsphereJar(File sourceJar, File destJar) {        try {            if (ejbdeploy) {                Java javaTask = new Java(getTask());                // Set the JvmArgs                javaTask.createJvmarg().setValue("-Xms64m");                javaTask.createJvmarg().setValue("-Xmx128m");                // Set the Environment variable                Environment.Variable var = new Environment.Variable();                var.setKey("websphere.lib.dir");                File libdir = new File(websphereHome, "lib");                var.setValue(libdir.getAbsolutePath());                javaTask.addSysproperty(var);                // Set the working directory                javaTask.setDir(websphereHome);                // Set the Java class name                javaTask.setTaskName("ejbdeploy");                javaTask.setClassname("com.ibm.etools.ejbdeploy.EJBDeploy");                javaTask.createArg().setValue(sourceJar.getPath());                javaTask.createArg().setValue(tempdir);                javaTask.createArg().setValue(destJar.getPath());                javaTask.createArg().setLine(getOptions());                if (getCombinedClasspath() != null                    && getCombinedClasspath().toString().length() > 0) {                    javaTask.createArg().setValue("-cp");                    javaTask.createArg().setValue(getCombinedClasspath().toString());                }                Path classpath = wasClasspath;                if (classpath == null) {                    classpath = getCombinedClasspath();                }                if (classpath != null) {                    javaTask.setClasspath(classpath);                    javaTask.setFork(true);                } else {                    javaTask.setFork(true);

⌨️ 快捷键说明

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