git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274841 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -80,14 +80,14 @@ import org.apache.tools.ant.util.FileUtils; | |||||
| public class AntClassLoader2 extends AntClassLoader { | public class AntClassLoader2 extends AntClassLoader { | ||||
| /** Instance of a utility class to use for file operations. */ | /** Instance of a utility class to use for file operations. */ | ||||
| private FileUtils fileUtils; | private FileUtils fileUtils; | ||||
| /** | /** | ||||
| * Constructor | * Constructor | ||||
| */ | */ | ||||
| public AntClassLoader2() { | public AntClassLoader2() { | ||||
| fileUtils = FileUtils.newFileUtils(); | fileUtils = FileUtils.newFileUtils(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Define a class given its bytes | * Define a class given its bytes | ||||
| * | * | ||||
| @@ -107,11 +107,11 @@ public class AntClassLoader2 extends AntClassLoader { | |||||
| definePackage(container, className); | definePackage(container, className); | ||||
| return defineClass(className, classData, 0, classData.length, | return defineClass(className, classData, 0, classData.length, | ||||
| Project.class.getProtectionDomain()); | Project.class.getProtectionDomain()); | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the manifest from the given jar, if it is indeed a jar and it has a | |||||
| * Get the manifest from the given jar, if it is indeed a jar and it has a | |||||
| * manifest | * manifest | ||||
| * | * | ||||
| * @param container the File from which a manifest is required. | * @param container the File from which a manifest is required. | ||||
| @@ -135,50 +135,50 @@ public class AntClassLoader2 extends AntClassLoader { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Define the package information associated with a class. | * Define the package information associated with a class. | ||||
| * | * | ||||
| * @param container the file containing the class definition. | * @param container the file containing the class definition. | ||||
| * @param className the class name of for which the package information | * @param className the class name of for which the package information | ||||
| * is to be determined. | * is to be determined. | ||||
| * | |||||
| * | |||||
| * @exception IOException if the package information cannot be read from the | * @exception IOException if the package information cannot be read from the | ||||
| * container. | * container. | ||||
| */ | |||||
| protected void definePackage(File container, String className) | |||||
| */ | |||||
| protected void definePackage(File container, String className) | |||||
| throws IOException { | throws IOException { | ||||
| int classIndex = className.lastIndexOf('.'); | int classIndex = className.lastIndexOf('.'); | ||||
| if (classIndex == -1) { | if (classIndex == -1) { | ||||
| return; | return; | ||||
| } | } | ||||
| String packageName = className.substring(0, classIndex); | String packageName = className.substring(0, classIndex); | ||||
| if (getPackage(packageName) != null) { | if (getPackage(packageName) != null) { | ||||
| // already defined | |||||
| // already defined | |||||
| return; | return; | ||||
| } | } | ||||
| // define the package now | |||||
| // define the package now | |||||
| Manifest manifest = getJarManifest(container); | Manifest manifest = getJarManifest(container); | ||||
| if (manifest == null) { | if (manifest == null) { | ||||
| definePackage(packageName, null, null, null, null, null, | |||||
| definePackage(packageName, null, null, null, null, null, | |||||
| null, null); | null, null); | ||||
| } else { | } else { | ||||
| definePackage(container, packageName, manifest); | definePackage(container, packageName, manifest); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Define the package information when the class comes from a | |||||
| * Define the package information when the class comes from a | |||||
| * jar with a manifest | * jar with a manifest | ||||
| * | * | ||||
| * @param container the jar file containing the manifest | * @param container the jar file containing the manifest | ||||
| * @param packageName the name of the package being defined. | * @param packageName the name of the package being defined. | ||||
| * @param manifest the jar's manifest | * @param manifest the jar's manifest | ||||
| */ | */ | ||||
| protected void definePackage(File container, String packageName, | |||||
| protected void definePackage(File container, String packageName, | |||||
| Manifest manifest) { | Manifest manifest) { | ||||
| String sectionName = packageName.replace('.', '/') + "/"; | String sectionName = packageName.replace('.', '/') + "/"; | ||||
| @@ -190,57 +190,57 @@ public class AntClassLoader2 extends AntClassLoader { | |||||
| String implementationVersion = null; | String implementationVersion = null; | ||||
| String sealedString = null; | String sealedString = null; | ||||
| URL sealBase = null; | URL sealBase = null; | ||||
| Attributes sectionAttributes = manifest.getAttributes(sectionName); | Attributes sectionAttributes = manifest.getAttributes(sectionName); | ||||
| if (sectionAttributes != null) { | if (sectionAttributes != null) { | ||||
| specificationTitle | |||||
| specificationTitle | |||||
| = sectionAttributes.getValue(Name.SPECIFICATION_TITLE); | = sectionAttributes.getValue(Name.SPECIFICATION_TITLE); | ||||
| specificationVendor | |||||
| specificationVendor | |||||
| = sectionAttributes.getValue(Name.SPECIFICATION_VENDOR); | = sectionAttributes.getValue(Name.SPECIFICATION_VENDOR); | ||||
| specificationVersion | |||||
| specificationVersion | |||||
| = sectionAttributes.getValue(Name.SPECIFICATION_VERSION); | = sectionAttributes.getValue(Name.SPECIFICATION_VERSION); | ||||
| implementationTitle | |||||
| implementationTitle | |||||
| = sectionAttributes.getValue(Name.IMPLEMENTATION_TITLE); | = sectionAttributes.getValue(Name.IMPLEMENTATION_TITLE); | ||||
| implementationVendor | |||||
| implementationVendor | |||||
| = sectionAttributes.getValue(Name.IMPLEMENTATION_VENDOR); | = sectionAttributes.getValue(Name.IMPLEMENTATION_VENDOR); | ||||
| implementationVersion | |||||
| implementationVersion | |||||
| = sectionAttributes.getValue(Name.IMPLEMENTATION_VERSION); | = sectionAttributes.getValue(Name.IMPLEMENTATION_VERSION); | ||||
| sealedString | |||||
| sealedString | |||||
| = sectionAttributes.getValue(Name.SEALED); | = sectionAttributes.getValue(Name.SEALED); | ||||
| } | } | ||||
| Attributes mainAttributes = manifest.getMainAttributes(); | Attributes mainAttributes = manifest.getMainAttributes(); | ||||
| if (mainAttributes != null) { | if (mainAttributes != null) { | ||||
| if (specificationTitle == null) { | if (specificationTitle == null) { | ||||
| specificationTitle | |||||
| specificationTitle | |||||
| = mainAttributes.getValue(Name.SPECIFICATION_TITLE); | = mainAttributes.getValue(Name.SPECIFICATION_TITLE); | ||||
| } | } | ||||
| if (specificationVendor == null) { | if (specificationVendor == null) { | ||||
| specificationVendor | |||||
| specificationVendor | |||||
| = mainAttributes.getValue(Name.SPECIFICATION_VENDOR); | = mainAttributes.getValue(Name.SPECIFICATION_VENDOR); | ||||
| } | } | ||||
| if (specificationVersion == null) { | if (specificationVersion == null) { | ||||
| specificationVersion | |||||
| specificationVersion | |||||
| = mainAttributes.getValue(Name.SPECIFICATION_VERSION); | = mainAttributes.getValue(Name.SPECIFICATION_VERSION); | ||||
| } | } | ||||
| if (implementationTitle == null) { | if (implementationTitle == null) { | ||||
| implementationTitle | |||||
| implementationTitle | |||||
| = mainAttributes.getValue(Name.IMPLEMENTATION_TITLE); | = mainAttributes.getValue(Name.IMPLEMENTATION_TITLE); | ||||
| } | } | ||||
| if (implementationVendor == null) { | if (implementationVendor == null) { | ||||
| implementationVendor | |||||
| implementationVendor | |||||
| = mainAttributes.getValue(Name.IMPLEMENTATION_VENDOR); | = mainAttributes.getValue(Name.IMPLEMENTATION_VENDOR); | ||||
| } | } | ||||
| if (implementationVersion == null) { | if (implementationVersion == null) { | ||||
| implementationVersion | |||||
| implementationVersion | |||||
| = mainAttributes.getValue(Name.IMPLEMENTATION_VERSION); | = mainAttributes.getValue(Name.IMPLEMENTATION_VERSION); | ||||
| } | } | ||||
| if (sealedString == null) { | if (sealedString == null) { | ||||
| sealedString | |||||
| sealedString | |||||
| = mainAttributes.getValue(Name.SEALED); | = mainAttributes.getValue(Name.SEALED); | ||||
| } | } | ||||
| } | } | ||||
| if (sealedString != null && sealedString.equalsIgnoreCase("true")) { | if (sealedString != null && sealedString.equalsIgnoreCase("true")) { | ||||
| try { | try { | ||||
| sealBase = new URL("file:" + container.getPath()); | sealBase = new URL("file:" + container.getPath()); | ||||
| @@ -248,15 +248,15 @@ public class AntClassLoader2 extends AntClassLoader { | |||||
| // ignore | // ignore | ||||
| } | } | ||||
| } | } | ||||
| definePackage(packageName, specificationTitle, specificationVersion, | |||||
| specificationVendor, implementationTitle, | |||||
| definePackage(packageName, specificationTitle, specificationVersion, | |||||
| specificationVendor, implementationTitle, | |||||
| implementationVersion, implementationVendor, sealBase); | implementationVersion, implementationVendor, sealBase); | ||||
| } | } | ||||
| /** | /** | ||||
| * Add a file to the path. This classloader reads the manifest, if | |||||
| * Add a file to the path. This classloader reads the manifest, if | |||||
| * available, and adds any additional class path jars specified in the | * available, and adds any additional class path jars specified in the | ||||
| * manifest. | * manifest. | ||||
| * | * | ||||
| @@ -267,29 +267,29 @@ public class AntClassLoader2 extends AntClassLoader { | |||||
| */ | */ | ||||
| protected void addPathFile(File pathComponent) throws IOException { | protected void addPathFile(File pathComponent) throws IOException { | ||||
| super.addPathFile(pathComponent); | super.addPathFile(pathComponent); | ||||
| if (pathComponent.isDirectory()) { | if (pathComponent.isDirectory()) { | ||||
| return; | return; | ||||
| } | } | ||||
| String classpath = null; | String classpath = null; | ||||
| ZipFile jarFile = null; | ZipFile jarFile = null; | ||||
| InputStream manifestStream = null; | InputStream manifestStream = null; | ||||
| try { | try { | ||||
| jarFile = new ZipFile(pathComponent); | jarFile = new ZipFile(pathComponent); | ||||
| manifestStream | |||||
| manifestStream | |||||
| = jarFile.getInputStream(new ZipEntry("META-INF/MANIFEST.MF")); | = jarFile.getInputStream(new ZipEntry("META-INF/MANIFEST.MF")); | ||||
| if (manifestStream == null) { | if (manifestStream == null) { | ||||
| return; | return; | ||||
| } | |||||
| Reader manifestReader | |||||
| } | |||||
| Reader manifestReader | |||||
| = new InputStreamReader(manifestStream, "UTF-8"); | = new InputStreamReader(manifestStream, "UTF-8"); | ||||
| org.apache.tools.ant.taskdefs.Manifest manifest | org.apache.tools.ant.taskdefs.Manifest manifest | ||||
| = new org.apache.tools.ant.taskdefs.Manifest(manifestReader); | = new org.apache.tools.ant.taskdefs.Manifest(manifestReader); | ||||
| classpath | |||||
| classpath | |||||
| = manifest.getMainSection().getAttributeValue("Class-Path"); | = manifest.getMainSection().getAttributeValue("Class-Path"); | ||||
| } catch (org.apache.tools.ant.taskdefs.ManifestException e) { | } catch (org.apache.tools.ant.taskdefs.ManifestException e) { | ||||
| // ignore | // ignore | ||||
| } finally { | } finally { | ||||
| @@ -300,7 +300,7 @@ public class AntClassLoader2 extends AntClassLoader { | |||||
| jarFile.close(); | jarFile.close(); | ||||
| } | } | ||||
| } | } | ||||
| if (classpath != null) { | if (classpath != null) { | ||||
| URL baseURL = fileUtils.getFileURL(pathComponent); | URL baseURL = fileUtils.getFileURL(pathComponent); | ||||
| StringTokenizer st = new StringTokenizer(classpath); | StringTokenizer st = new StringTokenizer(classpath); | ||||
| @@ -308,7 +308,7 @@ public class AntClassLoader2 extends AntClassLoader { | |||||
| String classpathElement = st.nextToken(); | String classpathElement = st.nextToken(); | ||||
| URL libraryURL = new URL(baseURL, classpathElement); | URL libraryURL = new URL(baseURL, classpathElement); | ||||
| if (!libraryURL.getProtocol().equals("file")) { | if (!libraryURL.getProtocol().equals("file")) { | ||||
| log("Skipping jar library " + classpathElement | |||||
| log("Skipping jar library " + classpathElement | |||||
| + " since only relative URLs are supported by this" | + " since only relative URLs are supported by this" | ||||
| + " loader", Project.MSG_VERBOSE); | + " loader", Project.MSG_VERBOSE); | ||||
| continue; | continue; | ||||
| @@ -460,7 +460,7 @@ public abstract class Definer extends Task { | |||||
| /** | /** | ||||
| * Set the classname of the class that the definition | * Set the classname of the class that the definition | ||||
| * must be compatible with, either directly or | * must be compatible with, either directly or | ||||
| * by use of the adapeter class. | |||||
| * by use of the adapter class. | |||||
| * | * | ||||
| * @param adaptTo the name of the adaptto class | * @param adaptTo the name of the adaptto class | ||||
| */ | */ | ||||
| @@ -99,14 +99,14 @@ public class FieldRefCPInfo extends ConstantPoolEntry { | |||||
| * and against which this entry is to be resolved. | * and against which this entry is to be resolved. | ||||
| */ | */ | ||||
| public void resolve(ConstantPool constantPool) { | public void resolve(ConstantPool constantPool) { | ||||
| ClassCPInfo fieldClass | |||||
| ClassCPInfo fieldClass | |||||
| = (ClassCPInfo) constantPool.getEntry(classIndex); | = (ClassCPInfo) constantPool.getEntry(classIndex); | ||||
| fieldClass.resolve(constantPool); | fieldClass.resolve(constantPool); | ||||
| fieldClassName = fieldClass.getClassName(); | fieldClassName = fieldClass.getClassName(); | ||||
| NameAndTypeCPInfo nt | |||||
| NameAndTypeCPInfo nt | |||||
| = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex); | = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex); | ||||
| nt.resolve(constantPool); | nt.resolve(constantPool); | ||||
| @@ -126,10 +126,10 @@ public class FieldRefCPInfo extends ConstantPoolEntry { | |||||
| String value; | String value; | ||||
| if (isResolved()) { | if (isResolved()) { | ||||
| value = "Field : Class = " + fieldClassName + ", name = " | |||||
| value = "Field : Class = " + fieldClassName + ", name = " | |||||
| + fieldName + ", type = " + fieldType; | + fieldName + ", type = " + fieldType; | ||||
| } else { | } else { | ||||
| value = "Field : Class index = " + classIndex | |||||
| value = "Field : Class index = " + classIndex | |||||
| + ", name and type index = " + nameAndTypeIndex; | + ", name and type index = " + nameAndTypeIndex; | ||||
| } | } | ||||
| @@ -418,7 +418,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| //debug ? | //debug ? | ||||
| if (java2iiopdebug) { | if (java2iiopdebug) { | ||||
| commandline.createArgument().setValue("-VBJdebug"); | commandline.createArgument().setValue("-VBJdebug"); | ||||
| } | |||||
| } | |||||
| //set the classpath | //set the classpath | ||||
| commandline.createArgument().setValue("-VBJclasspath"); | commandline.createArgument().setValue("-VBJclasspath"); | ||||
| commandline.createArgument().setPath(getCombinedClasspath()); | commandline.createArgument().setPath(getCombinedClasspath()); | ||||
| @@ -426,12 +426,12 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| commandline.createArgument().setValue("-list_files"); | commandline.createArgument().setValue("-list_files"); | ||||
| //no TIE classes | //no TIE classes | ||||
| commandline.createArgument().setValue("-no_tie"); | commandline.createArgument().setValue("-no_tie"); | ||||
| if ( java2iioparams != null) { | if ( java2iioparams != null) { | ||||
| log("additional "+java2iioparams +" to java2iiop " ,0); | log("additional "+java2iioparams +" to java2iiop " ,0); | ||||
| commandline.createArgument().setValue(java2iioparams); | |||||
| commandline.createArgument().setValue(java2iioparams); | |||||
| } | } | ||||
| //root dir | //root dir | ||||
| commandline.createArgument().setValue("-root_dir"); | commandline.createArgument().setValue("-root_dir"); | ||||
| @@ -441,7 +441,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| //add the home class | //add the home class | ||||
| while (ithomes.hasNext()) { | while (ithomes.hasNext()) { | ||||
| commandline.createArgument().setValue(ithomes.next().toString()); | commandline.createArgument().setValue(ithomes.next().toString()); | ||||
| } | |||||
| } | |||||
| try { | try { | ||||
| log("Calling java2iiop", Project.MSG_VERBOSE); | log("Calling java2iiop", Project.MSG_VERBOSE); | ||||
| @@ -476,8 +476,8 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| String home = toClass(clazz); | String home = toClass(clazz); | ||||
| homes.add(home); | homes.add(home); | ||||
| log(" Home " + home, Project.MSG_VERBOSE); | log(" Home " + home, Project.MSG_VERBOSE); | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| buildBorlandStubs(homes.iterator()); | buildBorlandStubs(homes.iterator()); | ||||
| @@ -537,8 +537,8 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| String classfile = toClassFile(javafile); | String classfile = toClassFile(javafile); | ||||
| String key = classfile.substring(getConfig().srcDir.getAbsolutePath().length() + 1); | String key = classfile.substring(getConfig().srcDir.getAbsolutePath().length() + 1); | ||||
| _genfiles.put(key, new File(classfile)); | _genfiles.put(key, new File(classfile)); | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| reader.close(); | reader.close(); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| String msg = "Exception while parsing java2iiop output. Details: " + e.toString(); | String msg = "Exception while parsing java2iiop output. Details: " + e.toString(); | ||||
| @@ -551,7 +551,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| String s = reader.readLine(); | String s = reader.readLine(); | ||||
| if (s != null) { | if (s != null) { | ||||
| log("[java2iiop] " + s, Project.MSG_ERR); | log("[java2iiop] " + s, Project.MSG_ERR); | ||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000,2002 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000,2002 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -76,19 +76,19 @@ public class DDCreator extends MatchingTask { | |||||
| * on the EJBC task, as supported by the MatchingTask superclass. | * on the EJBC task, as supported by the MatchingTask superclass. | ||||
| */ | */ | ||||
| private File descriptorDirectory; | private File descriptorDirectory; | ||||
| /** | /** | ||||
| * The directory where generated serialised deployment descriptors are placed. | * The directory where generated serialised deployment descriptors are placed. | ||||
| */ | */ | ||||
| private File generatedFilesDirectory; | private File generatedFilesDirectory; | ||||
| /** | /** | ||||
| * The classpath to be used in the weblogic ejbc calls. It must contain the weblogic | * The classpath to be used in the weblogic ejbc calls. It must contain the weblogic | ||||
| * classes necessary fro DDCreator <b>and</b> the implementation classes of the | |||||
| * classes necessary fro DDCreator <b>and</b> the implementation classes of the | |||||
| * home and remote interfaces. | * home and remote interfaces. | ||||
| */ | */ | ||||
| private String classpath; | private String classpath; | ||||
| /** | /** | ||||
| * Do the work. | * Do the work. | ||||
| * | * | ||||
| @@ -103,26 +103,26 @@ public class DDCreator extends MatchingTask { | |||||
| public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
| if (descriptorDirectory == null || | if (descriptorDirectory == null || | ||||
| !descriptorDirectory.isDirectory()) { | !descriptorDirectory.isDirectory()) { | ||||
| throw new BuildException("descriptors directory " + descriptorDirectory.getPath() + | |||||
| throw new BuildException("descriptors directory " + descriptorDirectory.getPath() + | |||||
| " is not valid"); | " is not valid"); | ||||
| } | } | ||||
| if (generatedFilesDirectory == null || | if (generatedFilesDirectory == null || | ||||
| !generatedFilesDirectory.isDirectory()) { | !generatedFilesDirectory.isDirectory()) { | ||||
| throw new BuildException("dest directory " + generatedFilesDirectory.getPath() + | |||||
| throw new BuildException("dest directory " + generatedFilesDirectory.getPath() + | |||||
| " is not valid"); | " is not valid"); | ||||
| } | } | ||||
| String args = descriptorDirectory + " " + generatedFilesDirectory; | String args = descriptorDirectory + " " + generatedFilesDirectory; | ||||
| // get all the files in the descriptor directory | // get all the files in the descriptor directory | ||||
| DirectoryScanner ds = super.getDirectoryScanner(descriptorDirectory); | DirectoryScanner ds = super.getDirectoryScanner(descriptorDirectory); | ||||
| String[] files = ds.getIncludedFiles(); | String[] files = ds.getIncludedFiles(); | ||||
| for (int i = 0; i < files.length; ++i) { | for (int i = 0; i < files.length; ++i) { | ||||
| args += " " + files[i]; | args += " " + files[i]; | ||||
| } | } | ||||
| String systemClassPath = System.getProperty("java.class.path"); | String systemClassPath = System.getProperty("java.class.path"); | ||||
| String execClassPath = getProject().translatePath(systemClassPath + ":" + classpath); | String execClassPath = getProject().translatePath(systemClassPath + ":" + classpath); | ||||
| Java ddCreatorTask = (Java) getProject().createTask("java"); | Java ddCreatorTask = (Java) getProject().createTask("java"); | ||||
| @@ -132,7 +132,7 @@ public class DDCreator extends MatchingTask { | |||||
| Commandline.Argument arguments = ddCreatorTask.createArg(); | Commandline.Argument arguments = ddCreatorTask.createArg(); | ||||
| arguments.setLine(args); | arguments.setLine(args); | ||||
| ddCreatorTask.setClasspath(new Path(getProject(), execClassPath)); | ddCreatorTask.setClasspath(new Path(getProject(), execClassPath)); | ||||
| if (ddCreatorTask.executeJava() != 0) { | |||||
| if (ddCreatorTask.executeJava() != 0) { | |||||
| throw new BuildException("Execution of ddcreator helper failed"); | throw new BuildException("Execution of ddcreator helper failed"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -146,7 +146,7 @@ public class DDCreator extends MatchingTask { | |||||
| public void setDescriptors(String dirName) { | public void setDescriptors(String dirName) { | ||||
| descriptorDirectory = new File(dirName); | descriptorDirectory = new File(dirName); | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the directory into which the serialized deployment descriptors are to | * Set the directory into which the serialized deployment descriptors are to | ||||
| * be written. | * be written. | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -68,10 +68,10 @@ import javax.ejb.deployment.DeploymentDescriptor; | |||||
| */ | */ | ||||
| public class DDCreatorHelper { | public class DDCreatorHelper { | ||||
| /** | /** | ||||
| * The root directory of the tree containing the textual deployment desciptors. | |||||
| * The root directory of the tree containing the textual deployment desciptors. | |||||
| */ | */ | ||||
| private File descriptorDirectory; | private File descriptorDirectory; | ||||
| /** | /** | ||||
| * The directory where generated serialised desployment descriptors are written. | * The directory where generated serialised desployment descriptors are written. | ||||
| */ | */ | ||||
| @@ -80,19 +80,19 @@ public class DDCreatorHelper { | |||||
| /** | /** | ||||
| * The descriptor text files for which a serialised descriptor is to be created. | * The descriptor text files for which a serialised descriptor is to be created. | ||||
| */ | */ | ||||
| String[] descriptors; | |||||
| String[] descriptors; | |||||
| /** | /** | ||||
| * The main method. | * The main method. | ||||
| * | * | ||||
| * The main method creates an instance of the DDCreatorHelper, passing it the | |||||
| * The main method creates an instance of the DDCreatorHelper, passing it the | |||||
| * args which it then processes. | * args which it then processes. | ||||
| */ | |||||
| */ | |||||
| public static void main(String[] args) throws Exception { | public static void main(String[] args) throws Exception { | ||||
| DDCreatorHelper helper = new DDCreatorHelper(args); | DDCreatorHelper helper = new DDCreatorHelper(args); | ||||
| helper.process(); | helper.process(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Initialise the helper with the command arguments. | * Initialise the helper with the command arguments. | ||||
| * | * | ||||
| @@ -101,20 +101,20 @@ public class DDCreatorHelper { | |||||
| int index = 0; | int index = 0; | ||||
| descriptorDirectory = new File(args[index++]); | descriptorDirectory = new File(args[index++]); | ||||
| generatedFilesDirectory = new File(args[index++]); | generatedFilesDirectory = new File(args[index++]); | ||||
| descriptors = new String[args.length - index]; | descriptors = new String[args.length - index]; | ||||
| for (int i = 0; index < args.length; ++i) { | for (int i = 0; index < args.length; ++i) { | ||||
| descriptors[i] = args[index++]; | descriptors[i] = args[index++]; | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Do the actual work. | * Do the actual work. | ||||
| * | * | ||||
| * The work proceeds by examining each descriptor given. If the serialised | * The work proceeds by examining each descriptor given. If the serialised | ||||
| * file does not exist or is older than the text description, the weblogic | * file does not exist or is older than the text description, the weblogic | ||||
| * DDCreator tool is invoked directly to build the serialised descriptor. | * DDCreator tool is invoked directly to build the serialised descriptor. | ||||
| */ | |||||
| */ | |||||
| private void process() throws Exception { | private void process() throws Exception { | ||||
| for (int i = 0; i < descriptors.length; ++i) { | for (int i = 0; i < descriptors.length; ++i) { | ||||
| String descriptorName = descriptors[i]; | String descriptorName = descriptors[i]; | ||||
| @@ -128,12 +128,12 @@ public class DDCreatorHelper { | |||||
| serName = descriptorName + ".ser"; | serName = descriptorName + ".ser"; | ||||
| } | } | ||||
| File serFile = new File(generatedFilesDirectory, serName); | File serFile = new File(generatedFilesDirectory, serName); | ||||
| // do we need to regenerate the file | // do we need to regenerate the file | ||||
| if (!serFile.exists() || serFile.lastModified() < descriptorFile.lastModified() | if (!serFile.exists() || serFile.lastModified() < descriptorFile.lastModified() | ||||
| || regenerateSerializedFile(serFile)) { | || regenerateSerializedFile(serFile)) { | ||||
| String[] args = {"-noexit", | |||||
| String[] args = {"-noexit", | |||||
| "-d", serFile.getParent(), | "-d", serFile.getParent(), | ||||
| "-outputfile", serFile.getName(), | "-outputfile", serFile.getName(), | ||||
| descriptorFile.getPath()}; | descriptorFile.getPath()}; | ||||
| @@ -168,8 +168,8 @@ public class DDCreatorHelper { | |||||
| return false; | return false; | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| // Weblogic will throw an error if the deployment descriptor does | |||||
| // Weblogic will throw an error if the deployment descriptor does | |||||
| // not match the class files. | // not match the class files. | ||||
| return true; | return true; | ||||
| @@ -164,7 +164,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||||
| // resolve relative to project basedir | // resolve relative to project basedir | ||||
| fileDTD = owningTask.getProject().resolveFile(location); | fileDTD = owningTask.getProject().resolveFile(location); | ||||
| } | } | ||||
| if (fileDTD.exists()) { | if (fileDTD.exists()) { | ||||
| if (publicId != null) { | if (publicId != null) { | ||||
| fileDTDs.put(publicId, fileDTD); | fileDTDs.put(publicId, fileDTD); | ||||
| @@ -341,7 +341,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||||
| protected void processElement() { | protected void processElement() { | ||||
| if (inEJBRef || | |||||
| if (inEJBRef || | |||||
| (parseState != STATE_IN_ENTITY && parseState != STATE_IN_SESSION && parseState != STATE_IN_MESSAGE)) { | (parseState != STATE_IN_ENTITY && parseState != STATE_IN_SESSION && parseState != STATE_IN_MESSAGE)) { | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -67,11 +67,11 @@ public interface EJBDeploymentTool { | |||||
| * deployment files. | * deployment files. | ||||
| * | * | ||||
| * @param descriptorFilename the name of the deployment descriptor | * @param descriptorFilename the name of the deployment descriptor | ||||
| * @param saxParser a SAX parser which can be used to parse the deployment descriptor. | |||||
| * @param saxParser a SAX parser which can be used to parse the deployment descriptor. | |||||
| */ | */ | ||||
| void processDescriptor(String descriptorFilename, SAXParser saxParser) | |||||
| void processDescriptor(String descriptorFilename, SAXParser saxParser) | |||||
| throws BuildException; | throws BuildException; | ||||
| /** | /** | ||||
| * Called to validate that the tool parameters have been configured. | * Called to validate that the tool parameters have been configured. | ||||
| * | * | ||||
| @@ -82,9 +82,9 @@ public interface EJBDeploymentTool { | |||||
| * Set the task which owns this tool | * Set the task which owns this tool | ||||
| */ | */ | ||||
| void setTask(Task task); | void setTask(Task task); | ||||
| /** | /** | ||||
| * Configure this tool for use in the ejbjar task. | * Configure this tool for use in the ejbjar task. | ||||
| */ | */ | ||||
| void configure(EjbJar.Config config); | |||||
| void configure(EjbJar.Config config); | |||||
| } | } | ||||
| @@ -464,7 +464,7 @@ public class EjbJar extends MatchingTask { | |||||
| /** | /** | ||||
| * Gets the destination directory. | * Gets the destination directory. | ||||
| * | |||||
| * | |||||
| * @return destination directory | * @return destination directory | ||||
| * @since ant 1.6 | * @since ant 1.6 | ||||
| */ | */ | ||||
| @@ -488,7 +488,7 @@ public class EjbJar extends MatchingTask { | |||||
| /** | /** | ||||
| * Gets the CMP version. | * Gets the CMP version. | ||||
| * | |||||
| * | |||||
| * @return CMP version | * @return CMP version | ||||
| * @since ant 1.6 | * @since ant 1.6 | ||||
| */ | */ | ||||
| @@ -498,7 +498,7 @@ public class EjbJar extends MatchingTask { | |||||
| /** | /** | ||||
| * Sets the CMP version. | * Sets the CMP version. | ||||
| * | |||||
| * | |||||
| * @param version CMP version. | * @param version CMP version. | ||||
| * Must be either <code>1.0</code> or <code>2.0</code>.<br/> | * Must be either <code>1.0</code> or <code>2.0</code>.<br/> | ||||
| * Default is <code>1.0</code>.<br/> | * Default is <code>1.0</code>.<br/> | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -74,26 +74,26 @@ import javax.ejb.deployment.EntityDescriptor; | |||||
| */ | */ | ||||
| public class EjbcHelper { | public class EjbcHelper { | ||||
| /** | /** | ||||
| * The root directory of the tree containing the serialised deployment desciptors. | |||||
| * The root directory of the tree containing the serialised deployment desciptors. | |||||
| */ | */ | ||||
| private File descriptorDirectory; | private File descriptorDirectory; | ||||
| /** | /** | ||||
| * The directory where generated files are placed. | * The directory where generated files are placed. | ||||
| */ | */ | ||||
| private File generatedFilesDirectory; | private File generatedFilesDirectory; | ||||
| /** | /** | ||||
| * The name of the manifest file generated for the EJB jar. | * The name of the manifest file generated for the EJB jar. | ||||
| */ | */ | ||||
| private File manifestFile; | private File manifestFile; | ||||
| /** | /** | ||||
| * The source directory for the home and remote interfaces. This is used to determine if | * The source directory for the home and remote interfaces. This is used to determine if | ||||
| * the generated deployment classes are out of date. | * the generated deployment classes are out of date. | ||||
| */ | */ | ||||
| private File sourceDirectory; | private File sourceDirectory; | ||||
| /** | /** | ||||
| * The names of the serialised deployment descriptors | * The names of the serialised deployment descriptors | ||||
| */ | */ | ||||
| @@ -103,15 +103,15 @@ public class EjbcHelper { | |||||
| /** | /** | ||||
| * Command line interface for the ejbc helper task. | * Command line interface for the ejbc helper task. | ||||
| */ | |||||
| */ | |||||
| public static void main(String[] args) throws Exception { | public static void main(String[] args) throws Exception { | ||||
| EjbcHelper helper = new EjbcHelper(args); | EjbcHelper helper = new EjbcHelper(args); | ||||
| helper.process(); | helper.process(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Initialise the EjbcHelper by reading the command arguments. | * Initialise the EjbcHelper by reading the command arguments. | ||||
| */ | |||||
| */ | |||||
| private EjbcHelper(String[] args) { | private EjbcHelper(String[] args) { | ||||
| int index = 0; | int index = 0; | ||||
| descriptorDirectory = new File(args[index++]); | descriptorDirectory = new File(args[index++]); | ||||
| @@ -119,25 +119,25 @@ public class EjbcHelper { | |||||
| sourceDirectory = new File(args[index++]); | sourceDirectory = new File(args[index++]); | ||||
| manifestFile = new File(args[index++]); | manifestFile = new File(args[index++]); | ||||
| keepGenerated = Boolean.valueOf(args[index++]).booleanValue(); | keepGenerated = Boolean.valueOf(args[index++]).booleanValue(); | ||||
| descriptors = new String[args.length - index]; | descriptors = new String[args.length - index]; | ||||
| for (int i = 0; index < args.length; ++i) { | for (int i = 0; index < args.length; ++i) { | ||||
| descriptors[i] = args[index++]; | descriptors[i] = args[index++]; | ||||
| } | } | ||||
| } | } | ||||
| private String[] getCommandLine(boolean debug, File descriptorFile) { | private String[] getCommandLine(boolean debug, File descriptorFile) { | ||||
| Vector v = new Vector(); | Vector v = new Vector(); | ||||
| if (!debug) { | if (!debug) { | ||||
| v.addElement("-noexit"); | v.addElement("-noexit"); | ||||
| } | } | ||||
| if (keepGenerated) { | if (keepGenerated) { | ||||
| v.addElement("-keepgenerated"); | |||||
| v.addElement("-keepgenerated"); | |||||
| } | } | ||||
| v.addElement("-d"); | v.addElement("-d"); | ||||
| v.addElement(generatedFilesDirectory.getPath()); | v.addElement(generatedFilesDirectory.getPath()); | ||||
| v.addElement(descriptorFile.getPath()); | v.addElement(descriptorFile.getPath()); | ||||
| String[] args = new String[v.size()]; | String[] args = new String[v.size()]; | ||||
| v.copyInto(args); | v.copyInto(args); | ||||
| return args; | return args; | ||||
| @@ -148,7 +148,7 @@ public class EjbcHelper { | |||||
| * for a given deployment descriptor. | * for a given deployment descriptor. | ||||
| * | * | ||||
| * This process attempts to determine if the support classes need to be | * This process attempts to determine if the support classes need to be | ||||
| * rebuilt. It does this by examining only some of the support classes | |||||
| * rebuilt. It does this by examining only some of the support classes | |||||
| * which are typically generated. If the ejbc task is interrupted generating | * which are typically generated. If the ejbc task is interrupted generating | ||||
| * the support classes for a bean, all of the support classes should be removed | * the support classes for a bean, all of the support classes should be removed | ||||
| * to force regeneration of the support classes. | * to force regeneration of the support classes. | ||||
| @@ -170,38 +170,38 @@ public class EjbcHelper { | |||||
| ObjectInputStream ois = new ObjectInputStream(fis); | ObjectInputStream ois = new ObjectInputStream(fis); | ||||
| DeploymentDescriptor dd = (DeploymentDescriptor) ois.readObject(); | DeploymentDescriptor dd = (DeploymentDescriptor) ois.readObject(); | ||||
| fis.close(); | fis.close(); | ||||
| String homeInterfacePath = dd.getHomeInterfaceClassName().replace('.', '/') + ".java"; | String homeInterfacePath = dd.getHomeInterfaceClassName().replace('.', '/') + ".java"; | ||||
| String remoteInterfacePath = dd.getRemoteInterfaceClassName().replace('.', '/') + ".java"; | String remoteInterfacePath = dd.getRemoteInterfaceClassName().replace('.', '/') + ".java"; | ||||
| String primaryKeyClassPath = null; | String primaryKeyClassPath = null; | ||||
| if (dd instanceof EntityDescriptor) { | if (dd instanceof EntityDescriptor) { | ||||
| primaryKeyClassPath = ((EntityDescriptor) dd).getPrimaryKeyClassName().replace('.', '/') + ".java";; | primaryKeyClassPath = ((EntityDescriptor) dd).getPrimaryKeyClassName().replace('.', '/') + ".java";; | ||||
| } | } | ||||
| File homeInterfaceSource = new File(sourceDirectory, homeInterfacePath); | File homeInterfaceSource = new File(sourceDirectory, homeInterfacePath); | ||||
| File remoteInterfaceSource = new File(sourceDirectory, remoteInterfacePath); | File remoteInterfaceSource = new File(sourceDirectory, remoteInterfacePath); | ||||
| File primaryKeyClassSource = null; | File primaryKeyClassSource = null; | ||||
| if (primaryKeyClassPath != null) { | if (primaryKeyClassPath != null) { | ||||
| primaryKeyClassSource = new File(sourceDirectory, remoteInterfacePath); | primaryKeyClassSource = new File(sourceDirectory, remoteInterfacePath); | ||||
| } | } | ||||
| // are any of the above out of date. | |||||
| // are any of the above out of date. | |||||
| // we find the implementation classes and see if they are older than any | // we find the implementation classes and see if they are older than any | ||||
| // of the above or the .ser file itself. | // of the above or the .ser file itself. | ||||
| String beanClassBase = dd.getEnterpriseBeanClassName().replace('.', '/'); | String beanClassBase = dd.getEnterpriseBeanClassName().replace('.', '/'); | ||||
| File ejbImplentationClass | |||||
| File ejbImplentationClass | |||||
| = new File(generatedFilesDirectory, beanClassBase + "EOImpl.class"); | = new File(generatedFilesDirectory, beanClassBase + "EOImpl.class"); | ||||
| File homeImplementationClass | |||||
| File homeImplementationClass | |||||
| = new File(generatedFilesDirectory, beanClassBase + "HomeImpl.class"); | = new File(generatedFilesDirectory, beanClassBase + "HomeImpl.class"); | ||||
| File beanStubClass | |||||
| File beanStubClass | |||||
| = new File(generatedFilesDirectory, beanClassBase + "EOImpl_WLStub.class"); | = new File(generatedFilesDirectory, beanClassBase + "EOImpl_WLStub.class"); | ||||
| // if the implementation classes don;t exist regenerate | |||||
| // if the implementation classes don;t exist regenerate | |||||
| if (!ejbImplentationClass.exists() || !homeImplementationClass.exists() || | if (!ejbImplentationClass.exists() || !homeImplementationClass.exists() || | ||||
| !beanStubClass.exists()) { | !beanStubClass.exists()) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| // Is the ser file or any of the source files newer then the class files. | // Is the ser file or any of the source files newer then the class files. | ||||
| // firstly find the oldest of the two class files. | // firstly find the oldest of the two class files. | ||||
| long classModificationTime = ejbImplentationClass.lastModified(); | long classModificationTime = ejbImplentationClass.lastModified(); | ||||
| @@ -211,14 +211,14 @@ public class EjbcHelper { | |||||
| if (beanStubClass.lastModified() < classModificationTime) { | if (beanStubClass.lastModified() < classModificationTime) { | ||||
| classModificationTime = beanStubClass.lastModified(); | classModificationTime = beanStubClass.lastModified(); | ||||
| } | } | ||||
| if (descriptorFile.lastModified() > classModificationTime || | if (descriptorFile.lastModified() > classModificationTime || | ||||
| homeInterfaceSource.lastModified() > classModificationTime || | homeInterfaceSource.lastModified() > classModificationTime || | ||||
| remoteInterfaceSource.lastModified() > classModificationTime) { | remoteInterfaceSource.lastModified() > classModificationTime) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| if (primaryKeyClassSource != null && | |||||
| if (primaryKeyClassSource != null && | |||||
| primaryKeyClassSource.lastModified() > classModificationTime) { | primaryKeyClassSource.lastModified() > classModificationTime) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -231,20 +231,20 @@ public class EjbcHelper { | |||||
| fis.close(); | fis.close(); | ||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| /** | /** | ||||
| * Process the descriptors in turn generating support classes for each and a manifest | * Process the descriptors in turn generating support classes for each and a manifest | ||||
| * file for all of the beans. | * file for all of the beans. | ||||
| */ | |||||
| */ | |||||
| private void process() throws Exception { | private void process() throws Exception { | ||||
| String manifest = "Manifest-Version: 1.0\n\n"; | String manifest = "Manifest-Version: 1.0\n\n"; | ||||
| for (int i = 0; i < descriptors.length; ++i) { | for (int i = 0; i < descriptors.length; ++i) { | ||||
| String descriptorName = descriptors[i]; | String descriptorName = descriptors[i]; | ||||
| File descriptorFile = new File(descriptorDirectory, descriptorName); | File descriptorFile = new File(descriptorDirectory, descriptorName); | ||||
| if (isRegenRequired(descriptorFile)) { | if (isRegenRequired(descriptorFile)) { | ||||
| System.out.println("Running ejbc for " + descriptorFile.getName()); | System.out.println("Running ejbc for " + descriptorFile.getName()); | ||||
| regenerateSupportClasses(descriptorFile); | regenerateSupportClasses(descriptorFile); | ||||
| @@ -253,26 +253,26 @@ public class EjbcHelper { | |||||
| } | } | ||||
| manifest += "Name: " + descriptorName.replace('\\', '/') + "\nEnterprise-Bean: True\n\n"; | manifest += "Name: " + descriptorName.replace('\\', '/') + "\nEnterprise-Bean: True\n\n"; | ||||
| } | } | ||||
| FileWriter fw = new FileWriter(manifestFile); | FileWriter fw = new FileWriter(manifestFile); | ||||
| PrintWriter pw = new PrintWriter(fw); | PrintWriter pw = new PrintWriter(fw); | ||||
| pw.print(manifest); | pw.print(manifest); | ||||
| fw.flush(); | fw.flush(); | ||||
| fw.close(); | fw.close(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Perform the weblogic.ejbc call to regenerate the support classes. | * Perform the weblogic.ejbc call to regenerate the support classes. | ||||
| * | * | ||||
| * Note that this method relies on an undocumented -noexit option to the | |||||
| * Note that this method relies on an undocumented -noexit option to the | |||||
| * ejbc tool to stop the ejbc tool exiting the VM altogether. | * ejbc tool to stop the ejbc tool exiting the VM altogether. | ||||
| */ | */ | ||||
| private void regenerateSupportClasses(File descriptorFile) throws Exception { | private void regenerateSupportClasses(File descriptorFile) throws Exception { | ||||
| // create a Java task to do the rebuild | // create a Java task to do the rebuild | ||||
| String[] args = getCommandLine(false, descriptorFile); | String[] args = getCommandLine(false, descriptorFile); | ||||
| try { | try { | ||||
| weblogic.ejbc.main(args); | weblogic.ejbc.main(args); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -68,7 +68,7 @@ public class InnerClassFilenameFilter implements FilenameFilter { | |||||
| } | } | ||||
| public boolean accept (File Dir, String filename){ | 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; | ||||
| } | } | ||||
| @@ -83,7 +83,7 @@ public class JbossDeploymentTool extends GenericDeploymentTool { | |||||
| public void setSuffix(String inString) { | public void setSuffix(String inString) { | ||||
| jarSuffix = inString; | jarSuffix = inString; | ||||
| } | } | ||||
| /** | /** | ||||
| * 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. | ||||
| @@ -579,9 +579,9 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||||
| javaTask.createArg().setValue("-keepgenerated"); | javaTask.createArg().setValue("-keepgenerated"); | ||||
| } | } | ||||
| if (compiler == null) { | if (compiler == null) { | ||||
| // try to use the compiler specified by build.compiler. | |||||
| // try to use the compiler specified by build.compiler. | |||||
| // Right now we are just going to allow Jikes | // Right now we are just going to allow Jikes | ||||
| String buildCompiler | |||||
| String buildCompiler | |||||
| = getTask().getProject().getProperty("build.compiler"); | = getTask().getProject().getProperty("build.compiler"); | ||||
| if (buildCompiler != null && buildCompiler.equals("jikes")) { | if (buildCompiler != null && buildCompiler.equals("jikes")) { | ||||
| @@ -628,7 +628,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| // Have to catch this because of the semantics of calling main() | // Have to catch this because of the semantics of calling main() | ||||
| String msg = "Exception while calling " + ejbcClassName | |||||
| String msg = "Exception while calling " + ejbcClassName | |||||
| + ". Details: " + e.toString(); | + ". Details: " + e.toString(); | ||||
| throw new BuildException(msg, e); | throw new BuildException(msg, e); | ||||
| @@ -65,7 +65,7 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { | |||||
| private String toplinkDescriptor; | private String toplinkDescriptor; | ||||
| private String toplinkDTD; | private String toplinkDTD; | ||||
| /** | /** | ||||
| * Setter used to store the name of the toplink descriptor. | * Setter used to store the name of the toplink descriptor. | ||||
| * @param inString the string to use as the descriptor name. | * @param inString the string to use as the descriptor name. | ||||
| @@ -76,8 +76,8 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { | |||||
| /** | /** | ||||
| * Setter used to store the location of the toplink DTD file. | * Setter used to store the location of the toplink DTD file. | ||||
| * This is expected to be an URL (file or otherwise). If running this on NT using a file URL, the safest | |||||
| * thing would be to not use a drive spec in the URL and make sure the file resides on the drive that | |||||
| * This is expected to be an URL (file or otherwise). If running this on NT using a file URL, the safest | |||||
| * thing would be to not use a drive spec in the URL and make sure the file resides on the drive that | |||||
| * ANT is running from. This will keep the setting in the build XML platform independent. | * ANT is running from. This will keep the setting in the build XML platform independent. | ||||
| * @param inString the string to use as the DTD location. | * @param inString the string to use as the DTD location. | ||||
| */ | */ | ||||
| @@ -94,11 +94,11 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { | |||||
| handler.registerDTD("-//The Object People, Inc.//DTD TOPLink for WebLogic CMP 2.5.1//EN", | handler.registerDTD("-//The Object People, Inc.//DTD TOPLink for WebLogic CMP 2.5.1//EN", | ||||
| TL_DTD_LOC); | TL_DTD_LOC); | ||||
| } | } | ||||
| return handler; | |||||
| return handler; | |||||
| } | } | ||||
| /** | /** | ||||
| * 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. | ||||
| */ | */ | ||||
| protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) { | protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) { | ||||
| @@ -109,16 +109,16 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { | |||||
| File toplinkDD = new File(getConfig().descriptorDir, ddPrefix + toplinkDescriptor); | File toplinkDD = new File(getConfig().descriptorDir, ddPrefix + toplinkDescriptor); | ||||
| if (toplinkDD.exists()) { | if (toplinkDD.exists()) { | ||||
| ejbFiles.put(META_DIR + toplinkDescriptor, | ejbFiles.put(META_DIR + toplinkDescriptor, | ||||
| toplinkDD); | toplinkDD); | ||||
| } else { | } else { | ||||
| log("Unable to locate toplink deployment descriptor. It was expected to be in " + | |||||
| log("Unable to locate toplink deployment descriptor. It was expected to be in " + | |||||
| toplinkDD.getPath(), Project.MSG_WARN); | toplinkDD.getPath(), Project.MSG_WARN); | ||||
| } | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| * Called to validate that the tool parameters have been configured. | * Called to validate that the tool parameters have been configured. | ||||
| * | * | ||||
| @@ -126,7 +126,7 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { | |||||
| public void validateConfigured() throws BuildException { | public void validateConfigured() throws BuildException { | ||||
| super.validateConfigured(); | super.validateConfigured(); | ||||
| if (toplinkDescriptor == null) { | if (toplinkDescriptor == null) { | ||||
| throw new BuildException("The toplinkdescriptor attribute must " | |||||
| throw new BuildException("The toplinkdescriptor attribute must " | |||||
| + "be specified"); | + "be specified"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -216,10 +216,9 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| * Executes the task. <br> | * Executes the task. <br> | ||||
| * Builds a command line to execute ss.exe and then calls Exec's run method | * Builds a command line to execute ss.exe and then calls Exec's run method | ||||
| * to execute the command line. | * to execute the command line. | ||||
| * @throws BuildException | |||||
| * @throws BuildException if the command cannot execute. | |||||
| */ | */ | ||||
| public void execute() | |||||
| throws BuildException { | |||||
| public void execute() throws BuildException { | |||||
| int result = 0; | int result = 0; | ||||
| Commandline commandLine = buildCmdLine(); | Commandline commandLine = buildCmdLine(); | ||||
| result = run(commandLine); | result = run(commandLine); | ||||
| @@ -377,17 +376,15 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| * @return An empty string if label is not set. | * @return An empty string if label is not set. | ||||
| */ | */ | ||||
| protected String getLabel() { | protected String getLabel() { | ||||
| if (m_Label != null && m_Label.length()>0) { | |||||
| if (m_Label != null && m_Label.length() > 0) { | |||||
| if (m_Label.length() > 31) { | if (m_Label.length() > 31) { | ||||
| String label = m_Label.substring(0, 30); | String label = m_Label.substring(0, 30); | ||||
| log("Label is longer than 31 characters, truncated to: " + label, Project.MSG_WARN); | log("Label is longer than 31 characters, truncated to: " + label, Project.MSG_WARN); | ||||
| return FLAG_LABEL + label; | return FLAG_LABEL + label; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| return FLAG_LABEL + m_Label; | return FLAG_LABEL + m_Label; | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| return ""; | return ""; | ||||
| } | } | ||||
| } | } | ||||
| @@ -410,15 +407,13 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| protected String getVersionDateLabel() { | protected String getVersionDateLabel() { | ||||
| if (m_Version != null) { | if (m_Version != null) { | ||||
| return FLAG_VERSION + m_Version; | return FLAG_VERSION + m_Version; | ||||
| } | |||||
| else if (m_Date != null) { | |||||
| } else if (m_Date != null) { | |||||
| return FLAG_VERSION_DATE + m_Date; | return FLAG_VERSION_DATE + m_Date; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // Use getLabel() so labels longer then 30 char are truncated | // Use getLabel() so labels longer then 30 char are truncated | ||||
| // and the user is warned | // and the user is warned | ||||
| String label = getLabel(); | String label = getLabel(); | ||||
| if (! label.equals("") && label!=null) { | |||||
| if (!label.equals("") && label != null) { | |||||
| return FLAG_VERSION_LABEL + label; | return FLAG_VERSION_LABEL + label; | ||||
| } | } | ||||
| } | } | ||||
| @@ -447,9 +442,9 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| } else { | } else { | ||||
| // make sure m_LocalDir exists, create it if it doesn't | // make sure m_LocalDir exists, create it if it doesn't | ||||
| File dir = getProject().resolveFile(m_LocalPath); | File dir = getProject().resolveFile(m_LocalPath); | ||||
| if (! dir.exists()) { | |||||
| if (!dir.exists()) { | |||||
| boolean done = dir.mkdirs(); | boolean done = dir.mkdirs(); | ||||
| if (! done) { | |||||
| if (!done) { | |||||
| String msg = "Directory " + m_LocalPath + " creation was not " | String msg = "Directory " + m_LocalPath + " creation was not " | ||||
| + "successful for an unknown reason"; | + "successful for an unknown reason"; | ||||
| throw new BuildException(msg, getLocation()); | throw new BuildException(msg, getLocation()); | ||||
| @@ -593,7 +588,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| * @return An empty string if get local copy is true. | * @return An empty string if get local copy is true. | ||||
| */ | */ | ||||
| protected String getGetLocalCopy() { | protected String getGetLocalCopy() { | ||||
| return (! m_getLocalCopy) ? FLAG_NO_GET : ""; | |||||
| return (!m_getLocalCopy) ? FLAG_NO_GET : ""; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -618,14 +613,11 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| public String getFileTimeStamp() { | public String getFileTimeStamp() { | ||||
| if (m_timestamp == null) { | if (m_timestamp == null) { | ||||
| return ""; | return ""; | ||||
| } | |||||
| else if (m_timestamp.getValue().equals(TIME_MODIFIED)) { | |||||
| } else if (m_timestamp.getValue().equals(TIME_MODIFIED)) { | |||||
| return FLAG_FILETIME_MODIFIED; | return FLAG_FILETIME_MODIFIED; | ||||
| } | |||||
| else if (m_timestamp.getValue().equals(TIME_UPDATED)) { | |||||
| } else if (m_timestamp.getValue().equals(TIME_UPDATED)) { | |||||
| return FLAG_FILETIME_UPDATED; | return FLAG_FILETIME_UPDATED; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| return FLAG_FILETIME_DEF; | return FLAG_FILETIME_DEF; | ||||
| } | } | ||||
| } | } | ||||
| @@ -638,17 +630,14 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| public String getWritableFiles() { | public String getWritableFiles() { | ||||
| if (m_writablefiles == null) { | if (m_writablefiles == null) { | ||||
| return ""; | return ""; | ||||
| } | |||||
| else if (m_writablefiles.getValue().equals(WRITABLE_REPLACE)) { | |||||
| } else if (m_writablefiles.getValue().equals(WRITABLE_REPLACE)) { | |||||
| return FLAG_REPLACE_WRITABLE; | return FLAG_REPLACE_WRITABLE; | ||||
| } | |||||
| else if (m_writablefiles.getValue().equals(WRITABLE_SKIP)) { | |||||
| } else if (m_writablefiles.getValue().equals(WRITABLE_SKIP)) { | |||||
| // ss.exe exits with '100', when files have been skipped | // ss.exe exits with '100', when files have been skipped | ||||
| // so we have to ignore the failure | // so we have to ignore the failure | ||||
| m_FailOnError = false; | m_FailOnError = false; | ||||
| return FLAG_SKIP_WRITABLE; | return FLAG_SKIP_WRITABLE; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| return ""; | return ""; | ||||
| } | } | ||||
| } | } | ||||
| @@ -741,7 +730,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| * @return The values. | * @return The values. | ||||
| */ | */ | ||||
| public String[] getValues() { | public String[] getValues() { | ||||
| return new String[] { TIME_CURRENT, TIME_MODIFIED, TIME_UPDATED }; | |||||
| return new String[] {TIME_CURRENT, TIME_MODIFIED, TIME_UPDATED}; | |||||
| } | } | ||||
| } | } | ||||
| @@ -754,7 +743,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| * @return The values. | * @return The values. | ||||
| */ | */ | ||||
| public String[] getValues() { | public String[] getValues() { | ||||
| return new String[] { WRITABLE_REPLACE, WRITABLE_SKIP, WRITABLE_FAIL }; | |||||
| return new String[] {WRITABLE_REPLACE, WRITABLE_SKIP, WRITABLE_FAIL}; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -137,7 +137,7 @@ public class MSVSSADD extends MSVSS { | |||||
| * | * | ||||
| * @param response The auto response value. | * @param response The auto response value. | ||||
| */ | */ | ||||
| public void setAutoresponse(String response){ | |||||
| public void setAutoresponse(String response) { | |||||
| super.setInternalAutoResponse(response); | super.setInternalAutoResponse(response); | ||||
| } | } | ||||
| @@ -166,7 +166,7 @@ public class MSVSSCHECKOUT extends MSVSS { | |||||
| * | * | ||||
| * @param response The auto response value. | * @param response The auto response value. | ||||
| */ | */ | ||||
| public void setAutoresponse(String response){ | |||||
| public void setAutoresponse(String response) { | |||||
| super.setInternalAutoResponse(response); | super.setInternalAutoResponse(response); | ||||
| } | } | ||||
| @@ -175,7 +175,7 @@ public class MSVSSCHECKOUT extends MSVSS { | |||||
| * | * | ||||
| * @param timestamp The file time stamping behaviour. | * @param timestamp The file time stamping behaviour. | ||||
| */ | */ | ||||
| public void setFileTimeStamp(CurrentModUpdated timestamp){ | |||||
| public void setFileTimeStamp(CurrentModUpdated timestamp) { | |||||
| super.setInternalFileTimeStamp(timestamp); | super.setInternalFileTimeStamp(timestamp); | ||||
| } | } | ||||
| @@ -184,7 +184,7 @@ public class MSVSSGET extends MSVSS { | |||||
| * | * | ||||
| * @param response The auto response value. | * @param response The auto response value. | ||||
| */ | */ | ||||
| public void setAutoresponse(String response){ | |||||
| public void setAutoresponse(String response) { | |||||
| super.setInternalAutoResponse(response); | super.setInternalAutoResponse(response); | ||||
| } | } | ||||