📄 iplanetdeploymenttool.java
字号:
/* * 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.IOException;import java.util.Hashtable;import javax.xml.parsers.SAXParser;import org.apache.tools.ant.BuildException;import org.apache.tools.ant.Project;import org.xml.sax.SAXException;/** * This class is used to generate iPlanet Application Server (iAS) 6.0 stubs and * skeletons and build an EJB Jar file. It is designed to be used with the Ant * <code>ejbjar</code> task. If only stubs and skeletons need to be generated * (in other words, if no JAR file needs to be created), refer to the * <code>iplanet-ejbc</code> task and the <code>IPlanetEjbcTask</code> class. * <p> * The following attributes may be specified by the user: * <ul> * <li><i>destdir</i> -- The base directory into which the generated JAR * files will be written. Each JAR file is written * in directories which correspond to their location * within the "descriptordir" namespace. This is a * required attribute. * <li><i>classpath</i> -- The classpath used when generating EJB stubs and * skeletons. This is an optional attribute (if * omitted, the classpath specified in the "ejbjar" * parent task will be used). If specified, the * classpath elements will be prepended to the * classpath specified in the parent "ejbjar" task. * Note that nested "classpath" elements may also be * used. * <li><i>keepgenerated</i> -- Indicates whether or not the Java source * files which are generated by ejbc will be * saved or automatically deleted. If "yes", * the source files will be retained. This is * an optional attribute (if omitted, it * defaults to "no"). * <li><i>debug</i> -- Indicates whether or not the ejbc utility should * log additional debugging statements to the standard * output. If "yes", the additional debugging statements * will be generated (if omitted, it defaults to "no"). * <li><i>iashome</i> -- May be used to specify the "home" directory for * this iPlanet Application server installation. This * is used to find the ejbc utility if it isn't * included in the user's system path. This is an * optional attribute (if specified, it should refer * to the <code>[install-location]/iplanet/ias6/ias * </code> directory). If omitted, the ejbc utility * must be on the user's system path. * <li><i>suffix</i> -- String value appended to the JAR filename when * creating each JAR. This attribute is not required * (if omitted, it defaults to ".jar"). * </ul> * <p> * For each EJB descriptor found in the "ejbjar" parent task, this deployment * tool will locate the three classes that comprise the EJB. If these class * files cannot be located in the specified <code>srcdir</code> directory, the * task will fail. The task will also attempt to locate the EJB stubs and * skeletons in this directory. If found, the timestamps on the stubs and * skeletons will be checked to ensure they are up to date. Only if these files * cannot be found or if they are out of date will ejbc be called. * * @see IPlanetEjbc */public class IPlanetDeploymentTool extends GenericDeploymentTool { /* Attributes set by the Ant build file */ private File iashome; private String jarSuffix = ".jar"; private boolean keepgenerated = false; private boolean debug = false; /* * Filenames of the standard EJB descriptor (which is passed to this class * from the parent "ejbjar" task) and the iAS-specific EJB descriptor * (whose name is determined by this class). Both filenames are relative * to the directory specified by the "srcdir" attribute in the ejbjar task. */ private String descriptorName; private String iasDescriptorName; /* * The displayName variable stores the value of the "display-name" element * from the standard EJB descriptor. As a future enhancement to this task, * we may determine the name of the EJB JAR file using this display-name, * but this has not be implemented yet. */ private String displayName; /* * Regardless of the name of the iAS-specific EJB descriptor file, it will * written in the completed JAR file as "ias-ejb-jar.xml". This is the * naming convention implemented by iAS. */ private static final String IAS_DD = "ias-ejb-jar.xml"; /** * Setter method used to store the "home" directory of the user's iAS * installation. The directory specified should typically be * <code>[install-location]/iplanet/ias6/ias</code>. * * @param iashome The home directory for the user's iAS installation. */ public void setIashome(File iashome) { this.iashome = iashome; } /** * Setter method used to specify whether the Java source files generated by * the ejbc utility should be saved or automatically deleted. * * @param keepgenerated boolean which, if <code>true</code>, indicates that * Java source files generated by ejbc for the stubs * and skeletons should be kept. */ public void setKeepgenerated(boolean keepgenerated) { this.keepgenerated = keepgenerated; } /** * Sets whether or not debugging output will be generated when ejbc is * executed. * * @param debug A boolean indicating if debugging output should be generated */ public void setDebug(boolean debug) { this.debug = debug; } /** * Setter method used to specify the filename suffix (for example, ".jar") * for the JAR files to be created. * * @param jarSuffix The string to use as the JAR filename suffix. */ public void setSuffix(String jarSuffix) { this.jarSuffix = jarSuffix; } /** * Since iAS doesn't generate a "generic" JAR as part of its processing, * this attribute is ignored and a warning message is displayed to the user. * * @param inString the string to use as the suffix. This parameter is * ignored. */ public void setGenericJarSuffix(String inString) { log("Since a generic JAR file is not created during processing, the " + "iPlanet Deployment Tool does not support the " + "\"genericjarsuffix\" attribute. It will be ignored.", Project.MSG_WARN); } /** {@inheritDoc}. */ public void processDescriptor(String descriptorName, SAXParser saxParser) { this.descriptorName = descriptorName; this.iasDescriptorName = null; log("iPlanet Deployment Tool processing: " + descriptorName + " (and " + getIasDescriptorName() + ")", Project.MSG_VERBOSE); super.processDescriptor(descriptorName, saxParser); } /** * Verifies that the user selections are valid. * * @param descriptorFileName String representing the file name of an EJB * descriptor to be processed * @param saxParser SAXParser which may be used to parse the XML * descriptor * @throws BuildException If the user selections are invalid. */ protected void checkConfiguration(String descriptorFileName,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -