[jboss-cvs] jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model ...

Robert Stryker rob.stryker at jboss.com
Wed Apr 18 17:07:53 EDT 2007


  User: rawb    
  Date: 07/04/18 17:07:53

  Added:       core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model          
                        IArchiveNodeDelta.java DirectoryScannerFactory.java
                        IArchiveNode.java IArchiveNodeVisitor.java
                        PackagesCore.java IArchive.java
                        IPackagesBuildListener.java IArchiveFileSet.java
                        IArchiveModelListener.java IArchiveFolder.java
  Log:
  Given it's own module under the new name
  
  Revision  Changes    Path
  1.1      date: 2007/04/18 21:07:53;  author: rawb;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeDelta.java
  
  Index: IArchiveNodeDelta.java
  ===================================================================
  package org.jboss.ide.eclipse.archives.core.model;
  
  
  
  public interface IArchiveNodeDelta {
  	
  	/**
  	 * There is no change to this node or any of it's children
  	 */
  	public static final int NO_CHANGE = 0;
  		
  	/**
  	 * I have been added
  	 */
  	public static final int ADDED = 0x1;
  	
  	/**
  	 * I have been removed
  	 */
  	public static final int REMOVED	= 0x2;
  	
  	
  	
  	/**
  	 * Used to designate that a sub-property within 
  	 * a <property> tag has been added.
  	 */
  	public static final int PROPERTY_ADDED = 0x10;
  	
  	/**
  	 * Used to designate that a sub-property within 
  	 * a <property> tag has been removed.
  	 */
  	public static final int PROPERTY_REMOVED = 0x20;
  	
  	/**
  	 * Used to designate that a sub-property within 
  	 * a <property> tag has been changed.
  	 */
  	public static final int PROPERTY_CHANGED = 0x40;
  	
  	/**
  	 * Used to designate that an primary property of the node, 
  	 * such as inWorkspace or exploded, has changed. 
  	 */
  	public static final int ATTRIBUTE_CHANGED = 0x80;
  	
  	/**
  	 * A child has been added directly to me
  	 */
  	public static final int CHILD_ADDED		= 0x100;
  	
  	/**
  	 * A child has been removed directly from me
  	 */
  	public static final int CHILD_REMOVED	= 0x200;
  	
  	/**
  	 * Some other change has occurred, most likely a 
  	 * grand-child added or a child's property changed.
  	 */
  	public static final int DESCENDENT_CHANGED 	= 0x400;
  	
  	/**
  	 * Return the delta kind
  	 * @return
  	 */
  	public int getKind();
  
  	/**
  	 * Return the affected node after changes
  	 * @return
  	 */
  	public IArchiveNode getPostNode();
  	
  	/**
  	 * Return the affected node before changes
  	 * @return
  	 */
  	public IArchiveNode getPreNode();
  	
  	/**
  	 * Get the children that have also been changed
  	 * @return
  	 */
  	public IArchiveNodeDelta[] getAffectedChildren();
  	
  	public String[] getPropertiesWithDeltas();
  	public INodeDelta getPropertyDelta(String key);
  	
  	public String[] getAttributesWithDeltas();
  	public INodeDelta getAttributeDelta(String key);
  	
  	public IArchiveNodeDelta[] getAddedChildrenDeltas();
  	public IArchiveNodeDelta[] getRemovedChildrenDeltas();
  	
  	
  	
  	public interface INodeDelta {
  		public Object getBefore();
  		public Object getAfter();
  		public int getKind();
  	}
  	
  }
  
  
  
  1.1      date: 2007/04/18 21:07:53;  author: rawb;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
  
  Index: DirectoryScannerFactory.java
  ===================================================================
  /**
   * JBoss, a Division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
  * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.archives.core.model;
  
  import java.io.File;
  
  import org.apache.tools.ant.DirectoryScanner;
  import org.eclipse.core.runtime.IPath;
  
  /**
   *
   * @author rob.stryker at jboss.com
   */
  public class DirectoryScannerFactory {
  
  	public static DirectoryScannerExtension createDirectoryScanner (IPath filesystemFolder, String includes, String excludes, boolean scan) {
  		if (includes == null) includes = "";
  		if (excludes == null) excludes = "";
  		
  		DirectoryScannerExtension scanner = new DirectoryScannerExtension();
  		String excludesList[] = excludes.split(" ?, ?");
  		String includesList[] = includes.split(" ?, ?");
  		
  		File basedir = filesystemFolder.toFile();	
  		scanner.setBasedir(basedir);
  		scanner.setExcludes(excludesList);
  		scanner.setIncludes(includesList);
  		if (scan)
  			scanner.scan();
  		
  		return scanner;
  	}
  	
  	public static class DirectoryScannerExtension extends DirectoryScanner {
  	    public boolean isIncluded(String name) {
  	    	return super.isIncluded(name);
  	    }
  	}
  }
  
  
  
  1.1      date: 2007/04/18 21:07:53;  author: rawb;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNode.java
  
  Index: IArchiveNode.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.archives.core.model;
  
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.runtime.IAdaptable;
  import org.eclipse.core.runtime.IPath;
  
  /**
   * The super type of all package nodes (IPackage, IPackageFileSet, IPackageFolder)
   * 
   * Each node in a package may have arbitrary properties that can be reflected upon by other plug-ins
   * 
   * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
   * @version $Revision: 1.1 $
   */
  public interface IArchiveNode extends IAdaptable {
  	/**
  	 * The node type that represents the model
  	 */
  	public static final int TYPE_MODEL = -1;
  
  	/**
  	 * The node type that represents an IPackage
  	 */
  	public static final int TYPE_ARCHIVE = 0;
  	
  	/**
  	 * The node type that represents an IPackageReference
  	 */
  	public static final int TYPE_ARCHIVE_REFERENCE = 1;
  	
  	/**
  	 * The node type that represents an IPackageFileSet
  	 */
  	public static final int TYPE_ARCHIVE_FILESET = 2;
  	
  	/**
  	 * The node type that represents an IPackageFolder
  	 */
  	public static final int TYPE_ARCHIVE_FOLDER = 3;
  	
  	/**
  	 * @return The parent of this package node, or null if this node is top level
  	 */
  	public IArchiveNode getParent();
  	
  	/**
  	 * Set the parent of this package node 
  	 * @param parent The new parent of this node
  	 */
  	public void setParent(IArchiveNode parent);
  	
  	/**
  	 * @param type TYPE_PACKAGE, TYPE_PACKAGE_FILESET, or TYPE_PACKAGE_FOLDER
  	 * @return An array of child nodes of the passed in type
  	 */
  	public IArchiveNode[] getChildren(int type);
  	
  	/**
  	 * @return An array of all children nodes
  	 */
  	public IArchiveNode[] getAllChildren();
  	
  	/**
  	 * @return Whether or not this node has children
  	 */
  	public boolean hasChildren();
  	
  	/**
  	 * @param child A possible child node
  	 * @return Whether or not the passed-in node is a child of this node
  	 */
  	public boolean hasChild(IArchiveNode child);
  	
  	/**
  	 * @return The type of this package node
  	 */
  	public int getNodeType();
  	
  	/**
  	 * @param property The name of the property to fetch
  	 * @return The value of the specified property
  	 */
  	public String getProperty(String property);
  	
  	/**
  	 * Set a property on this package node
  	 * @param property The name of the property to set
  	 * @param value The new value of the property
  	 */
  	public void setProperty(String property, String value);
  	
  	/**
  	 * @return The project that this node is defined in (not necessarily the project where this is based if this is a fileset)
  	 */
  	public IProject getProject();
  	
  	/**
  	 * Recursively visit the package node tree below this node with the passed-in package node visitor.
  	 * @param visitor A package node visitor
  	 * @return Whether or not the entire sub-tree was visited
  	 */
  	public boolean accept(IArchiveNodeVisitor visitor);
  	
  	/**
  	 * Recursively visit the package node tree below this node with the passed-in package node visitor, using depth-first ordering
  	 * @param visitor A package node visitor
  	 * @return Whether or not the entire sub-tree was visited
  	 */
  	public boolean accept(IArchiveNodeVisitor visitor, boolean depthFirst);
  	
  	/**
  	 * Add a child node to this node
  	 * @param child The child to add
  	 */
  	public void addChild(IArchiveNode child);
  	
  	/**
  	 * Remove a child node from this node
  	 * @param child The child to remove
  	 */
  	public void removeChild(IArchiveNode child);
  	
  	/**
  	 * Get the highest parent that is not null. 
  	 * It should be an instance of PackageModelNode 
  	 * @return
  	 */
  	public IArchiveNode getRoot();
  	
  	/**
  	 * Is the root of this node a PackageModelNode and registered in PackagesModel?
  	 * @return
  	 */
  	public boolean connectedToModel();
  	
  	/**
  	 * Get the path relative to the root archive
  	 * @return
  	 */
  	public IPath getRootArchiveRelativePath();
  	
  	/**
  	 * Get the root top-level package for this node
  	 * @return
  	 */
  	public IArchive getRootArchive();
  	/**
  	 * Get the delta
  	 * @return
  	 */
  	public IArchiveNodeDelta getDelta();
  }
  
  
  
  1.1      date: 2007/04/18 21:07:53;  author: rawb;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNodeVisitor.java
  
  Index: IArchiveNodeVisitor.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.archives.core.model;
  
  public interface IArchiveNodeVisitor {
  
  	public boolean visit (IArchiveNode node);
  }
  
  
  
  1.1      date: 2007/04/18 21:07:53;  author: rawb;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/PackagesCore.java
  
  Index: PackagesCore.java
  ===================================================================
  package org.jboss.ide.eclipse.archives.core.model;
  
  import java.util.ArrayList;
  import java.util.Arrays;
  
  import org.apache.tools.ant.DirectoryScanner;
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.resources.IncrementalProjectBuilder;
  import org.eclipse.core.resources.ResourcesPlugin;
  import org.eclipse.core.runtime.IPath;
  import org.eclipse.core.runtime.IProgressMonitor;
  import org.eclipse.core.runtime.NullProgressMonitor;
  import org.eclipse.core.runtime.Path;
  import org.jboss.ide.eclipse.archives.core.ExtensionManager;
  import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
  import org.jboss.ide.eclipse.archives.core.build.ModelChangeListener;
  import org.jboss.ide.eclipse.archives.core.model.internal.ArchivesModel;
  import org.jboss.ide.eclipse.archives.core.model.types.IArchiveType;
  
  public class PackagesCore {
  	private static PackagesCore instance;
  	public static PackagesCore getInstance() {
  		if( instance == null ) 
  			instance = new PackagesCore();
  		return instance;
  	}
  	
  	private ArrayList buildListeners;
  	private ArrayList modelListeners;
  	public PackagesCore() {
  		buildListeners = new ArrayList();
  		modelListeners = new ArrayList();
  		addModelListener(new ModelChangeListener());
  	}
  	
  	public void addBuildListener(IPackagesBuildListener listener) {
  		if( !buildListeners.contains(listener)) 
  			buildListeners.add(listener);
  	}
  	public void removeBuildListener(IPackagesBuildListener listener) {
  		if( buildListeners.contains(listener)) 
  			buildListeners.remove(listener);
  	}
  	public IPackagesBuildListener[] getBuildListeners() {
  		return (IPackagesBuildListener[]) buildListeners.toArray(new IPackagesBuildListener[buildListeners.size()]);
  	}
  	
  	public void addModelListener(IArchiveModelListener listener) {
  		if( !modelListeners.contains(listener)) 
  			modelListeners.add(listener);
  	}
  	public void removeModelListener(IArchiveModelListener listener) {
  		if( modelListeners.contains(listener)) 
  			modelListeners.remove(listener);
  	}
  	public IArchiveModelListener[] getModelListeners() {
  		return (IArchiveModelListener[]) modelListeners.toArray(new IArchiveModelListener[modelListeners.size()]);
  	}
  	
  	
  	
  	/**
  	 * Builds all of a project's packages. Note that this does not call any builders before or after the package builder (i.e. the JDT builder).
  	 * If you are looking to run all the builders on a project use project.build()
  	 * @param project The project to build
  	 * @param buildType FULL_BUILD, INCREMENTAL_BUILD, CLEAN_BUILD, etc
  	 * @param monitor A progress monitor
  	 */
  	public static void buildProject (IProject project, IProgressMonitor monitor) {
  		if (monitor == null) monitor = new NullProgressMonitor();
  		new ArchiveBuildDelegate().fullProjectBuild(project);
  	}
  	
  	/**
  	 * Build the passed-in package.
  	 * @param pkg The package to build
  	 */
  	public static void buildArchive (IArchive pkg, IProgressMonitor monitor) {
  		if (monitor == null) monitor = new NullProgressMonitor();
  		new ArchiveBuildDelegate().fullArchiveBuild(pkg);
  	}
  
  	public static IArchive[] getAllProjectPackages(IProgressMonitor monitor) {
  		IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
  		ArrayList results = new ArrayList();
  		for( int i = 0; i < projects.length; i++ ) {
  			if( projects[i].isAccessible()) {
  				results.addAll(Arrays.asList(getProjectPackages(projects[i], monitor, true)));
  			}
  		}
  		return (IArchive[]) results.toArray(new IArchive[results.size()]);
  	}
  	
  	public static IArchive[] getProjectPackages (IProject project, IProgressMonitor monitor, boolean forceInit) {
  		if (monitor == null) monitor = new NullProgressMonitor();
  		
  		monitor.beginTask("Fetching packages for \"" + project.getName() + "\"...", 2);
  		IArchive[] packages = ArchivesModel.instance().getProjectArchives(project);
  		monitor.worked(1);
  		
  		if (packages == null) {
  			if (forceInit && packageFileExists(project)) {
  				ArchivesModel.instance().registerProject(project, monitor);
  				packages = ArchivesModel.instance().getProjectArchives(project);
  			}
  			
  			if (packages == null) return new IArchive[0];
  		}
  
  		monitor.worked(1);
  		monitor.done();
  		return packages;
  	}
  
  	public static boolean packageFileExists (IProject project) {
  		return project.getFile(ArchivesModel.PROJECT_PACKAGES_FILE).exists();
  	}
  	
  	public static boolean projectRegistered(IProject project) {
  		return ArchivesModel.instance().getRoot(project) == null ? false : true;
  	}
  
  	
  	/**
  	 * Visit all of the top-level packages in the passed in project with the passed in node visitor
  	 * @param project The project whose packages to visit
  	 * @param visitor The visitor
  	 */
  	public static void visitProjectArchives (IProject project, IArchiveNodeVisitor visitor) {
  		if (packageFileExists(project)) {
  			IArchive packages[] = getProjectPackages(project, null, false);
  			if( packages == null ) return;
  			for (int i = 0; i < packages.length; i++) {
  				boolean keepGoing = packages[i].accept(visitor);
  				if (!keepGoing) break;
  			}
  		}
  	}
  
  	
  	public static IArchiveType getPackageType (String packageType) {
  		return ExtensionManager.getArchiveType(packageType);
  	}
  
  	public static IPath[] findMatchingPaths(IPath root, String includes, String excludes) {
  		DirectoryScanner scanner  = 
  			DirectoryScannerFactory.createDirectoryScanner(root, includes, excludes, true);
  		String[] files = scanner.getIncludedFiles();
  		IPath[] paths = new IPath[files.length];
  		for( int i = 0; i < files.length; i++ ) {
  			paths[i] = new Path(files[i]);
  		}
  		return paths;
  	}
  }
  
  
  
  1.1      date: 2007/04/18 21:07:53;  author: rawb;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchive.java
  
  Index: IArchive.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.archives.core.model;
  
  import org.eclipse.core.runtime.IPath;
  import org.jboss.ide.eclipse.archives.core.model.types.IArchiveType;
  
  /** 
   * <p>
   * This interface represents a package definition.
   * A package definition consists of a list of folders, filesets, and sub-packages
   * </p>
   * 
   * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
   * @version $Revision: 1.1 $
   */
  public interface IArchive extends IArchiveNode {
  	public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackage.";
  	public static final String PACKAGE_TYPE_ATTRIBUTE = ATTRIBUTE_PREFIX + "packageType";
  	public static final String EXPLODED_ATTRIBUTE = ATTRIBUTE_PREFIX + "exploded";
  	public static final String DESTINATION_ATTRIBUTE = ATTRIBUTE_PREFIX + "destination";
  	public static final String NAME_ATTRIBUTE = ATTRIBUTE_PREFIX + "name";
  	public static final String IN_WORKSPACE_ATTRIBUTE = ATTRIBUTE_PREFIX + "inWorkspace";
  	
  
  	/**
  	 * @return The package type of this package.
  	 */
  	public IArchiveType getArchiveType();
  	
  	/**
  	 * return the raw string from the delegate even if the type is not found
  	 * @return
  	 */
  	public String getArchiveTypeId();
  
  	/**
  	 * @return The name (with extension) of this package.
  	 */
  	public String getName();
  	
  //	/**
  //	 * @return Whether or not this package is a reference to another package.
  //	 */
  //	public boolean isReference();
  	
  //	/**
  //	 * @return An array of references to this package.
  //	 */
  //	public IPackageReference[] getReferences ();
  	
  	/**
  	 * @return Whether or not this package will be build exploded, or as a directory instead of a ZIP/JAR
  	 */
  	public boolean isExploded();
  	
  	/**
  	 * @return Whether or not this package is a "top-level" package aka, not a child of another folder or package
  	 */
  	public boolean isTopLevel();
  		
  	/**
  	 * If this package is top-level, there are two types of destinations it can have. "Inside" the workspace, and "outside" the workspace.
  	 * If the destination is inside the workspace, you will need to call getDestinationContainer()
  	 * Otherwise you will need to call getDestinationFolder()
  	 * @return Wheter or not the destination of this package is in the workspace
  	 * @see IPackage.getDestinationFolder()
  	 * @see IPackage.getDestinationContainer()
  	 */
  	public boolean isDestinationInWorkspace();
  	
  	/**
  	 * @return An IPath to this package's destination. 
  	 * Destination will always be file-system based
  	 */
  	public IPath getDestinationPath();
  	
  	/**
  	 * @return A list of sub-archives contained in this package
  	 */
  	public IArchive[] getArchives();
  	
  	/**
  	 * @return A list of folders contained in this package
  	 */
  	public IArchiveFolder[] getFolders();
  	
  	/**
  	 * @return A list of filesets contained in this package
  	 */
  	public IArchiveFileSet[] getFileSets();
  
  	/**
  	 * Get The path to this package's output file.
  	 * This path should be GLOBAL
  	 * @return  the path
  	 */
  	public IPath getArchiveFilePath();
  	
  	/**
  	 * If this package is not top-level, this will return a relative path to this package from within it's parent, i.e.
  	 * my.ear/web/my.war/WEB-INF/lib. Otherwise, this will return null
  	 * @return a relative IPath to this package's top level parent
  	 */
  	//public IPath getPackageRelativePath();
  	
  	/**
  	 * Set the package type of this package
  	 * @param type The package type
  	 */
  	public void setArchiveType(IArchiveType type);
  
  	/**
  	 * Set the package type via ID. 
  	 * @param type
  	 */
  	public void setArchiveType(String type);
  	/**
  	 * Set the name of this package
  	 * @param name This package's name
  	 */
  	public void setName(String name);
  	
  	/**
  	 * Set whether or not this package is generated as a folder
  	 * @param exploded
  	 */
  	public void setExploded(boolean exploded);
  		
  	/**
  	 * Sets the destination path for this package.
  	 * @param path The absolute path where this package will be built
  	 */
  	public void setDestinationPath (IPath path, boolean inWorkspace);
  		
  }
  
  
  
  1.1      date: 2007/04/18 21:07:53;  author: rawb;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IPackagesBuildListener.java
  
  Index: IPackagesBuildListener.java
  ===================================================================
  package org.jboss.ide.eclipse.archives.core.model;
  
  public interface IPackagesBuildListener {
  	public void buildStarted();
  	public void buildEnded();
  }
  
  
  
  1.1      date: 2007/04/18 21:07:53;  author: rawb;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java
  
  Index: IArchiveFileSet.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.archives.core.model;
  
  import org.eclipse.core.resources.IFile;
  import org.eclipse.core.runtime.IPath;
  
  /**
   * <p>
   * This interface represents a file set inside of a package definition or folder.
   * </p>
   * 
   * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
   * @version $Revision: 1.1 $
   */
  public interface IArchiveFileSet extends IArchiveNode {
  	public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackageFileSet.";
  	public static final String INCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "includes";
  	public static final String EXCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX + "excludes";
  	public static final String IN_WORKSPACE_ATTRIBUTE = ATTRIBUTE_PREFIX + "inWorkspace";
  	public static final String SOURCE_PATH_ATTRIBUTE = ATTRIBUTE_PREFIX + "sourcePath";
  
  
  	
  	/**
  	 * @return Whether or not this fileset's basedir is inside the workspace
  	 */
  	public boolean isInWorkspace();
  	
  	/**
  	 * @return The path to the source folder ("basedir" in ant terminology) for this fileset. 
  	 * Note that this path can be filesystem-based or workspace-based.
  	 */
  	public IPath getGlobalSourcePath();
  	
  	/**
  	 * Same as above but file-system relative
  	 * @return
  	 */
  	public IPath getSourcePath();
  	
  	/**
  	 * Force the scanner to check for matched files again
  	 */
  	public void resetScanner();
  	
  	/**
  	 * @return The includes pattern for this fileset
  	 */
  	public String getIncludesPattern();
  	
  	/**
  	 * @return The excludes pattern for this fileset
  	 */
  	public String getExcludesPattern();
  	
  	/**
  	 * @return An array of matching IPath's in the filesystem (for external filesystem filesets)
  	 */
  	public IPath[] findMatchingPaths();
  	
  	/**
  	 * @param file The file to check
  	 * @return Whether or not this fileset matches the passed-in file
  	 */
  	public boolean matchesFile(IFile file);
  	
  	/**
  	 * @param path The absolute path on the filesystem to check
  	 * @return Whether or not this fileset matches the passed-in path
  	 */
  	public boolean matchesPath(IPath path);
  	
  	/**
  	 * Sets the "root" or "source" of this fileset to be an absolute path.
  	 * @param path The absolute path that is the source of this fileset
  	 */
  	public void setSourcePath(IPath path);
  	
  	/**
  	 * Set the includes pattern for this fileset. This pattern uses the same syntax as Ant's include pattern.
  	 * @param includes The includes pattern for this fileset
  	 */
  	public void setIncludesPattern(String includes);
  	
  	/**
  	 * Set the excludes pattern for this fileset. This pattern uses the same syntax as Ant's exclude pattern.
  	 * @param excludes The excludes pattern for this fileset
  	 */
  	public void setExcludesPattern(String excludes);
  	
  	/**
  	 * Set whether or not this fileset's source is in the workspace. This will automatically be handled if you
  	 * use setSingleFile, setSourceProject, setSourceContainer, or setSourceFolder.
  	 * @param isInWorkspace Whether or not this fileset's source is in the workspace
  	 */
  	public void setInWorkspace(boolean isInWorkspace);
  	
  	public IPath getRootArchiveRelativePath(IPath inputFile);
  }
  
  
  
  1.1      date: 2007/04/18 21:07:53;  author: rawb;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveModelListener.java
  
  Index: IArchiveModelListener.java
  ===================================================================
  package org.jboss.ide.eclipse.archives.core.model;
  
  public interface IArchiveModelListener {
  	public void modelChanged(IArchiveNodeDelta delta);
  }
  
  
  
  1.1      date: 2007/04/18 21:07:53;  author: rawb;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFolder.java
  
  Index: IArchiveFolder.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.archives.core.model;
  
  
  /**
   * <p>
   * This interface represents a folder inside a package definition.
   * A folder can contain packages, filesets, and sub-folders.
   * </p>
   * 
   * @author <a href="marshall at jboss.org">Marshall Culpepper</a>
   * @version $Revision: 1.1 $
   */
  public interface IArchiveFolder extends IArchiveNode {
  
  	public static final String ATTRIBUTE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.IPackageFolder.";
  	public static final String NAME_ATTRIBUTE = ATTRIBUTE_PREFIX + "name";
  
  	
  	/**
  	 * @return The name of this folder
  	 */
  	public String getName();
  	
  	/**
  	 * Set the name of this folder
  	 * @param name The name of this folder
  	 */
  	public void setName(String name);
  	
  	/**
  	 * @return An array of sub-packages of this folder
  	 */
  	public IArchive[] getArchives();
  	
  	/**
  	 * @return An array of sub-folders of this folder
  	 */
  	public IArchiveFolder[] getFolders();
  	
  	/**
  	 * @return An array of filesets whose destination is this folder
  	 */
  	public IArchiveFileSet[] getFileSets();
  }
  
  
  



More information about the jboss-cvs-commits mailing list