originally written by Wolf Siberski. A similar set of tasks was
contributed by Peter Kelly, and they formed the inspiration
for adding the VAJImport task.
They only work in the IDE, or as a part of a Tool extension.
Created by: Wolf Siberski
Glenn McAllister
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268158 13f79535-47bb-0310-9956-ffa450edef68
master
| @@ -0,0 +1,240 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.ide; | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 1999 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| import org.apache.tools.ant.BuildException; | |||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.types.PatternSet; | |||||
| import com.ibm.ivj.util.base.ExportCodeSpec; | |||||
| import com.ibm.ivj.util.base.IvjException; | |||||
| import com.ibm.ivj.util.base.Package; | |||||
| import java.io.File; | |||||
| import java.util.Vector; | |||||
| import java.util.Enumeration; | |||||
| /** | |||||
| * Export packages from the Visual Age for Java workspace. | |||||
| * The packages are specified similar to all other MatchingTasks. | |||||
| * Since the VA Workspace is not file based, this task is simulating | |||||
| * a directory hierarchy for the workspace: | |||||
| * The 'root' contains all project 'dir's, and the projects contain | |||||
| * their respective package 'dir's. | |||||
| * Example: | |||||
| * <blockquote> | |||||
| * <vajexport destdir="C:/builddir/source"> | |||||
| * <include name="/MyVAProject/org/foo/subsystem1/**" /> | |||||
| * <exclude name="/MyVAProject/org/foo/subsystem1/test/**"/> | |||||
| * </vajexport> | |||||
| * </blockquote> | |||||
| * exports all packages in the project MyVAProject which start with | |||||
| * 'org.foo.subsystem1' except of these starting with | |||||
| * 'org.foo.subsystem1.test'. | |||||
| * | |||||
| * There are flags to choose which items to export: | |||||
| * exportSources: export Java sources | |||||
| * exportResources: export project resources | |||||
| * exportClasses: export class files | |||||
| * exportDebugInfo: export class files with debug info (use with exportClasses) | |||||
| * default is exporting Java files and resources. | |||||
| * | |||||
| * @author Wolf Siberski, TUI Infotec GmbH | |||||
| */ | |||||
| public class VAJExport extends Task { | |||||
| protected File destDir; | |||||
| protected boolean exportSources = true; | |||||
| protected boolean exportResources = true; | |||||
| protected boolean exportClasses = false; | |||||
| protected boolean exportDebugInfo = false; | |||||
| protected boolean useDefaultExcludes = true; | |||||
| protected PatternSet patternSet = new PatternSet(); | |||||
| /** | |||||
| * add a name entry on the exclude list | |||||
| */ | |||||
| public PatternSet.NameEntry createExclude() { | |||||
| return patternSet.createExclude(); | |||||
| } | |||||
| /** | |||||
| * add a name entry on the include list | |||||
| */ | |||||
| public PatternSet.NameEntry createInclude() { | |||||
| return patternSet.createInclude(); | |||||
| } | |||||
| /** | |||||
| * do the export | |||||
| */ | |||||
| public void execute() throws BuildException { | |||||
| // first off, make sure that we've got a destdir | |||||
| if (destDir == null) { | |||||
| throw new BuildException("destdir attribute must be set!"); | |||||
| } | |||||
| VAJWorkspaceScanner ds = this.getWorkspaceScanner(); | |||||
| Package[] packages = ds.getIncludedPackages(); | |||||
| export(packages); | |||||
| } | |||||
| /** | |||||
| * export the array of Packages | |||||
| */ | |||||
| public void export(Package[] packages) { | |||||
| try { | |||||
| String dest = destDir.getAbsolutePath(); | |||||
| log("Exporting " + packages.length + " package(s) to " + dest); | |||||
| for (int i = 0; i < packages.length; i++) { | |||||
| log(" " + packages[i].getName(), Project.MSG_VERBOSE); | |||||
| } | |||||
| ExportCodeSpec exportSpec = new ExportCodeSpec(); | |||||
| exportSpec.setPackages(packages); | |||||
| exportSpec.includeJava(exportSources); | |||||
| exportSpec.includeClass(exportClasses); | |||||
| exportSpec.includeResources(exportResources); | |||||
| exportSpec.includeClassDebugInfo(exportDebugInfo); | |||||
| exportSpec.useSubdirectories(true); | |||||
| exportSpec.overwriteFiles(true); | |||||
| exportSpec.setExportDirectory(dest); | |||||
| VAJUtil.getWorkspace().exportData(exportSpec); | |||||
| } catch (IvjException ex) { | |||||
| throw VAJUtil.createBuildException("Exporting failed!", ex); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Returns the directory scanner needed to access the files to process. | |||||
| */ | |||||
| protected VAJWorkspaceScanner getWorkspaceScanner() { | |||||
| VAJWorkspaceScanner scanner = new VAJWorkspaceScanner(); | |||||
| scanner.setIncludes(patternSet.getIncludePatterns(getProject())); | |||||
| scanner.setExcludes(patternSet.getExcludePatterns(getProject())); | |||||
| if (useDefaultExcludes) | |||||
| scanner.addDefaultExcludes(); | |||||
| scanner.scan(); | |||||
| return scanner; | |||||
| } | |||||
| /** | |||||
| * Sets whether default exclusions should be used or not. | |||||
| * | |||||
| * @param useDefaultExcludes "true"|"on"|"yes" when default exclusions | |||||
| * should be used, "false"|"off"|"no" when they | |||||
| * shouldn't be used. | |||||
| */ | |||||
| public void setDefaultexcludes(boolean useDefaultExcludes) { | |||||
| this.useDefaultExcludes = useDefaultExcludes; | |||||
| } | |||||
| /** | |||||
| * Set the destination directory into which the Java source | |||||
| * files should be compiled. | |||||
| */ | |||||
| public void setDestdir(File destDir) { | |||||
| this.destDir = destDir; | |||||
| } | |||||
| /** | |||||
| * Sets the set of exclude patterns. Patterns may be separated by a comma | |||||
| * or a space. | |||||
| * | |||||
| * @param excludes the string containing the exclude patterns | |||||
| */ | |||||
| public void setExcludes(String excludes) { | |||||
| patternSet.setExcludes(excludes); | |||||
| } | |||||
| /** | |||||
| */ | |||||
| public void setExportClasses(boolean doExport) { | |||||
| exportClasses = doExport; | |||||
| } | |||||
| /** | |||||
| */ | |||||
| public void setExportDebugInfo(boolean doExport) { | |||||
| exportDebugInfo = doExport; | |||||
| } | |||||
| /** | |||||
| */ | |||||
| public void setExportResources(boolean doExport) { | |||||
| exportResources = doExport; | |||||
| } | |||||
| /** | |||||
| */ | |||||
| public void setExportSources(boolean doExport) { | |||||
| exportSources = doExport; | |||||
| } | |||||
| /** | |||||
| * Sets the set of include patterns. Patterns may be separated by a comma | |||||
| * or a space. | |||||
| * | |||||
| * @param includes the string containing the include patterns | |||||
| */ | |||||
| public void setIncludes(String includes) { | |||||
| patternSet.setIncludes(includes); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,322 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.ide; | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 1999 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.BuildException; | |||||
| import org.apache.tools.ant.DirectoryScanner; | |||||
| import org.apache.tools.ant.types.FileSet; | |||||
| import com.ibm.ivj.util.base.ImportCodeSpec; | |||||
| import com.ibm.ivj.util.base.IvjException; | |||||
| import com.ibm.ivj.util.base.Project; | |||||
| import com.ibm.ivj.util.base.ProjectEdition; | |||||
| import com.ibm.ivj.util.base.Type; | |||||
| import java.io.File; | |||||
| import java.util.Vector; | |||||
| import java.util.Enumeration; | |||||
| /** | |||||
| * Import source, class files, and resources to the Visual Age for Java | |||||
| * workspace using FileSets. | |||||
| * <p> | |||||
| * Example: | |||||
| * <pre> | |||||
| * <vajimport project="MyVAProject"> | |||||
| * <fileset dir="src"> | |||||
| * <include name="org/foo/subsystem1/**" /> | |||||
| * <exclude name="/org/foo/subsystem1/test/**" /> | |||||
| * </fileset> | |||||
| * </vajexport> | |||||
| * </pre> | |||||
| * import all source and resource files from the "src" directory | |||||
| * which start with 'org.foo.subsystem1', except of these starting with | |||||
| * 'org.foo.subsystem1.test' into the project MyVAProject. | |||||
| * </p> | |||||
| * <p>If MyVAProject isn't loaded into the Workspace, a new edition is | |||||
| * created in the repository and automatically loaded into the Workspace. | |||||
| * There has to be at least one nested FileSet element. | |||||
| * </p> | |||||
| * <p>There are attributes to choose which items to export: | |||||
| * <table border="1" cellpadding="2" cellspacing="0"> | |||||
| * <tr> | |||||
| * <td valign="top"><b>Attribute</b></td> | |||||
| * <td valign="top"><b>Description</b></td> | |||||
| * <td align="center" valign="top"><b>Required</b></td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td valign="top">project</td> | |||||
| * <td valign="top">the name of the Project to import to</td> | |||||
| * <td align="center" valign="top">Yes</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td valign="top">importSources</td> | |||||
| * <td valign="top">import Java sources, defaults to "yes"</td> | |||||
| * <td align="center" valign="top">No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td valign="top">importResources</td> | |||||
| * <td valign="top">import resource files (anything that doesn't | |||||
| * end with .java or .class), defaults to "yes"</td> | |||||
| * <td align="center" valign="top">No</td> | |||||
| * </tr> | |||||
| * <tr> | |||||
| * <td valign="top">importClasses</td> | |||||
| * <td valign="top">import class files, defaults to "no"</td> | |||||
| * <td align="center" valign="top">No</td> | |||||
| * </tr> | |||||
| * </table> | |||||
| * | |||||
| * @author: Glenn McAllister, inspired by a similar task written by Peter Kelley | |||||
| */ | |||||
| public class VAJImport extends Task { | |||||
| protected Vector filesets = new Vector(); | |||||
| protected boolean importSources = true; | |||||
| protected boolean importResources = true; | |||||
| protected boolean importClasses = false; | |||||
| protected String importProject = null; | |||||
| protected Project vajproject = null; | |||||
| /** | |||||
| * The VisualAge for Java Project name to import into. | |||||
| */ | |||||
| public void setProject(String projectName) { | |||||
| this.importProject = projectName; | |||||
| } | |||||
| /** | |||||
| * Adds a set of files (nested fileset attribute). | |||||
| */ | |||||
| public void addFileset(FileSet set) { | |||||
| filesets.addElement(set); | |||||
| } | |||||
| /** | |||||
| * Import .class files. | |||||
| */ | |||||
| public void setImportClasses(boolean importClasses) { | |||||
| this.importClasses = importClasses; | |||||
| } | |||||
| /** | |||||
| * Import resource files (anything that doesn't end in | |||||
| * .class or .java) | |||||
| */ | |||||
| public void setImportResources(boolean importResources) { | |||||
| this.importResources = importResources; | |||||
| } | |||||
| /** | |||||
| * Import .java files | |||||
| */ | |||||
| public void setImportSources(boolean importSources) { | |||||
| this.importSources = importSources; | |||||
| } | |||||
| /** | |||||
| * Do the import. | |||||
| */ | |||||
| public void execute() throws BuildException { | |||||
| if (filesets.size() == 0) { | |||||
| throw new BuildException("At least one fileset is required!"); | |||||
| } | |||||
| if (importProject == null || "".equals(importProject)) { | |||||
| throw new BuildException("The VisualAge for Java Project name is required!"); | |||||
| } | |||||
| vajproject = getVAJProject(); | |||||
| if (vajproject == null) { | |||||
| try { | |||||
| vajproject = VAJUtil.getWorkspace().createProject(this.importProject, true); | |||||
| } catch (IvjException e) { | |||||
| throw VAJUtil.createBuildException( | |||||
| "Error while creating Project " + importProject + ": ", | |||||
| e); | |||||
| } | |||||
| } | |||||
| for (Enumeration e = filesets.elements(); e.hasMoreElements();) { | |||||
| importFileset((FileSet) e.nextElement()); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Try to get the project we want from the Workspace. | |||||
| */ | |||||
| protected Project getVAJProject() { | |||||
| Project found = null; | |||||
| Project[] currentProjects = VAJUtil.getWorkspace().getProjects(); | |||||
| for (int i = 0; i < currentProjects.length; i++) { | |||||
| Project p = currentProjects[i]; | |||||
| if (p.getName().equals(this.importProject)) { | |||||
| found = p; | |||||
| break; | |||||
| } | |||||
| } | |||||
| return found; | |||||
| } | |||||
| /** | |||||
| * Import all files from the fileset into the Project in the | |||||
| * Workspace. | |||||
| */ | |||||
| protected void importFileset(FileSet fileset) { | |||||
| DirectoryScanner ds = fileset.getDirectoryScanner(this.project); | |||||
| if (ds.getIncludedFiles().length == 0) { | |||||
| return; | |||||
| } | |||||
| Vector classes = new Vector(); | |||||
| Vector sources = new Vector(); | |||||
| Vector resources = new Vector(); | |||||
| String[] classesArr = null; | |||||
| String[] sourcesArr = null; | |||||
| String[] resourcesArr = null; | |||||
| StringBuffer msg = new StringBuffer(); | |||||
| msg.append("Importing "); | |||||
| String connector = ""; | |||||
| ImportCodeSpec importSpec = new ImportCodeSpec(); | |||||
| importSpec.setDefaultProject(vajproject); | |||||
| scan( | |||||
| fileset.getDir(this.project), | |||||
| ds.getIncludedFiles(), | |||||
| classes, | |||||
| sources, | |||||
| resources); | |||||
| if (importClasses) { | |||||
| classesArr = new String[classes.size()]; | |||||
| classes.copyInto(classesArr); | |||||
| importSpec.setClassFiles(classesArr); | |||||
| if (classesArr.length > 0) { | |||||
| msg.append( classesArr.length ); | |||||
| msg.append( " class " ); | |||||
| msg.append( classesArr.length > 1 ? "files" : "file" ); | |||||
| connector = ", "; | |||||
| } | |||||
| } | |||||
| if (importSources) { | |||||
| sourcesArr = new String[sources.size()]; | |||||
| sources.copyInto(sourcesArr); | |||||
| importSpec.setJavaFiles(sourcesArr); | |||||
| if (sourcesArr.length > 0) { | |||||
| msg.append( connector ); | |||||
| msg.append( sourcesArr.length ); | |||||
| msg.append( " source " ); | |||||
| msg.append( sourcesArr.length > 1 ? "files" : "file" ); | |||||
| connector = ", "; | |||||
| } | |||||
| } | |||||
| if (importResources) { | |||||
| resourcesArr = new String[resources.size()]; | |||||
| resources.copyInto(resourcesArr); | |||||
| importSpec.setResourcePath(fileset.getDir(this.project).getAbsolutePath()); | |||||
| importSpec.setResourceFiles(resourcesArr); | |||||
| if (resourcesArr.length > 0) { | |||||
| msg.append( connector ); | |||||
| msg.append( resourcesArr.length ); | |||||
| msg.append( " resource " ); | |||||
| msg.append( resourcesArr.length > 1 ? "files" : "file" ); | |||||
| } | |||||
| } | |||||
| msg.append( " into the " ); | |||||
| msg.append( importProject ); | |||||
| msg.append( " project." ); | |||||
| log(msg.toString()); | |||||
| try { | |||||
| Type[] importedTypes = VAJUtil.getWorkspace().importData(importSpec); | |||||
| if (importedTypes == null) { | |||||
| throw new BuildException("Unable to import into Workspace!"); | |||||
| } | |||||
| } catch (IvjException ivje) { | |||||
| VAJUtil.createBuildException("Error while importing into Workspace: ", ivje); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Sort the files into classes, sources, and resources. | |||||
| */ | |||||
| protected void scan( | |||||
| File dir, | |||||
| String[] files, | |||||
| Vector classes, | |||||
| Vector sources, | |||||
| Vector resources) { | |||||
| for (int i = 0; i < files.length; i++) { | |||||
| String file = (new File(dir, files[i])).getAbsolutePath(); | |||||
| if (file.endsWith(".source") || file.endsWith(".SOURCE")) { | |||||
| sources.addElement(file); | |||||
| } else | |||||
| if (file.endsWith(".class") || file.endsWith(".CLASS")) { | |||||
| classes.addElement(file); | |||||
| } else { | |||||
| resources.addElement(file); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,253 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.ide; | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 1999 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| import org.apache.tools.ant.BuildException; | |||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | |||||
| import com.ibm.ivj.util.base.IvjException; | |||||
| import com.ibm.ivj.util.base.ProjectEdition; | |||||
| import java.util.Vector; | |||||
| import java.util.Enumeration; | |||||
| /** | |||||
| * Load specific project versions into the Visual Age for Java workspace. | |||||
| * Each project and version name has to be specified completely. | |||||
| * Example: | |||||
| * <blockquote> | |||||
| * <vajload> | |||||
| * <project name="MyVAProject" version="2.1"/> | |||||
| * <project name="Apache Xerces" version="1.2.0"/> | |||||
| * </vajload> | |||||
| * </blockquote> | |||||
| * | |||||
| * @author Wolf Siberski, TUI Infotec GmbH | |||||
| */ | |||||
| public class VAJLoadProjects extends Task { | |||||
| Vector projectDescriptions = new Vector(); | |||||
| Vector expandedProjectDescriptions = new Vector(); | |||||
| /** | |||||
| * Class to maintain VisualAge for Java Workspace Project descriptions. | |||||
| */ | |||||
| public class VAJProjectDescription { | |||||
| private String name; | |||||
| private String version; | |||||
| private boolean projectFound; | |||||
| public VAJProjectDescription() { | |||||
| } | |||||
| public VAJProjectDescription(String n, String v) { | |||||
| name = n; | |||||
| version = v; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public String getVersion() { | |||||
| return version; | |||||
| } | |||||
| public boolean projectFound() { | |||||
| return projectFound; | |||||
| } | |||||
| public void setName(String newName) { | |||||
| if (newName == null || newName.equals("")) { | |||||
| throw new BuildException("name attribute must be set"); | |||||
| } | |||||
| name = newName; | |||||
| } | |||||
| public void setVersion(String newVersion) { | |||||
| if (newVersion == null || newVersion.equals("")) { | |||||
| throw new BuildException("version attribute must be set"); | |||||
| } | |||||
| version = newVersion; | |||||
| } | |||||
| public void setProjectFound() { | |||||
| projectFound = true; | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Add a project description entry on the project list. | |||||
| */ | |||||
| public VAJProjectDescription createProject() { | |||||
| VAJProjectDescription d = new VAJProjectDescription(); | |||||
| projectDescriptions.addElement(d); | |||||
| return d; | |||||
| } | |||||
| /** | |||||
| * Load specified projects. | |||||
| */ | |||||
| public void execute() { | |||||
| expandDescriptions(); | |||||
| log( | |||||
| "Loading " + expandedProjectDescriptions.size() + " project(s) into workspace"); | |||||
| for (Enumeration e = expandedProjectDescriptions.elements(); | |||||
| e.hasMoreElements(); | |||||
| ) { | |||||
| VAJProjectDescription d = (VAJProjectDescription) e.nextElement(); | |||||
| ProjectEdition pe = findProjectEdition(d.getName(), d.getVersion()); | |||||
| try { | |||||
| log( | |||||
| "Loading " + d.getName() + ", Version " + d.getVersion() + ", into Workspace", | |||||
| Project.MSG_VERBOSE); | |||||
| pe.loadIntoWorkspace(); | |||||
| } catch (IvjException ex) { | |||||
| throw VAJUtil.createBuildException( | |||||
| "Project " + d.getName() + " could not be loaded.", | |||||
| ex); | |||||
| } | |||||
| } | |||||
| } | |||||
| /** | |||||
| */ | |||||
| public void expandDescriptions() { | |||||
| String[] projectNames; | |||||
| try { | |||||
| projectNames = VAJUtil.getWorkspace().getRepository().getProjectNames(); | |||||
| } catch (IvjException e) { | |||||
| throw VAJUtil.createBuildException("VA Exception occured: ", e); | |||||
| } | |||||
| for (int i = 0; i < projectNames.length; i++) { | |||||
| for (Enumeration e = projectDescriptions.elements(); e.hasMoreElements();) { | |||||
| VAJProjectDescription d = (VAJProjectDescription) e.nextElement(); | |||||
| String pattern = d.getName(); | |||||
| if (VAJWorkspaceScanner.match(pattern, projectNames[i])) { | |||||
| d.setProjectFound(); | |||||
| expandedProjectDescriptions.addElement( | |||||
| new VAJProjectDescription(projectNames[i], d.getVersion())); | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| for (Enumeration e = projectDescriptions.elements(); e.hasMoreElements();) { | |||||
| VAJProjectDescription d = (VAJProjectDescription) e.nextElement(); | |||||
| if (!d.projectFound()) { | |||||
| log("No Projects match the name " + d.getName(), Project.MSG_WARN); | |||||
| } | |||||
| } | |||||
| } | |||||
| /** | |||||
| */ | |||||
| public static Vector findMatchingProjects(String pattern) { | |||||
| String[] projectNames; | |||||
| try { | |||||
| projectNames = VAJUtil.getWorkspace().getRepository().getProjectNames(); | |||||
| } catch (IvjException e) { | |||||
| throw VAJUtil.createBuildException("VA Exception occured: ", e); | |||||
| } | |||||
| Vector matchingProjects = new Vector(); | |||||
| for (int i = 0; i < projectNames.length; i++) { | |||||
| if (VAJWorkspaceScanner.match(pattern, projectNames[i])) { | |||||
| matchingProjects.addElement(projectNames[i]); | |||||
| } | |||||
| } | |||||
| return matchingProjects; | |||||
| } | |||||
| /** | |||||
| * Finds a specific project edition in the repository. | |||||
| * | |||||
| * @param name project name | |||||
| * @param versionName project version name | |||||
| * @return com.ibm.ivj.util.base.ProjectEdition | |||||
| */ | |||||
| public static ProjectEdition findProjectEdition( | |||||
| String name, | |||||
| String versionName) { | |||||
| try { | |||||
| ProjectEdition[] editions = null; | |||||
| editions = VAJUtil.getWorkspace().getRepository().getProjectEditions(name); | |||||
| if (editions == null) { | |||||
| throw new BuildException("Project " + name + " doesn't exist"); | |||||
| } | |||||
| ProjectEdition pe = null; | |||||
| for (int i = 0; i < editions.length && pe == null; i++) { | |||||
| if (versionName.equals(editions[i].getVersionName())) { | |||||
| pe = editions[i]; | |||||
| } | |||||
| } | |||||
| if (pe == null) { | |||||
| throw new BuildException( | |||||
| "Version " + versionName + " of Project " + name + " doesn't exist"); | |||||
| } | |||||
| return pe; | |||||
| } catch (IvjException e) { | |||||
| throw VAJUtil.createBuildException("VA Exception occured: ", e); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,108 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.ide; | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 1999 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| import com.ibm.ivj.util.base.Workspace; | |||||
| import com.ibm.ivj.util.base.ToolEnv; | |||||
| import com.ibm.ivj.util.base.IvjException; | |||||
| import org.apache.tools.ant.BuildException; | |||||
| /** | |||||
| * Helper class for VAJ tasks. Holds Workspace singleton and | |||||
| * wraps IvjExceptions into BuildExceptions | |||||
| * | |||||
| * @author Wolf Siberski, TUI Infotec GmbH | |||||
| */ | |||||
| class VAJUtil { | |||||
| static private Workspace workspace; | |||||
| /** | |||||
| * Wraps IvjException into a BuildException | |||||
| * | |||||
| * @return org.apache.tools.ant.BuildException | |||||
| * @param errMsg Additional error message | |||||
| * @param e IvjException which is wrapped | |||||
| */ | |||||
| public static BuildException createBuildException( | |||||
| String errMsg, | |||||
| IvjException e) { | |||||
| errMsg = errMsg + "\n" + e.getMessage(); | |||||
| String[] errors = e.getErrors(); | |||||
| if (errors != null) { | |||||
| for (int i = 0; i < errors.length; i++) { | |||||
| errMsg = errMsg + "\n" + errors[i]; | |||||
| } | |||||
| } | |||||
| return new BuildException(errMsg); | |||||
| } | |||||
| /** | |||||
| * Insert the method's description here. | |||||
| * Creation date: (19.09.2000 13:41:21) | |||||
| * @return com.ibm.ivj.util.base.Workspace | |||||
| */ | |||||
| public static Workspace getWorkspace() { | |||||
| if (workspace == null) { | |||||
| workspace = ToolEnv.connectToWorkspace(); | |||||
| if (workspace == null) { | |||||
| throw new BuildException( | |||||
| "Unable to connect to Workspace! " | |||||
| + "Make sure you are running in VisualAge for Java."); | |||||
| } | |||||
| } | |||||
| return workspace; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,249 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.ide; | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 1999 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| import org.apache.tools.ant.DirectoryScanner; | |||||
| import com.ibm.ivj.util.base.IvjException; | |||||
| import com.ibm.ivj.util.base.Package; | |||||
| import com.ibm.ivj.util.base.Project; | |||||
| import java.util.Enumeration; | |||||
| import java.util.Vector; | |||||
| import java.util.StringTokenizer; | |||||
| import java.io.File; | |||||
| /** | |||||
| * Class for scanning a Visual Age for Java workspace for packages matching | |||||
| * a certain criteria. | |||||
| * <p> | |||||
| * These criteria consist of a set of include and exclude patterns. With these | |||||
| * patterns, you can select which packages you want to have included, and which | |||||
| * packages you want to have excluded. You can add patterns to be excluded by | |||||
| * default with the addDefaultExcludes method. The patters that are excluded | |||||
| * by default include | |||||
| * <ul> | |||||
| * <li>IBM*\**</li> | |||||
| * <li>Java class libraries\**</li> | |||||
| * <li>Sun class libraries*\**</li> | |||||
| * <li>JSP Page Compile Generated Code\**</li> | |||||
| * <li>VisualAge*\**</li> | |||||
| * </ul> | |||||
| * <p> | |||||
| * This class works like DirectoryScanner. | |||||
| * | |||||
| * @see org.apache.tools.ant.DirectoryScanner | |||||
| * | |||||
| * @author Wolf Siberski, TUI Infotec (based on Arnout J. Kuipers DirectoryScanner) | |||||
| */ | |||||
| public class VAJWorkspaceScanner extends DirectoryScanner { | |||||
| /** | |||||
| * Patterns that should be excluded by default. | |||||
| * | |||||
| * @see #addDefaultExcludes() | |||||
| */ | |||||
| private final static String[] DEFAULTEXCLUDES = | |||||
| { | |||||
| "IBM*/**", | |||||
| "Java class libraries/**", | |||||
| "Sun class libraries*/**", | |||||
| "JSP Page Compile Generated Code/**", | |||||
| "VisualAge*/**", | |||||
| }; | |||||
| /** | |||||
| * The packages that where found and matched at least one includes, and | |||||
| * matched no excludes. | |||||
| */ | |||||
| private Vector packagesIncluded = new Vector(); | |||||
| /** | |||||
| * Adds the array with default exclusions to the current exclusions set. | |||||
| */ | |||||
| public void addDefaultExcludes() { | |||||
| int excludesLength = excludes == null ? 0 : excludes.length; | |||||
| String[] newExcludes; | |||||
| newExcludes = new String[excludesLength + DEFAULTEXCLUDES.length]; | |||||
| if (excludesLength > 0) { | |||||
| System.arraycopy(excludes, 0, newExcludes, 0, excludesLength); | |||||
| } | |||||
| for (int i = 0; i < DEFAULTEXCLUDES.length; i++) { | |||||
| newExcludes[i + excludesLength] = | |||||
| DEFAULTEXCLUDES[i].replace('/', File.separatorChar).replace( | |||||
| '\\', | |||||
| File.separatorChar); | |||||
| } | |||||
| excludes = newExcludes; | |||||
| } | |||||
| /** | |||||
| * Finds all Projects specified in include patterns. | |||||
| * | |||||
| * @return the projects | |||||
| */ | |||||
| public Vector findMatchingProjects() { | |||||
| Project[] projects = VAJUtil.getWorkspace().getProjects(); | |||||
| Vector matchingProjects = new Vector(); | |||||
| boolean allProjectsMatch = false; | |||||
| for (int i = 0; i < projects.length; i++) { | |||||
| Project project = projects[i]; | |||||
| for (int j = 0; j < includes.length && !allProjectsMatch; j++) { | |||||
| StringTokenizer tok = new StringTokenizer(includes[j], File.separator); | |||||
| String projectNamePattern = tok.nextToken(); | |||||
| if (projectNamePattern.equals("**")) { | |||||
| // if an include pattern starts with '**', | |||||
| // all projects match | |||||
| allProjectsMatch = true; | |||||
| } else | |||||
| if (match(projectNamePattern, project.getName())) { | |||||
| matchingProjects.addElement(project); | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| if (allProjectsMatch) { | |||||
| matchingProjects = new Vector(); | |||||
| for (int i = 0; i < projects.length; i++) { | |||||
| matchingProjects.addElement(projects[i]); | |||||
| } | |||||
| } | |||||
| return matchingProjects; | |||||
| } | |||||
| /** | |||||
| * Get the names of the packages that matched at least one of the include | |||||
| * patterns, and didn't match one of the exclude patterns. | |||||
| * | |||||
| * @return the matching packages | |||||
| */ | |||||
| public Package[] getIncludedPackages() { | |||||
| int count = packagesIncluded.size(); | |||||
| Package[] packages = new Package[count]; | |||||
| for (int i = 0; i < count; i++) { | |||||
| packages[i] = (Package) packagesIncluded.elementAt(i); | |||||
| } | |||||
| return packages; | |||||
| } | |||||
| /** | |||||
| * Matches a string against a pattern. The pattern contains two special | |||||
| * characters: | |||||
| * '*' which means zero or more characters, | |||||
| * '?' which means one and only one character. | |||||
| * | |||||
| * @param pattern the (non-null) pattern to match against | |||||
| * @param str the (non-null) string that must be matched against the | |||||
| * pattern | |||||
| * | |||||
| * @return <code>true</code> when the string matches against the pattern, | |||||
| * <code>false</code> otherwise. | |||||
| */ | |||||
| protected static boolean match(String pattern, String str) { | |||||
| return DirectoryScanner.match(pattern, str); | |||||
| } | |||||
| /** | |||||
| * Scans the workspace for packages that match at least one include | |||||
| * pattern, and don't match any exclude patterns. | |||||
| * | |||||
| */ | |||||
| public void scan() { | |||||
| if (includes == null) { | |||||
| // No includes supplied, so set it to 'matches all' | |||||
| includes = new String[1]; | |||||
| includes[0] = "**"; | |||||
| } | |||||
| if (excludes == null) { | |||||
| excludes = new String[0]; | |||||
| } | |||||
| // only scan projects which are included in at least one include pattern | |||||
| Vector matchingProjects = findMatchingProjects(); | |||||
| for (Enumeration e = matchingProjects.elements(); e.hasMoreElements();) { | |||||
| Project project = (Project) e.nextElement(); | |||||
| scanProject(project); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Scans a project for packages that match at least one include | |||||
| * pattern, and don't match any exclude patterns. | |||||
| * | |||||
| */ | |||||
| public void scanProject(Project project) { | |||||
| try { | |||||
| Package[] packages = project.getPackages(); | |||||
| if (packages != null) { | |||||
| for (int i = 0; i < packages.length; i++) { | |||||
| Package item = packages[i]; | |||||
| // replace '.' by file seperator because the patterns are | |||||
| // using file seperator syntax (and we can use the match | |||||
| // methods this way). | |||||
| String name = | |||||
| project.getName() | |||||
| + File.separator | |||||
| + item.getName().replace('.', File.separatorChar); | |||||
| if (isIncluded(name) && !isExcluded(name)) { | |||||
| packagesIncluded.addElement(item); | |||||
| } | |||||
| } | |||||
| } | |||||
| } catch (IvjException e) { | |||||
| throw VAJUtil.createBuildException("VA Exception occured: ", e); | |||||
| } | |||||
| } | |||||
| } | |||||