Browse Source

checkstyle

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@475080 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
4b62dd0001
14 changed files with 148 additions and 46 deletions
  1. +13
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
  2. +12
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java
  3. +3
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java
  4. +7
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java
  5. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java
  6. +18
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
  7. +1
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java
  8. +23
    -18
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
  9. +14
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java
  10. +2
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java
  11. +21
    -12
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java
  12. +19
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
  13. +10
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java
  14. +4
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java

+ 13
- 0
src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java View File

@@ -200,6 +200,11 @@ public class BorlandDeploymentTool extends GenericDeploymentTool
} }




/**
* Get the borland descriptor handler.
* @param srcDir the source directory.
* @return the descriptor.
*/
protected DescriptorHandler getBorlandDescriptorHandler(final File srcDir) { protected DescriptorHandler getBorlandDescriptorHandler(final File srcDir) {
DescriptorHandler handler = DescriptorHandler handler =
new DescriptorHandler(getTask(), srcDir) { new DescriptorHandler(getTask(), srcDir) {
@@ -444,6 +449,11 @@ public class BorlandDeploymentTool extends GenericDeploymentTool
* Method used to encapsulate the writing of the JAR file. Iterates over the * Method used to encapsulate the writing of the JAR file. Iterates over the
* filenames/java.io.Files in the Hashtable stored on the instance variable * filenames/java.io.Files in the Hashtable stored on the instance variable
* ejbFiles. * ejbFiles.
* @param baseName the base name.
* @param jarFile the jar file to write to.
* @param files the files to write to the jar.
* @param publicId the id to use.
* @throws BuildException if there is an error.
*/ */
protected void writeJar(String baseName, File jarFile, Hashtable files, String publicId) protected void writeJar(String baseName, File jarFile, Hashtable files, String publicId)
throws BuildException { throws BuildException {
@@ -500,8 +510,11 @@ public class BorlandDeploymentTool extends GenericDeploymentTool


// implementation of org.apache.tools.ant.taskdefs.ExecuteStreamHandler interface // implementation of org.apache.tools.ant.taskdefs.ExecuteStreamHandler interface


/** {@inheritDoc}. */
public void start() throws IOException { } public void start() throws IOException { }
/** {@inheritDoc}. */
public void stop() { } public void stop() { }
/** {@inheritDoc}. */
public void setProcessInputStream(OutputStream param1) throws IOException { } public void setProcessInputStream(OutputStream param1) throws IOException { }


/** /**


+ 12
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java View File

@@ -40,6 +40,7 @@ import org.xml.sax.SAXException;
* list can then be accessed through the getFiles() method. * list can then be accessed through the getFiles() method.
*/ */
public class DescriptorHandler extends org.xml.sax.HandlerBase { public class DescriptorHandler extends org.xml.sax.HandlerBase {
private static final int DEFAULT_HASH_TABLE_SIZE = 10;
private static final int STATE_LOOKING_EJBJAR = 1; private static final int STATE_LOOKING_EJBJAR = 1;
private static final int STATE_IN_EJBJAR = 2; private static final int STATE_IN_EJBJAR = 2;
private static final int STATE_IN_BEANS = 3; private static final int STATE_IN_BEANS = 3;
@@ -171,7 +172,16 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase {


} }


/** @see org.xml.sax.EntityResolver#resolveEntity(String, String) */
/**
* Resolve the entity.
* @see org.xml.sax.EntityResolver#resolveEntity(String, String).
* @param publicId The public identifier, or <code>null</code>
* if none is available.
* @param systemId The system identifier provided in the XML
* document. Will not be <code>null</code>.
* @return an inputsource for this identifier
* @throws SAXException if there is a problem.
*/
public InputSource resolveEntity(String publicId, String systemId) public InputSource resolveEntity(String publicId, String systemId)
throws SAXException { throws SAXException {
this.publicId = publicId; this.publicId = publicId;
@@ -245,7 +255,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase {
* @throws SAXException on error * @throws SAXException on error
*/ */
public void startDocument() throws SAXException { public void startDocument() throws SAXException {
this.ejbFiles = new Hashtable(10, 1);
this.ejbFiles = new Hashtable(DEFAULT_HASH_TABLE_SIZE, 1);
this.currentElement = null; this.currentElement = null;
inEJBRef = false; inEJBRef = false;
} }


+ 3
- 0
src/main/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java View File

@@ -25,6 +25,9 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;




/**
* The interface to implement for deployment tools.
*/
public interface EJBDeploymentTool { public interface EJBDeploymentTool {
/** /**
* Process a deployment descriptor, generating the necessary vendor specific * Process a deployment descriptor, generating the necessary vendor specific


+ 7
- 0
src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java View File

@@ -62,7 +62,10 @@ public class Ejbc extends MatchingTask {
*/ */
private File sourceDirectory; private File sourceDirectory;


// CheckStyle:VisibilityModifier OFF - bc
/** Whether to keep the generated files */
public boolean keepgenerated; public boolean keepgenerated;
// CheckStyle:VisibilityModifier ON


/** /**
* Do the work. * Do the work.
@@ -124,6 +127,10 @@ public class Ejbc extends MatchingTask {
} }
} }


/**
* get the keep generated attribute.
* @return the attribute.
*/
public boolean getKeepgenerated() { public boolean getKeepgenerated() {
return keepgenerated; return keepgenerated;
} }


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java View File

@@ -35,7 +35,7 @@ import javax.ejb.deployment.EntityDescriptor;
* interface class files referenced in the deployment descriptors being processed. * interface class files referenced in the deployment descriptors being processed.
* *
*/ */
public class EjbcHelper {
public final class EjbcHelper {
/** /**
* The root directory of the tree containing the serialised deployment desciptors. * The root directory of the tree containing the serialised deployment desciptors.
*/ */


+ 18
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java View File

@@ -55,6 +55,11 @@ import org.xml.sax.SAXException;
* *
*/ */
public class GenericDeploymentTool implements EJBDeploymentTool { public class GenericDeploymentTool implements EJBDeploymentTool {
/** The default buffer byte size to use for IO */
public static final int DEFAULT_BUFFER_SIZE = 1024;
/** The level to use for compression */
public static final int JAR_COMPRESS_LEVEL = 9;

/** The standard META-INF directory in jar files */ /** The standard META-INF directory in jar files */
protected static final String META_DIR = "META-INF/"; protected static final String META_DIR = "META-INF/";


@@ -331,7 +336,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool {


// Create the file input stream, and buffer everything over // Create the file input stream, and buffer everything over
// to the jar output stream // to the jar output stream
byte[] byteBuffer = new byte[2 * 1024];
byte[] byteBuffer = new byte[2 * DEFAULT_BUFFER_SIZE];
int count = 0; int count = 0;
do { do {
jStream.write(byteBuffer, 0, count); jStream.write(byteBuffer, 0, count);
@@ -387,6 +392,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool {
// none to register for generic // none to register for generic
} }


/** {@inheritDoc}. */
public void processDescriptor(String descriptorFileName, SAXParser saxParser) { public void processDescriptor(String descriptorFileName, SAXParser saxParser) {


checkConfiguration(descriptorFileName, saxParser); checkConfiguration(descriptorFileName, saxParser);
@@ -484,7 +490,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool {
* descriptor to be processed * descriptor to be processed
* @param saxParser SAXParser which may be used to parse the XML * @param saxParser SAXParser which may be used to parse the XML
* descriptor * descriptor
* @exception BuildException Thrown if the configuration is invalid
* @throws BuildException if there is a problem.
*/ */
protected void checkConfiguration(String descriptorFileName, protected void checkConfiguration(String descriptorFileName,
SAXParser saxParser) throws BuildException { SAXParser saxParser) throws BuildException {
@@ -628,6 +634,9 @@ public class GenericDeploymentTool implements EJBDeploymentTool {
* *
* This will contain the path and the start of the descriptor name, * This will contain the path and the start of the descriptor name,
* depending on the naming scheme * depending on the naming scheme
* @param baseName the base name to use.
* @param descriptorFileName the file name to use.
* @return the prefix.
*/ */
public String getVendorDDPrefix(String baseName, String descriptorFileName) { public String getVendorDDPrefix(String baseName, String descriptorFileName) {
String ddPrefix = null; String ddPrefix = null;
@@ -662,6 +671,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool {
/** /**
* Get the vendor specific name of the Jar that will be output. The modification date * 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. * of this jar will be checked against the dependent bean classes.
* @param baseName the basename to use.
*/ */
File getVendorOutputJarFile(String baseName) { File getVendorOutputJarFile(String baseName) {
return new File(destDir, baseName + genericJarSuffix); return new File(destDir, baseName + genericJarSuffix);
@@ -743,6 +753,11 @@ public class GenericDeploymentTool implements EJBDeploymentTool {
* Method used to encapsulate the writing of the JAR file. Iterates over the * Method used to encapsulate the writing of the JAR file. Iterates over the
* filenames/java.io.Files in the Hashtable stored on the instance variable * filenames/java.io.Files in the Hashtable stored on the instance variable
* ejbFiles. * ejbFiles.
* @param baseName the base name to use.
* @param jarfile the jar file to write to.
* @param files the files to write to the jar.
* @param publicId the id to use.
* @throws BuildException if there is a problem.
*/ */
protected void writeJar(String baseName, File jarfile, Hashtable files, protected void writeJar(String baseName, File jarfile, Hashtable files,
String publicId) throws BuildException { String publicId) throws BuildException {
@@ -857,6 +872,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool {
/** /**
* Add all available classes, that depend on Remote, Home, Bean, PK * Add all available classes, that depend on Remote, Home, Bean, PK
* @param checkEntries files, that are extracted from the deployment descriptor * @param checkEntries files, that are extracted from the deployment descriptor
* @throws BuildException if there is a problem.
*/ */
protected void checkAndAddDependants(Hashtable checkEntries) protected void checkAndAddDependants(Hashtable checkEntries)
throws BuildException { throws BuildException {


+ 1
- 0
src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java View File

@@ -170,6 +170,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool {
Project.MSG_WARN); Project.MSG_WARN);
} }


/** {@inheritDoc}. */
public void processDescriptor(String descriptorName, SAXParser saxParser) { public void processDescriptor(String descriptorName, SAXParser saxParser) {
this.descriptorName = descriptorName; this.descriptorName = descriptorName;
this.iasDescriptorName = null; this.iasDescriptorName = null;


+ 23
- 18
src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java View File

@@ -66,6 +66,11 @@ import org.xml.sax.SAXException;
*/ */
public class IPlanetEjbc { public class IPlanetEjbc {


private static final int MIN_NUM_ARGS = 2;
private static final int MAX_NUM_ARGS = 8;
private static final int NUM_CLASSES_WITH_IIOP = 15;
private static final int NUM_CLASSES_WITHOUT_IIOP = 9;

/* Constants used for the "beantype" attribute */ /* Constants used for the "beantype" attribute */
private static final String ENTITY_BEAN = "entity"; private static final String ENTITY_BEAN = "entity";
private static final String STATELESS_SESSION = "stateless"; private static final String STATELESS_SESSION = "stateless";
@@ -254,7 +259,7 @@ public class IPlanetEjbc {
boolean retainSource = false; boolean retainSource = false;
IPlanetEjbc ejbc; IPlanetEjbc ejbc;


if ((args.length < 2) || (args.length > 8)) {
if ((args.length < MIN_NUM_ARGS) || (args.length > MAX_NUM_ARGS)) {
usage(); usage();
return; return;
} }
@@ -602,6 +607,18 @@ public class IPlanetEjbc {
* @see IPlanetEjbc.EjbInfo * @see IPlanetEjbc.EjbInfo
*/ */
private class EjbcHandler extends HandlerBase { private class EjbcHandler extends HandlerBase {
/** EJB 1.1 ID */
private static final String PUBLICID_EJB11 =
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN";
/** IPlanet ID */
private static final String PUBLICID_IPLANET_EJB_60 =
"-//Sun Microsystems, Inc.//DTD iAS Enterprise JavaBeans 1.0//EN";
/** EJB 1.1 location */
private static final String DEFAULT_IAS60_EJB11_DTD_LOCATION =
"ejb-jar_1_1.dtd";
/** IAS60 location */
private static final String DEFAULT_IAS60_DTD_LOCATION =
"IASEjb_jar_1_0.dtd";


/* /*
* Two Maps are used to track local DTDs that will be used in case the * Two Maps are used to track local DTDs that will be used in case the
@@ -625,21 +642,6 @@ public class IPlanetEjbc {
* descriptor DTD. * descriptor DTD.
*/ */
public EjbcHandler() { public EjbcHandler() {
/** EJB 1.1 ID */
final String PUBLICID_EJB11 =
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN";
/** IPlanet ID */
final String PUBLICID_IPLANET_EJB_60 =
"-//Sun Microsystems, Inc.//DTD iAS Enterprise JavaBeans 1.0//EN";


/** EJB 1.1 location */
final String DEFAULT_IAS60_EJB11_DTD_LOCATION =
"ejb-jar_1_1.dtd";
/** IAS60 location */
final String DEFAULT_IAS60_DTD_LOCATION =
"IASEjb_jar_1_0.dtd";

registerDTD(PUBLICID_EJB11, DEFAULT_IAS60_EJB11_DTD_LOCATION); registerDTD(PUBLICID_EJB11, DEFAULT_IAS60_EJB11_DTD_LOCATION);
registerDTD(PUBLICID_IPLANET_EJB_60, DEFAULT_IAS60_DTD_LOCATION); registerDTD(PUBLICID_IPLANET_EJB_60, DEFAULT_IAS60_DTD_LOCATION);
} }
@@ -1271,7 +1273,9 @@ public class IPlanetEjbc {
* names for the stubs and skeletons to be generated. * names for the stubs and skeletons to be generated.
*/ */
private String[] classesToGenerate() { private String[] classesToGenerate() {
String[] classnames = (iiop) ? new String[15] : new String[9];
String[] classnames = (iiop)
? new String[NUM_CLASSES_WITH_IIOP]
: new String[NUM_CLASSES_WITHOUT_IIOP];


final String remotePkg = remote.getPackageName() + "."; final String remotePkg = remote.getPackageName() + ".";
final String remoteClass = remote.getClassName(); final String remoteClass = remote.getClassName();
@@ -1448,7 +1452,8 @@ public class IPlanetEjbc {
* *
*/ */
private static class RedirectOutput extends Thread { private static class RedirectOutput extends Thread {
InputStream stream; // Stream to read and redirect to standard output

private InputStream stream; // Stream to read and redirect to standard output


/** /**
* Constructs a new instance that will redirect output from the * Constructs a new instance that will redirect output from the


+ 14
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java View File

@@ -20,9 +20,16 @@ package org.apache.tools.ant.taskdefs.optional.ejb;
import java.io.File; import java.io.File;
import java.io.FilenameFilter; import java.io.FilenameFilter;


/**
* A filename filter for inner class files of a particular class.
*/
public class InnerClassFilenameFilter implements FilenameFilter { public class InnerClassFilenameFilter implements FilenameFilter {
private String baseClassName; private String baseClassName;


/**
* Constructor of filter.
* @param baseclass the class to filter inner classes on.
*/
InnerClassFilenameFilter(String baseclass) { InnerClassFilenameFilter(String baseclass) {
int extidx = baseclass.lastIndexOf(".class"); int extidx = baseclass.lastIndexOf(".class");
if (extidx == -1) { if (extidx == -1) {
@@ -31,7 +38,13 @@ public class InnerClassFilenameFilter implements FilenameFilter {
baseClassName = baseclass.substring(0, extidx); baseClassName = baseclass.substring(0, extidx);
} }


public boolean accept(File Dir, String filename) {
/**
* Check if the file name passes the filter.
* @param dir not used.
* @param filename the filename to filter on.
* @return true if the filename is an inner class of the base class.
*/
public boolean accept(File dir, String filename) {
if ((filename.lastIndexOf(".") != filename.lastIndexOf(".class")) if ((filename.lastIndexOf(".") != filename.lastIndexOf(".class"))
|| (filename.indexOf(baseClassName + "$") != 0)) { || (filename.indexOf(baseClassName + "$") != 0)) {
return false; return false;


+ 2
- 0
src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java View File

@@ -49,6 +49,8 @@ public class JbossDeploymentTool extends GenericDeploymentTool {
/** /**
* Add any vendor specific files which should be included in the * Add any vendor specific files which should be included in the
* EJB Jar. * EJB Jar.
* @param ejbFiles the hashtable of files to populate.
* @param ddPrefix the prefix to use.
*/ */
protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) { protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) {
File jbossDD = new File(getConfig().descriptorDir, ddPrefix + JBOSS_DD); File jbossDD = new File(getConfig().descriptorDir, ddPrefix + JBOSS_DD);


+ 21
- 12
src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java View File

@@ -326,6 +326,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
/* other methods */ /* other methods */
/* ------------- */ /* ------------- */


/** {@inheritDoc}. */
public void processDescriptor(String aDescriptorName, SAXParser saxParser) { public void processDescriptor(String aDescriptorName, SAXParser saxParser) {


descriptorName = aDescriptorName; descriptorName = aDescriptorName;
@@ -342,6 +343,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
} }
} }


/** {@inheritDoc}. */
protected void writeJar(String baseName, File jarfile, Hashtable ejbFiles, String publicId) protected void writeJar(String baseName, File jarfile, Hashtable ejbFiles, String publicId)
throws BuildException { throws BuildException {


@@ -361,6 +363,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
} }
} }


/** {@inheritDoc}. */
protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) { protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) {


// JOnAS-specific descriptor deployment // JOnAS-specific descriptor deployment
@@ -375,6 +378,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
} }
} }


/** {@inheritDoc}. */
protected File getVendorOutputJarFile(String baseName) { protected File getVendorOutputJarFile(String baseName) {
return new File(getDestDir(), baseName + suffix); return new File(getDestDir(), baseName + suffix);
} }
@@ -451,6 +455,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
return jonasDN; return jonasDN;
} }


/** {@inheritDoc}. */
protected String getJarBaseName(String descriptorFileName) { protected String getJarBaseName(String descriptorFileName) {


String baseName = null; String baseName = null;
@@ -491,6 +496,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
return baseName; return baseName;
} }


/** {@inheritDoc}. */
protected void registerKnownDTDs(DescriptorHandler handler) { protected void registerKnownDTDs(DescriptorHandler handler) {
handler.registerDTD(EJB_JAR_1_1_PUBLIC_ID, handler.registerDTD(EJB_JAR_1_1_PUBLIC_ID,
jonasroot + File.separator + "xml" + File.separator + EJB_JAR_1_1_DTD); jonasroot + File.separator + "xml" + File.separator + EJB_JAR_1_1_DTD);
@@ -509,14 +515,11 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
* @param genericJarFile jar file. * @param genericJarFile jar file.
* @param ejbFiles the hashtable. * @param ejbFiles the hashtable.
*/ */
private void addGenICGeneratedFiles(File genericJarFile, Hashtable ejbFiles) {
// GenIC task
Java genicTask = null;

// GenIC class (3 GenIC classes for various versions of JOnAS
// are supported)
String genicClass = null;

private void addGenICGeneratedFiles(
File genericJarFile, Hashtable ejbFiles) {
Java genicTask = null; // GenIC task
String genicClass = null; // GenIC class (3 are supported for various
// versions
if (nogenic) { if (nogenic) {
return; return;
} }
@@ -573,7 +576,6 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
+ File.separator + orb + "_jonas.jar"; + File.separator + orb + "_jonas.jar";
classpath.append(new Path(classpath.getProject(), orbJar)); classpath.append(new Path(classpath.getProject(), orbJar));
} }

log("Using classpath: " + classpath.toString(), Project.MSG_VERBOSE); log("Using classpath: " + classpath.toString(), Project.MSG_VERBOSE);
genicTask.setClasspath(classpath); genicTask.setClasspath(classpath);


@@ -628,7 +630,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
// verbose // verbose
if (verbose) { if (verbose) {
genicTask.createArg().setValue("-verbose"); genicTask.createArg().setValue("-verbose");
}
}


// additionalargs // additionalargs
if (additionalargs != null) { if (additionalargs != null) {
@@ -653,8 +655,9 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
deleteAllFiles(outputdir); deleteAllFiles(outputdir);


if (!keepgeneric) { if (!keepgeneric) {
log("Deleting generic JAR " + genericJarFile.toString(), Project.MSG_VERBOSE);
genericJarFile.delete();
log("Deleting generic JAR " + genericJarFile.toString(),
Project.MSG_VERBOSE);
genericJarFile.delete();
} }


throw new BuildException("GenIC reported an error."); throw new BuildException("GenIC reported an error.");
@@ -716,6 +719,12 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
return null; return null;
} }


/**
* Verify the configuration.
* @param descriptorFileName the name of the descriptor file.
* @param saxParser not used.
* @throws BuildException if there is an error.
*/
protected void checkConfiguration(String descriptorFileName, protected void checkConfiguration(String descriptorFileName,
SAXParser saxParser) throws BuildException { SAXParser saxParser) throws BuildException {




+ 19
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java View File

@@ -397,6 +397,10 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool {
} }




/**
* Register the DTDs.
* @param handler the handler to use.
*/
protected void registerKnownDTDs(DescriptorHandler handler) { protected void registerKnownDTDs(DescriptorHandler handler) {
// register all the known DTDs // register all the known DTDs
handler.registerDTD(PUBLICID_EJB11, DEFAULT_WL51_EJB11_DTD_LOCATION); handler.registerDTD(PUBLICID_EJB11, DEFAULT_WL51_EJB11_DTD_LOCATION);
@@ -406,6 +410,11 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool {
} }




/**
* Get the weblogic descriptor handler.
* @param srcDir the source directory.
* @return the descriptor.
*/
protected DescriptorHandler getWeblogicDescriptorHandler(final File srcDir) { protected DescriptorHandler getWeblogicDescriptorHandler(final File srcDir) {
DescriptorHandler handler = DescriptorHandler handler =
new DescriptorHandler(getTask(), srcDir) { new DescriptorHandler(getTask(), srcDir) {
@@ -442,6 +451,8 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool {


/** /**
* Add any vendor specific files which should be included in the EJB Jar. * Add any vendor specific files which should be included in the EJB Jar.
* @param ejbFiles the hash table to be populated.
* @param ddPrefix the prefix to use.
*/ */
protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) { protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) {
File weblogicDD = new File(getConfig().descriptorDir, ddPrefix + WL_DD); File weblogicDD = new File(getConfig().descriptorDir, ddPrefix + WL_DD);
@@ -637,6 +648,11 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool {
* Method used to encapsulate the writing of the JAR file. Iterates over * Method used to encapsulate the writing of the JAR file. Iterates over
* the filenames/java.io.Files in the Hashtable stored on the instance * the filenames/java.io.Files in the Hashtable stored on the instance
* variable ejbFiles. * variable ejbFiles.
* @param baseName the base name.
* @param jarFile the jar file to populate.
* @param files the hash table of files to write.
* @param publicId the id to use.
* @throws BuildException if there is a problem.
*/ */
protected void writeJar(String baseName, File jarFile, Hashtable files, protected void writeJar(String baseName, File jarFile, Hashtable files,
String publicId) throws BuildException { String publicId) throws BuildException {
@@ -688,6 +704,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool {
* @param genericJarFile java.io.File The generic jar file. * @param genericJarFile java.io.File The generic jar file.
* @param weblogicJarFile java.io.File The weblogic jar file to check to * @param weblogicJarFile java.io.File The weblogic jar file to check to
* see if it needs to be rebuilt. * see if it needs to be rebuilt.
* @return true if the jar needs to be rebuilt.
*/ */
protected boolean isRebuildRequired(File genericJarFile, File weblogicJarFile) { protected boolean isRebuildRequired(File genericJarFile, File weblogicJarFile) {
boolean rebuild = false; boolean rebuild = false;
@@ -793,7 +810,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool {


//Copy files from old weblogic jar //Copy files from old weblogic jar
for (Enumeration e = wlEntries.elements(); e.hasMoreElements();) { for (Enumeration e = wlEntries.elements(); e.hasMoreElements();) {
byte[] buffer = new byte[1024];
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int bytesRead; int bytesRead;
InputStream is; InputStream is;
JarEntry je = (JarEntry) e.nextElement(); JarEntry je = (JarEntry) e.nextElement();
@@ -802,7 +819,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool {
|| je.getCompressedSize() == je.getSize()) { || je.getCompressedSize() == je.getSize()) {
newJarStream.setLevel(0); newJarStream.setLevel(0);
} else { } else {
newJarStream.setLevel(9);
newJarStream.setLevel(JAR_COMPRESS_LEVEL);
} }


// Update with changed Bean class // Update with changed Bean class


+ 10
- 0
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java View File

@@ -23,6 +23,9 @@ import java.util.Hashtable;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;


/**
* Deployment tool for Weblogic TOPLink.
*/
public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool {


private static final String TL_DTD_LOC private static final String TL_DTD_LOC
@@ -53,6 +56,11 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool {
this.toplinkDTD = inString; this.toplinkDTD = inString;
} }


/**
* Get the descriptor handler.
* @param srcDir the source file.
* @return the descriptor handler.
*/
protected DescriptorHandler getDescriptorHandler(File srcDir) { protected DescriptorHandler getDescriptorHandler(File srcDir) {
DescriptorHandler handler = super.getDescriptorHandler(srcDir); DescriptorHandler handler = super.getDescriptorHandler(srcDir);
if (toplinkDTD != null) { if (toplinkDTD != null) {
@@ -68,6 +76,8 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool {
/** /**
* Add any vendor specific files which should be included in the * Add any vendor specific files which should be included in the
* EJB Jar. * EJB Jar.
* @param ejbFiles the hashtable to add files to.
* @param ddPrefix the prefix to use.
*/ */
protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) { protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) {
super.addVendorFiles(ejbFiles, ddPrefix); super.addVendorFiles(ejbFiles, ddPrefix);


+ 4
- 8
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java View File

@@ -59,6 +59,7 @@ import org.apache.tools.ant.util.FileUtils;
* *
*/ */
public class WebsphereDeploymentTool extends GenericDeploymentTool { public class WebsphereDeploymentTool extends GenericDeploymentTool {

/** ID for ejb 1.1 */ /** ID for ejb 1.1 */
public static final String PUBLICID_EJB11 public static final String PUBLICID_EJB11
= "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"; = "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN";
@@ -608,12 +609,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool {
} }
} }



/**
* Method used to encapsulate the writing of the JAR file. Iterates over
* the filenames/java.io.Files in the Hashtable stored on the instance
* variable ejbFiles.
*/
/** {@inheritDoc}. */
protected void writeJar(String baseName, File jarFile, Hashtable files, String publicId) protected void writeJar(String baseName, File jarFile, Hashtable files, String publicId)
throws BuildException { throws BuildException {
if (ejbdeploy) { if (ejbdeploy) {
@@ -782,7 +778,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool {


//Copy files from old websphere jar //Copy files from old websphere jar
for (Enumeration e = wasEntries.elements(); e.hasMoreElements();) { for (Enumeration e = wasEntries.elements(); e.hasMoreElements();) {
byte[] buffer = new byte[1024];
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int bytesRead; int bytesRead;
InputStream is; InputStream is;
JarEntry je = (JarEntry) e.nextElement(); JarEntry je = (JarEntry) e.nextElement();
@@ -791,7 +787,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool {
|| je.getCompressedSize() == je.getSize()) { || je.getCompressedSize() == je.getSize()) {
newJarStream.setLevel(0); newJarStream.setLevel(0);
} else { } else {
newJarStream.setLevel(9);
newJarStream.setLevel(JAR_COMPRESS_LEVEL);
} }


// Update with changed Bean class // Update with changed Bean class


Loading…
Cancel
Save