[jboss-svn-commits] JBL Code SVN: r21063 - in labs/jbossbuild/jbossbuild/trunk: src and 20 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jul 16 11:06:21 EDT 2008


Author: pgier
Date: 2008-07-16 11:06:21 -0400 (Wed, 16 Jul 2008)
New Revision: 21063

Added:
   labs/jbossbuild/jbossbuild/trunk/build.xml
   labs/jbossbuild/jbossbuild/trunk/src/
   labs/jbossbuild/jbossbuild/trunk/src/main/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/AbstractTargetDefinitionTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactDefinitionTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactsTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/BuildTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentDefinitionTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentMainTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentsTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/DynamicTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/DynamicTargetException.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/GeneratedSourceDefinitionTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/MainTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ResourceDefinitionTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ShowTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/SourceDefinitionTarget.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/package.html
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/AbstractIDETask.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/BuildTask.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/CopyWithZipFileSetSupport.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/GenerateLibrariesFile.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/IDETask.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/RMICHelper.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/SynchronizeComponentsTask.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/TargetExecutor.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/VisitComponentRefGraphTask.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/package.html
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/component/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/component/IDETask.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/component/package.html
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/package.html
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/AbstractBuildDataType.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/AbstractDataType.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Compatible.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/ComponentRef.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/DynamicType.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Export.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Generate.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Import.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Include.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Includes.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Pattern.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Source.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/SourceSink.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/attributes/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/attributes/Version.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Artifact.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/ArtifactType.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Build.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Component.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/package.html
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ArtifactDefinition.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ComponentDefinition.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/GeneratedSourceDefinition.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ResourceDefinition.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/SourceDefinition.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/package.html
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/package.html
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/TargetDefinition.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/TargetDefinitions.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/package.html
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/AttributeException.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/AttributeUtil.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/DownloadUtil.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/FileUtil.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ImportUtil.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/LoggerUtil.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/MacroUtil.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ObjectUtil.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ReferenceUtil.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ValidateLicenseHeaders.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/XMLUtil.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphChildResolverVistor.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphClasspathVisitor.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphFileResolverVisitor.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphLicenseVisitor.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefVertex.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Edge.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Graph.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/RootVertex.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Vertex.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Visitor.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/VisitorListener.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/package.html
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/test/
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/test/GraphTestCase.java
   labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/test/VersionTest.java
   labs/jbossbuild/jbossbuild/trunk/src/resources/
   labs/jbossbuild/jbossbuild/trunk/src/resources/tasks.xml
   labs/jbossbuild/jbossbuild/trunk/thirdparty/
   labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/
   labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/
   labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/ant.jar
   labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/apache-2.0.txt
   labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/junit.jar
Log:
Migrating jbossbuild from cvs to svn

Added: labs/jbossbuild/jbossbuild/trunk/build.xml
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/build.xml	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/build.xml	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+
+<!--
+JBoss, Home of Professional Open Source
+
+Distributable under LGPL license.
+See terms of license at gnu.org.
+-->
+<project name="JBossBuild"
+         default="dist" 
+         basedir="."
+>
+<!-- ==========================================================================
+Classpath
+=========================================================================== -->
+<path id="classpath">
+   <fileset dir="thirdparty/ant/lib">
+      <include name="*.jar"/>
+   </fileset>
+</path>
+
+<!-- ==========================================================================
+Compile the source
+=========================================================================== -->
+<target name="compile">
+
+   <mkdir dir="output/classes"/>
+
+   <javac destdir="output/classes"
+          debug="on"
+          deprecation="on"
+          optimize="on"
+          classpathref="classpath">
+      <src path="src/main"/>
+   </javac>
+
+</target>
+
+<!-- ==========================================================================
+Do the packaging
+=========================================================================== -->
+<target name="dist" depends="compile">
+
+   <mkdir dir="output/lib"/>
+
+   <jar jarfile="output/lib/jbossbuild.jar" basedir="output/classes">
+      <exclude name="org/jboss/test/**" />
+   </jar>
+
+</target>
+
+<!-- ==========================================================================
+Cleans the build environment
+=========================================================================== -->
+<target name="clean">
+
+   <delete dir="output"/>
+
+</target>
+
+</project>


Property changes on: labs/jbossbuild/jbossbuild/trunk/build.xml
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/AbstractTargetDefinitionTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/AbstractTargetDefinitionTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/AbstractTargetDefinitionTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.tools.ant.RuntimeConfigurable;
+import org.apache.tools.ant.UnknownElement;
+import org.jboss.ant.types.AbstractBuildDataType;
+import org.jboss.ant.types.DynamicType;
+import org.jboss.ant.types.target.TargetDefinition;
+import org.jboss.ant.util.MacroUtil;
+
+/**
+ * A target definition target.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public abstract class AbstractTargetDefinitionTarget extends DynamicTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /** The target definition */
+   private TargetDefinition targetDefinition;
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new target definition target
+    * 
+    * @param dataType the data type
+    * @param name the target name
+    * @param description the description
+    * @param targetDefinition the target definition
+    */
+   public AbstractTargetDefinitionTarget(AbstractBuildDataType dataType, String name, String description, TargetDefinition targetDefinition)
+   {
+      super(dataType, name, description);
+      this.targetDefinition = targetDefinition;
+      if( log.isTraceEnabled() )
+      {
+         log.trace("Created target definition, type.id="+dataType.getId()
+            +", name="+name+", targetDefinition.id="+targetDefinition.getId());
+      }
+   }
+   
+   // Public --------------------------------------------------------
+
+   /**
+    * Get the target definition
+    * 
+    * @return the target definition
+    */
+   public TargetDefinition getTargetDefinition()
+   {
+      return targetDefinition;
+   }
+   
+   // DynamicTarget overrides ---------------------------------------
+   
+   protected void generate()
+   {
+      List dynamicTypes = getDynamicTypes();
+      if (dynamicTypes != null)
+      {
+         if( log.isTraceEnabled() )
+            log.trace("generate");
+         for (int i = 0; i < dynamicTypes.size(); ++i)
+         {
+            DynamicType dynamicType = (DynamicType) dynamicTypes.get(i);
+            if (dynamicType.applies(getDataType()))
+               generateTasks(dynamicType);
+         }
+      }
+   }
+
+   public void show()
+   {
+      List dynamicTypes = getDynamicTypes();
+      if (dynamicTypes != null)
+      {
+         for (int i = 0; i < dynamicTypes.size(); ++i)
+         {
+            DynamicType dynamicType = (DynamicType) dynamicTypes.get(i);
+            Vector taskDefinitions = dynamicType.getElements();
+            if (dynamicType.applies(getDataType()))
+            {
+               for (int j = 0; j < taskDefinitions.size(); ++j)
+               {
+                  DynamicType taskDefinition = (DynamicType) taskDefinitions.get(j);
+                  RuntimeConfigurable rc = createMacro(taskDefinition.getId());
+                  MacroUtil.configure(rc, taskDefinition, getDataType(), getProject(), this);
+                  System.out.print(MacroUtil.dumpMacro((UnknownElement) rc.getProxy()));
+               }
+            }
+         }
+      }
+      else
+      {
+         System.out.print("\n<!-- Nothing -->");
+      }
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   /**
+    * Get the relevent dynamic types for this target
+    * 
+    * @return the dynamic types
+    */
+   protected abstract List getDynamicTypes();
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/AbstractTargetDefinitionTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactDefinitionTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactDefinitionTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactDefinitionTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.jboss.ant.types.build.Artifact;
+import org.jboss.ant.types.component.ArtifactDefinition;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * An artifact definition target.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class ArtifactDefinitionTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+   
+   /**
+    * Generate the description
+    *
+    * @param artifactDefinition the artifact definition 
+    * @param targetDefinition the target definition
+    * @return the description
+    */
+   private static String getDescription(ArtifactDefinition artifactDefinition, TargetDefinition targetDefinition)
+   {
+      String description = targetDefinition.getDescription();
+      if (description == null)
+         return null;
+      else
+         return description + " for the artifact " + artifactDefinition.getTargetName();
+   }
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new artifact definition target
+    * 
+    * @param artifactDefinition the artifact definition
+    * @param targetDefinition the target definition
+    */
+   public ArtifactDefinitionTarget(ArtifactDefinition artifactDefinition, TargetDefinition targetDefinition)
+   {
+      super(artifactDefinition, targetDefinition.getTarget() + "." + artifactDefinition.getTargetName(), getDescription(artifactDefinition, targetDefinition), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      ArtifactDefinition artifactDefinition = (ArtifactDefinition) getDataType();
+      Artifact artifact = artifactDefinition.getArtifact();
+      return getTargetDefinition().getElement(artifact.getArtifactType().getType());
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactDefinitionTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.jboss.ant.types.build.Artifact;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * An artifact target
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class ArtifactTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+   
+   /**
+    * Generate the description
+    * 
+    * @param artifact the artifact
+    * @param targetDefinition the target definition
+    * @return the description
+    */
+   private static String getDescription(Artifact artifact, TargetDefinition targetDefinition)
+   {
+      String description = targetDefinition.getDescription();
+      if (description == null)
+         return null;
+      else
+         return description + " for the artifact " + artifact.getId();
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new artifact target
+    * 
+    * @param artifact the artifact
+    * @param targetDefinition the target definition
+    */
+   public ArtifactTarget(Artifact artifact, TargetDefinition targetDefinition)
+   {
+      super(artifact, targetDefinition.getTarget() + "." + artifact.getId(), getDescription(artifact, targetDefinition), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      return getTargetDefinition().getElement("artifact");
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactsTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactsTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactsTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.jboss.ant.types.build.Build;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * An artifacts target.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class ArtifactsTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   /**
+    * Generate the description
+    * 
+    * @param targetDefinition the target definition
+    * @return the description
+    */
+   private static String getDescription(TargetDefinition targetDefinition)
+   {
+      String description = targetDefinition.getDescription();
+      if (description == null)
+         return null;
+      else
+         return description + " for all the artifacts";
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new artifacts target
+    * 
+    * @param build the build
+    * @param targetDefinition the target definition
+    */
+   public ArtifactsTarget(Build build, TargetDefinition targetDefinition)
+   {
+      super(build, targetDefinition.getTarget() + ".artifacts", getDescription(targetDefinition), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Package protected ---------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      return null;
+   }
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ArtifactsTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/BuildTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/BuildTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/BuildTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.jboss.ant.types.build.Build;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * A build target.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class BuildTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+   
+   /**
+    * Generate the description
+    * 
+    * @param targetDefinition the target definition
+    * @return the description
+    */
+   private static String getDescription(TargetDefinition targetDefinition)
+   {
+      String description = targetDefinition.getDescription();
+      if (description == null)
+         return null;
+      else
+         return description + " for everything";
+   }
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new build target
+    * 
+    * @param build the build
+    * @param targetDefinition the target definition
+    */
+   public BuildTarget(Build build, TargetDefinition targetDefinition)
+   {
+      super(build, targetDefinition.getTarget(), getDescription(targetDefinition), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      return null;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/BuildTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentDefinitionTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentDefinitionTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentDefinitionTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.jboss.ant.types.component.ComponentDefinition;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * A component definition target.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class ComponentDefinitionTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new component definition target
+    * 
+    * @param componentDefinition the component definition
+    * @param targetDefinition the target definition
+    */
+   public ComponentDefinitionTarget(ComponentDefinition componentDefinition, TargetDefinition targetDefinition)
+   {
+      super(componentDefinition, targetDefinition.getTarget(), targetDefinition.getDescription(), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      return getTargetDefinition().getComponent();
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentDefinitionTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentMainTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentMainTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentMainTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * A component target that runs in the main build
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class ComponentMainTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+   
+   /**
+    * Generate the description
+    * 
+    * @param component the component
+    * @param targetDefinition the target definition
+    * @return the description
+    */
+   private static String getDescription(Component component, TargetDefinition targetDefinition)
+   {
+      String description = targetDefinition.getDescription();
+      if (description == null)
+         return null;
+      else
+         return description + " for the component " + component.getId();
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new component target
+    * 
+    * @param component the component
+    * @param targetDefinition the target definition
+    */
+   public ComponentMainTarget(Component component, TargetDefinition targetDefinition)
+   {
+      super(component, targetDefinition.getTarget() + "." + component.getId(), getDescription(component, targetDefinition), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      return getTargetDefinition().getElement("componentmain");
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentMainTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.apache.tools.ant.RuntimeConfigurable;
+import org.apache.tools.ant.UnknownElement;
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.types.target.TargetDefinition;
+import org.jboss.ant.util.MacroUtil;
+
+/**
+ * A component target
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class ComponentTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+   
+   /**
+    * Generate the description
+    * 
+    * @param component the component
+    * @param targetDefinition the target definition
+    * @return the description
+    */
+   private static String getDescription(Component component, TargetDefinition targetDefinition)
+   {
+      String description = targetDefinition.getDescription();
+      if (description == null)
+         return null;
+      else
+         return description + " for the component " + component.getId();
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new component target
+    * 
+    * @param component the component
+    * @param targetDefinition the target definition
+    */
+   public ComponentTarget(Component component, TargetDefinition targetDefinition)
+   {
+      super(component, targetDefinition.getTarget() + "." + component.getId(), getDescription(component, targetDefinition), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      return null;
+   }
+
+   // DynamicTarget overrides ---------------------------------------
+   
+   protected void generate()
+   {
+      invokeComponent();
+   }
+
+   public void show()
+   {
+      String componentTarget = getTargetDefinition().getTarget();
+
+      Component component = (Component) getDataType();
+      
+      RuntimeConfigurable rc = createMacro("invoke");
+      rc.setAttribute("dir", component.getDir().toString());
+      rc.setAttribute("target", componentTarget);
+      System.out.print(MacroUtil.dumpMacro((UnknownElement) rc.getProxy()));
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   /**
+    * Invoke a component
+    */
+   protected void invokeComponent()
+   {
+      String componentTarget = getTargetDefinition().getTarget();
+      
+      if (log.isTraceEnabled())
+         log.trace("New invokeComponent: " + getName() + " component target=" + componentTarget);
+
+      Component component = (Component) getDataType();
+      
+      RuntimeConfigurable rc = createMacro("invoke");
+      rc.setAttribute("dir", component.getDir().toString());
+      rc.setAttribute("target", componentTarget);
+      addTask(rc);
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentsTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentsTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentsTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.jboss.ant.types.build.Build;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * A components target.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class ComponentsTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   /**
+    * Generate the description
+    * 
+    * @param targetDefinition the target definition
+    * @return the description
+    */
+   private static String getDescription(TargetDefinition targetDefinition)
+   {
+      String description = targetDefinition.getDescription();
+      if (description == null)
+         return null;
+      else
+         return description + " for all the components";
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new components target
+    * 
+    * @param build the build
+    * @param targetDefinition the target definition
+    */
+   public ComponentsTarget(Build build, TargetDefinition targetDefinition)
+   {
+      super(build, targetDefinition.getTarget() + ".components", getDescription(targetDefinition), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      return null;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ComponentsTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/DynamicTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/DynamicTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/DynamicTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.Vector;
+
+import org.apache.tools.ant.RuntimeConfigurable;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.UnknownElement;
+import org.jboss.ant.types.AbstractBuildDataType;
+import org.jboss.ant.types.DynamicType;
+import org.jboss.ant.util.MacroUtil;
+import org.jboss.ant.util.LoggerUtil.Logger;
+
+/**
+ * A dynamic target.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public abstract class DynamicTarget extends Target
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /** The Logger */
+   protected Logger log;
+
+   /** The data type */
+   private AbstractBuildDataType dataType;
+   
+   /** Whether the tasks have been generated */
+   private boolean generated = false;
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new dynamic target
+    * 
+    * @param dataType the data type
+    * @param name the name of the target
+    * @param description the description
+    */
+   public DynamicTarget(AbstractBuildDataType dataType, String name, String description)
+   {
+      this.dataType = dataType;
+      log = new Logger(dataType, this);
+      setName(name);
+      if (description != null)
+         setDescription(description);
+      
+      if (log.isTraceEnabled())
+         log.trace("New target: " + name);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Target overrides ----------------------------------------------
+   
+   public void execute()
+   {
+      if (generated == false)
+      {
+         if (log.isTraceEnabled())
+            log.trace("Generating target '" + getName() + "' ...");
+         dataType.validate();
+         generate();
+         generated = true;
+      }
+      try
+      {
+         if (log.isTraceEnabled())
+            log.trace("Executing target '" + getName() + "' ...");
+         super.execute();
+      }
+      catch (Exception e)
+      {
+         DynamicTargetException.rethrow(dataType.toShortString(), getName(), e);
+      }
+   }
+   
+   /**
+    * Show the target
+    */
+   public void show()
+   {
+      System.out.print("\n<!-- Dynamic Target -->");
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   /**
+    * Get the data type
+    * 
+    * @return the data type
+    */
+   protected AbstractBuildDataType getDataType()
+   {
+      return dataType;
+   }
+
+   /**
+    * Generate the target
+    */
+   protected void generate()
+   {
+   }
+
+   /**
+    * Add a task
+    * 
+    * @param rc the task
+    */
+   protected void addTask(RuntimeConfigurable rc)
+   {
+      UnknownElement element = (UnknownElement) rc.getProxy();
+      super.addTask(element);
+      
+      if (log.isTraceEnabled())
+         log.trace("... added macro: " + MacroUtil.dumpMacro(element));
+   }
+
+   /**
+    * Generate tasks from a dynamic type
+    * 
+    * @param dynamicType the dynamic type
+    */
+   protected void generateTasks(DynamicType dynamicType)
+   {
+      if( log.isTraceEnabled() )
+         log.trace("generateTasks: "+dynamicType.getId());
+      Vector taskDefinitions = dynamicType.getElements();
+      for (int i = 0; i < taskDefinitions.size(); ++i)
+      {
+         DynamicType taskDefinition = (DynamicType) taskDefinitions.get(i);
+         RuntimeConfigurable rc = createMacro(taskDefinition.getId());
+         MacroUtil.configure(rc, taskDefinition, dataType, getProject(), this);
+         addTask(rc);
+      }
+   }
+   
+   /**
+    * Create a macro
+    * 
+    * @param name the name of the macro
+    * @return the runtime configurable for the macro
+    */
+   protected RuntimeConfigurable createMacro(String name)
+   {
+      return MacroUtil.createMacro(name, getProject(), this);
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/DynamicTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/DynamicTargetException.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/DynamicTargetException.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/DynamicTargetException.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * A DynamicTargetException.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public class DynamicTargetException extends BuildException
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   /**
+    * Rethrow as a dynamic target exception
+    * 
+    * @param context the context
+    * @param target the target
+    * @param t the throwable 
+    */
+   public static void rethrow(Object context, String target, Throwable t)
+   {
+      if (t instanceof DynamicTargetException)
+         throw (DynamicTargetException) t;
+      else
+         throw new DynamicTargetException(context, target, t);
+   }
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new dynamic target exception
+    * 
+    * @param context the context
+    * @param target the target
+    * @param t the throwable
+    */
+   public DynamicTargetException(Object context, String target, Throwable t)
+   {
+      super("Error executing '" + target + "' for " + context + "\nCause: " + t.toString(), t);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/DynamicTargetException.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/GeneratedSourceDefinitionTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/GeneratedSourceDefinitionTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/GeneratedSourceDefinitionTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.jboss.ant.types.component.GeneratedSourceDefinition;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * A generated source definition target.
+ * 
+ * @author <a href="ryan.campbell at jboss.com">Ryan Campbell</a>
+ * @version $Revision$
+ */
+public class GeneratedSourceDefinitionTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /**
+    * Generate the description
+    *
+    * @param genSourceDefinition the generated source definition 
+    * @param targetDefinition the target definition
+    * @return the description
+    */
+   private static String getDescription(GeneratedSourceDefinition genSourceDefinition, TargetDefinition targetDefinition)
+   {
+      String description = targetDefinition.getDescription();
+      if (description == null)
+         return null;
+      else
+         return description + " for the generated source " + genSourceDefinition.getId();
+   }
+
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new generated source definition target
+    * 
+    * @param genSourceDefinition the generated source definition
+    * @param targetDefinition the target definition
+    */
+   public GeneratedSourceDefinitionTarget(GeneratedSourceDefinition genSourceDefinition, TargetDefinition targetDefinition)
+   {
+      super(genSourceDefinition, targetDefinition.getTarget() + "." + genSourceDefinition.getId(), getDescription(genSourceDefinition, targetDefinition), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      return getTargetDefinition().getElement("generatedsource");
+   }
+
+   // DynamicTarget overrides ---------------------------------------
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/GeneratedSourceDefinitionTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/MainTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/MainTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/MainTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.jboss.ant.types.build.Build;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * A main build target.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class MainTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   /**
+    * Generate the description
+    * 
+    * @param targetDefinition the target definition
+    * @return the description
+    */
+   private static String getDescription(TargetDefinition targetDefinition)
+   {
+      String description = targetDefinition.getDescription();
+      if (description == null)
+         return null;
+      else
+         return description + " for the main build only";
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new  main build target
+    * 
+    * @param build the build
+    * @param targetDefinition the targetDefinition
+    */
+   public MainTarget(Build build, TargetDefinition targetDefinition)
+   {
+      super(build, targetDefinition.getTarget() + ".main", getDescription(targetDefinition), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      return getTargetDefinition().getMain();
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/MainTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ResourceDefinitionTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ResourceDefinitionTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ResourceDefinitionTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.jboss.ant.types.component.ResourceDefinition;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * A resource definition target.
+ * 
+ * @author <a href="ryan.campbell at jboss.com">Ryan Campbell</a>
+ * @version $Revision$
+ */
+public class ResourceDefinitionTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /**
+    * Generate the description
+    *
+    * @param resourceDefinition the resource definition 
+    * @param targetDefinition the target definition
+    * @return the description
+    */
+   private static String getDescription(ResourceDefinition resourceDefinition, TargetDefinition targetDefinition)
+   {
+      String description = targetDefinition.getDescription();
+      if (description == null)
+         return null;
+      else
+         return description + " for the resource " + resourceDefinition.getResourcePath();
+   }
+
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new resource definition target
+    * 
+    * @param sourceDefinition the source definition
+    * @param targetDefinition the target definition
+    */
+   public ResourceDefinitionTarget(ResourceDefinition resourceDefinition, TargetDefinition targetDefinition)
+   {
+      super(resourceDefinition, targetDefinition.getTarget() + "." + resourceDefinition.getId(), getDescription(resourceDefinition, targetDefinition), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      return getTargetDefinition().getElement("resource");
+   }
+
+   // DynamicTarget overrides ---------------------------------------
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ResourceDefinitionTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ShowTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ShowTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ShowTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.jboss.ant.types.build.Build;
+import org.jboss.ant.types.component.ComponentDefinition;
+
+/**
+ * The show target.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class ShowTarget extends DynamicTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new build target
+    * 
+    * @param build the build
+    */
+   public ShowTarget(Build build)
+   {
+      super(build, "show", "Show the targets");
+   }
+ 
+   /**
+    * Create a new component target
+    * 
+    * @param build the build
+    */
+   public ShowTarget(ComponentDefinition componentDef)
+   {
+      super(componentDef, "show", "Show the targets");
+   }
+   
+   
+   // Public --------------------------------------------------------
+
+   public void execute()
+   {
+      Project project = getProject();
+      Hashtable targets = project.getTargets();
+      String showProperty = project.getProperty("show");
+      ArrayList names = new ArrayList(targets.keySet());
+      Collections.sort(names);
+      for (Iterator i = names.iterator(); i.hasNext();)
+      {
+         String name = (String) i.next();
+         if (showProperty == null || name.startsWith(showProperty))
+         {
+            Target target = (Target) targets.get(name);
+            showTarget(target);
+         }
+      }
+   }
+   
+   public void showTarget(Target target)
+   {
+      if (target instanceof DynamicTarget)
+      {
+         String description = target.getDescription();
+         if (description != null)
+            System.out.println("<!-- " + description + " -->");
+         System.out.print("<target name=\"" + target.getName() + "\"");
+         Enumeration depends = target.getDependencies();
+         if (depends.hasMoreElements())
+         {
+            System.out.print(" depends=\"");
+            while (depends.hasMoreElements())
+            {
+               System.out.print(depends.nextElement());
+               if (depends.hasMoreElements())
+                  System.out.print(", ");
+            }
+            System.out.print("\"");
+         }
+         System.out.print(">");
+         
+         ((DynamicTarget) target).show();
+         
+         System.out.println("\n</target>\n");
+      }
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/ShowTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/SourceDefinitionTarget.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/SourceDefinitionTarget.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/SourceDefinitionTarget.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.targets;
+
+import java.util.List;
+
+import org.jboss.ant.types.component.SourceDefinition;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * A source definition target.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class SourceDefinitionTarget extends AbstractTargetDefinitionTarget
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /**
+    * Generate the description
+    *
+    * @param sourceDefinition the source definition 
+    * @param targetDefinition the target definition
+    * @return the description
+    */
+   private static String getDescription(SourceDefinition sourceDefinition, TargetDefinition targetDefinition)
+   {
+      String description = targetDefinition.getDescription();
+      if (description == null)
+         return null;
+      else
+         return description + " for the source " + sourceDefinition.getSourcePath();
+   }
+
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new source definition target
+    * 
+    * @param sourceDefinition the source definition
+    * @param targetDefinition the target definition
+    */
+   public SourceDefinitionTarget(SourceDefinition sourceDefinition, TargetDefinition targetDefinition)
+   {
+      super(sourceDefinition, targetDefinition.getTarget() + "." + sourceDefinition.getId(), getDescription(sourceDefinition, targetDefinition), targetDefinition);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // AbstractTargetDefinitionTarget overrides ----------------------
+   
+   protected List getDynamicTypes()
+   {
+      return getTargetDefinition().getElement("source");
+   }
+
+   // DynamicTarget overrides ---------------------------------------
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/SourceDefinitionTarget.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/package.html
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/package.html	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/package.html	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <!-- $Id$ -->
+    <!--
+
+    JBoss: The OpenSource J2EE WebOS 
+
+    Distributable under LGPL license.
+    See terms of license at gnu.org.
+
+    -->
+  </head>
+
+  <body bgcolor="white">
+    <p>Classes used to generate targets.
+
+    <h2>Package Specification</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+      
+    <h2>Related Documentation</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+
+    <h2>Package Status</h2>
+    <ul>
+      <li><font color="red"><b>ALPHA</b></font>
+    </ul>
+
+    <h2>Todo</h2>
+    <ul>
+      <li>???
+    </ul>
+
+    <!-- Put @see and @since tags down here. -->
+
+  </body>
+</html>


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/targets/package.html
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/AbstractIDETask.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/AbstractIDETask.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/AbstractIDETask.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.tasks;
+
+import java.io.File;
+
+import org.apache.tools.ant.Task;
+import org.jboss.ant.util.FileUtil;
+import org.jboss.ant.util.XMLUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+/**
+ * An abstract ide task.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public abstract class AbstractIDETask extends Task
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new abstract ide task
+    */
+   public AbstractIDETask()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Task overrides ------------------------------------------------
+   
+   public void execute()
+   {
+      generateEclipseProject();
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Generate the eclipse project file
+    */
+   protected void generateEclipseProject()
+   {
+      if (isUpToDate(".project"))
+         return;
+      
+      Document document = XMLUtil.createDocument();
+      Element projectDescription = document.createElement("projectDescription");
+      document.appendChild(projectDescription);
+      
+      Element projectName = document.createElement("name");
+      projectDescription.appendChild(projectName);
+      Text projectNameText = document.createTextNode(getProjectName());
+      projectName.appendChild(projectNameText);
+      
+      Element comment = document.createElement("comment");
+      projectDescription.appendChild(comment);
+      Text commentText = document.createTextNode(getProjectDescription());
+      comment.appendChild(commentText);
+      
+      Element projects = document.createElement("projects");
+      projectDescription.appendChild(projects);
+      appendEclipseProjects(projects);
+      
+      Element buildSpec = document.createElement("buildSpec");
+      projectDescription.appendChild(buildSpec);
+      appendEclipseBuildSpec(buildSpec);
+      
+      Element natures = document.createElement("natures");
+      projectDescription.appendChild(natures);
+      appendEclipseNatures(natures);
+      
+      File file = FileUtil.resolve(getBaseDir(), ".project");
+      XMLUtil.writeXMLDocument(file, document);
+      log("Updated " + file);
+   }
+
+   /**
+    * Get the project name
+    * 
+    * @return the project name
+    */
+   protected abstract String getProjectName();
+
+   /**
+    * Get the project description
+    * 
+    * @return the project description
+    */
+   protected abstract String getProjectDescription();
+
+   /**
+    * Check whether the output is uptodate
+    * 
+    * @param fileName the file name
+    * @return true when it is uptodate
+    */
+   protected abstract boolean isUpToDate(String fileName);
+   
+   /**
+    * Get the base directory of the project
+    * 
+    * @return the base directory of the project
+    */
+   protected abstract File getBaseDir();
+
+   /**
+    * Append the eclipse projects
+    * 
+    * @param projects the projects element
+    */
+   protected void appendEclipseProjects(Element projects)
+   {
+   }
+
+   /**
+    * Append the eclipse build spec
+    * 
+    * @param buildSpec the buildSpec element
+    */
+   protected void appendEclipseBuildSpec(Element buildSpec)
+   {
+   }
+
+   /**
+    * Append the eclipse natures
+    * 
+    * @param natures the natures element
+    */
+   protected void appendEclipseNatures(Element natures)
+   {
+   }
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/AbstractIDETask.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/BuildTask.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/BuildTask.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/BuildTask.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.tasks.build;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.jboss.ant.types.build.Build;
+import org.jboss.ant.util.graph.Graph;
+
+/**
+ * A BuildTask.
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class BuildTask extends Task
+{
+
+   /**
+    * Create a new BuildTask.
+    * 
+    * 
+    */
+   public BuildTask()
+   {
+
+   }
+
+   /** 
+    * Get the graph from the build
+    *
+    * @return
+    */
+   protected Graph getGraph()
+   {
+      //get the graph we will traverse
+      Graph graph = this.getBuildInstance().getGraph();
+   
+      if (graph == null)
+      {
+         throw (new BuildException("A component graph has not yet been generated.\n"
+               + "Please ensure that the task 'synchronizeinfo' is executed prior to this one"));
+      }
+      return graph;
+   }
+
+   /**
+    * Get the build
+    * 
+    * @return the build
+    */
+   protected Build getBuildInstance()
+   {
+      Build build = Build.getBuild();
+   
+      if (build == null || build.isBuild() == false)
+         throw new BuildException("Not a main build?");
+      return build;
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/BuildTask.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/CopyWithZipFileSetSupport.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/CopyWithZipFileSetSupport.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/CopyWithZipFileSetSupport.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.tasks.build;
+
+import java.io.File;
+import java.util.Vector;
+
+import org.apache.tools.ant.taskdefs.Copy;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.ZipFileSet;
+import org.jboss.ant.util.FileUtil;
+
+/**
+ * A copy task that supports both
+ * filesets and zipfilesets
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class CopyWithZipFileSetSupport extends BuildTask
+{
+
+   /** The fileSets */
+   private Vector fileSets;
+
+   /** The zipFileSets */
+   private Vector zipFileSets;
+
+   /** The toDir */
+   private String toDir;
+
+   /**
+    * Get the fileSets.
+    * 
+    * @return the fileSets.
+    */
+   public Vector getFileSets()
+   {
+      return fileSets;
+   }
+
+   /**
+    * Set the fileSets.
+    * 
+    * @param fileSets The fileSets to set.
+    */
+   public void setFileSets(Vector fileSets)
+   {
+      this.fileSets = fileSets;
+   }
+
+   /**
+    * Get the zipFileSets.
+    * 
+    * @return the zipFileSets.
+    */
+   public Vector getZipFileSets()
+   {
+      return zipFileSets;
+   }
+
+   /**
+    * Set the zipFileSets.
+    * 
+    * @param zipFileSets The zipFileSets to set.
+    */
+   public void setZipFileSets(Vector zipFileSets)
+   {
+      this.zipFileSets = zipFileSets;
+   }
+
+   /**
+    * Set the fileset.
+    * 
+    * @param fileset The fileset to set.
+    */
+   public void addFileset(FileSet fileset)
+   {
+      fileSets.add(fileset);
+   }
+
+   /**
+    * Get the toDir.
+    * 
+    * @return the toDir.
+    */
+   public String getToDir()
+   {
+      return toDir;
+   }
+
+   /**
+    * Set the toDir.
+    * 
+    * @param toDir The toDir to set.
+    */
+   public void setToDir(String toDir)
+   {
+      this.toDir = toDir;
+   }
+
+   /**
+    * Set the zipfileset.
+    * 
+    * @param zipfileset The zipfileset to set.
+    */
+   public void addZipfileset(ZipFileSet zipfileset)
+   {
+      zipFileSets.add(zipfileset);
+   }
+
+   /**
+    * Execute a copy task checking for
+    * filesets and zipfilesets
+    */
+   public CopyWithZipFileSetSupport()
+   {
+      zipFileSets = new Vector();
+      fileSets = new Vector();
+   }
+
+   public void execute()
+   {
+      //if we have filesets, then copy them
+      if (this.getFileSets().size() != 0)
+      {
+         for (int i = 0; i < this.getFileSets().size(); i++)
+         {
+            FileSet currentFileSet = (FileSet) this.getFileSets().elementAt(i);
+
+            Copy newCopy = new Copy();
+            newCopy.setProject(this.getProject());
+            newCopy.setTodir(new File(this.getToDir()));
+            newCopy.addFileset(currentFileSet);
+            newCopy.setTaskName("copy");
+            newCopy.execute();
+
+         }
+      }
+
+      //if we have zipfilesets, copy them
+      if (this.getZipFileSets().size() != 0)
+      {
+
+         for (int i = 0; i < this.getZipFileSets().size(); i++)
+         {
+            ZipFileSet currentZipFileSet = (ZipFileSet) this.getZipFileSets().elementAt(i);
+
+            Copy newCopy = new Copy();
+            newCopy.setProject(this.getProject());
+            newCopy.addFileset((FileSet) currentZipFileSet);
+            newCopy.setTaskName("copy");
+
+            //if a prefix has been set we need to copy it to the outputdirectory/prefix
+            if (currentZipFileSet.getPrefix(this.getProject()) != null)
+            {
+               newCopy.setTodir(FileUtil.resolve(new File(this.getToDir()), currentZipFileSet.getPrefix(this.getProject())));
+            }
+            else
+               newCopy.setTodir(new File(this.getToDir()));
+
+            newCopy.execute();
+         }
+      }
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/CopyWithZipFileSetSupport.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/GenerateLibrariesFile.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/GenerateLibrariesFile.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/GenerateLibrariesFile.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.tasks.build;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.util.FileUtil;
+import org.jboss.ant.util.graph.ComponentRefGraphClasspathVisitor;
+import org.jboss.ant.util.graph.Graph;
+
+/**
+ * Generates a file which defines classpaths information
+ * in buildmagic format  
+ *  
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class GenerateLibrariesFile extends BuildTask
+{
+
+   /** The file to generate */
+   private String fileName = "libraries.ent";
+
+   private String aliasFileName = "aliases.ent";
+
+   /** The location */
+   private String path = "../tools/etc/buildmagic/";
+
+   /**
+    * Create a new GenerateLibrariesFile.
+    */
+   public GenerateLibrariesFile()
+   {
+   }
+
+   /**
+    * Generate a file which contains classpath information in buildmagic
+    * format
+    */
+   public void execute()
+   {
+      //determine the base location of where the aliases file is
+      File baseLocation = FileUtil.resolve(this.getBuildInstance().getProject().getBaseDir(), path);
+
+      //determine the location of the file we will output
+      File output = FileUtil.resolve(this.getBuildInstance().getProject().getBaseDir(), this.getFileName());
+
+      //determine location of the aliases.ent input file
+      File input = FileUtil.resolve(baseLocation, this.aliasFileName);
+
+      File outputPath = new File(output.getParent());
+    
+      try
+      {
+         //if the directory we wish to place the 
+         //generated file does not exist, then create it
+         if (outputPath.exists()==false)
+            outputPath.mkdirs();
+    
+         //create the file if it does not exist
+         output.createNewFile();
+
+         //create a writer for the file
+         FileWriter fileWriter = new FileWriter(output);
+         BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
+
+         //create a visitor to visit the graph and provide the writer it should use
+         ComponentRefGraphClasspathVisitor visitor = new ComponentRefGraphClasspathVisitor( getProject() );
+         visitor.setBufferedWriter(bufferedWriter);
+
+         //get the graph the visitor should visit
+         Graph graph = getGraph();
+
+         //make the visitor traverse the graph
+         graph.breadthFirstSearch(graph.getVertex(0), visitor);
+
+         //clear the marking
+         graph.clearMark();
+
+         // Open the file that is the first 
+         // command line parameter
+         FileInputStream fstream = new FileInputStream(input);
+
+         // append the aliases.ent input file to our current file
+         BufferedReader in = new BufferedReader(new InputStreamReader(fstream));
+
+         int ch;
+         ch = in.read();
+
+         while (ch != -1)
+         {
+            bufferedWriter.write(ch);
+            ch = in.read();
+         }
+
+         in.close();
+
+         //close the writer object
+         bufferedWriter.flush();
+         bufferedWriter.close();
+      }
+      catch (FileNotFoundException e)
+      {
+         throw (new BuildException("Unable to find file:\n " + output.getAbsolutePath() + "/" + getFileName() + ":\n"
+               + e.getMessage()));
+
+      }
+      catch (IOException e)
+      {
+         throw (new BuildException("Unable to read or write to file:\n " + output.getAbsolutePath() + ":\n"
+               + e.getMessage()));
+      }
+
+   }
+
+   /**
+    * Get the fileName.
+    * 
+    * @return the fileName.
+    */
+   public String getFileName()
+   {
+      return fileName;
+   }
+
+   /**
+    * Set the fileName.
+    * 
+    * @param fileName The fileName to set.
+    */
+   public void setFileName(String fileName)
+   {
+      this.fileName = fileName;
+   }
+
+   /**
+    * Get the path.
+    * 
+    * @return the path.
+    */
+   public String getPath()
+   {
+      return path;
+   }
+
+   /**
+    * Set the path.
+    * 
+    * @param path The path to set.
+    */
+   public void setPath(String path)
+   {
+      this.path = path;
+   }
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/GenerateLibrariesFile.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/IDETask.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/IDETask.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/IDETask.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.tasks.build;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.tasks.AbstractIDETask;
+import org.jboss.ant.types.build.Build;
+import org.jboss.ant.util.FileUtil;
+
+/**
+ * The main ide task.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class IDETask extends AbstractIDETask
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new ide task
+    */
+   public IDETask()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+
+   // AbstractIDETask overrides -------------------------------------
+
+   protected String getProjectName()
+   {
+      return getBuild().getId();
+   }
+
+   protected String getProjectDescription()
+   {
+      return getBuild().getDescription();
+   }
+   
+   protected boolean isUpToDate(String fileName)
+   {
+      File file = FileUtil.resolve(getBaseDir(), fileName);
+      if (file.exists() == false)
+         return false;
+      
+      long lastModifiedFile = file.lastModified();
+      
+      File build = getBuild().getBuildFile();
+      if (build.lastModified() > lastModifiedFile)
+         return false;
+      
+      return true;
+   }
+   
+   protected File getBaseDir()
+   {
+      return getBuild().getDir();
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Get the build
+    * 
+    * @return the build
+    */
+   protected Build getBuild()
+   {
+      Build build = Build.getBuild();
+      if (build == null || build.isBuild() == false)
+         throw new BuildException("Not a main build?");
+      return build;
+   }
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/IDETask.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/RMICHelper.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/RMICHelper.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/RMICHelper.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,366 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.tasks.build;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Rmic;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+
+/**
+ * This task makes an rmic ant task call.  
+ * Depending on which attributes are defined
+ * and what there values are, the call to
+ * the core ant task differs. 
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class RMICHelper extends BuildTask
+{
+
+   /** The base attribute*/
+   private String base;
+
+   /** The classname attribute */
+   private String classname;
+
+   /** The verify attribute */
+   private String verify;
+
+   /** The debug attribute */
+   private String debug;
+
+   /** The iiop attribute */
+   private String iiop;
+
+   /** The idl attribute */
+   private String idl;
+
+   /** The includes attribute */
+   private String includes;
+
+   /** The external flag  attribute*/
+   private String external;
+
+   /** The nested classpath element*/
+   private Path classpath;
+
+   public RMICHelper()
+   {
+
+   }
+
+   public void execute()
+   {
+      this.setTaskName("RMICHelper");
+
+      //determine if the files to be compiled
+      //are local to the source tree or 
+      //are external 
+      //if external, call rmic once for each of the classnames defined
+      //otherwise we assume rmic is being called for a file 
+      //that exists in the source tree so we do not explicitily
+      //list a classname
+      if ((this.getExternal() != null) && (this.getExternal().equalsIgnoreCase("true")))
+      {
+
+         //many classes may be defined, split them up
+         String classes[] = this.getIncludes().split(", ");
+
+         for (int i = 0; i < classes.length; i++)
+         {
+            Rmic rmic = new Rmic();
+            rmic.setTaskName("rmic");
+            rmic.setProject(this.getProject());
+
+            this.getProject().log("Classname: " + removeExtension(classes[i]).trim(), Project.MSG_DEBUG);
+            rmic.setClassname(removeExtension(classes[i]).trim());
+
+            this.getProject().log("Verify: " + this.getVerify(), Project.MSG_DEBUG);
+            rmic.setVerify(getBooleanValue(this.getVerify()));
+
+            this.getProject().log("IIOP: " + this.getIiop(), Project.MSG_DEBUG);
+            rmic.setIiop(getBooleanValue(this.getIiop()));
+
+            this.getProject().log("Debug: " + this.getDebug(), Project.MSG_DEBUG);
+            rmic.setDebug(getBooleanValue(this.getDebug()));
+
+            this.getProject().log("Classpath: " + this.getClasspath().toString(), Project.MSG_DEBUG);
+            rmic.setClasspath(this.getClasspath());
+
+            rmic.setBase(new File(this.getBase()));
+            this.getProject().log("Base: " + this.getBase(), Project.MSG_DEBUG);
+
+            rmic.execute();
+
+         }
+      }
+      else
+      {
+         Rmic rmic = new Rmic();
+         rmic.setTaskName("rmic");
+         rmic.setProject(this.getProject());
+
+         this.getProject().log("Includes: " + this.getIncludes(), Project.MSG_DEBUG);
+         rmic.setIncludes(this.getIncludes());
+
+         this.getProject().log("Verify: " + this.getVerify(), Project.MSG_DEBUG);
+         rmic.setVerify(getBooleanValue(this.getVerify()));
+
+         this.getProject().log("IIOP: " + this.getIiop(), Project.MSG_DEBUG);
+         rmic.setIiop(getBooleanValue(this.getIiop()));
+
+         this.getProject().log("Debug: " + this.getDebug(), Project.MSG_DEBUG);
+         rmic.setDebug(getBooleanValue(this.getDebug()));
+
+         this.getProject().log("Classpath: " + this.getClasspath().toString(), Project.MSG_DEBUG);
+         rmic.setClasspath(this.getClasspath());
+
+         this.getProject().log("Base: " + this.getBase(), Project.MSG_DEBUG);
+         rmic.setBase(new File(this.getBase()));
+
+         rmic.execute();
+
+      }
+
+   }
+
+   /** 
+    * Remove the .class extension from a classname
+    * if it is present
+    * 
+    * @param classname
+    * @return
+    */
+   private String removeExtension(String classname)
+   {
+      int dot = classname.lastIndexOf(".class");
+
+      if (dot == -1)
+         return classname;
+      else
+         return (classname.substring(dot + 1));
+   }
+
+   /** 
+    * Return the boolean value of a string
+    * @param value
+    * @return
+    */
+   private boolean getBooleanValue(String value)
+   {
+      if (value.equalsIgnoreCase("true"))
+         return true;
+      else if (value.equalsIgnoreCase("false"))
+         return false;
+      else
+         throw (new BuildException("The string 'value' must resolve to either "
+               + "true or false but it's current value is " + value));
+   }
+
+   /**
+    * Get the base.
+    * 
+    * @return the base.
+    */
+   protected String getBase()
+   {
+      return base;
+   }
+
+   /**
+    * Set the base.
+    * 
+    * @param base The base to set.
+    */
+   public void setBase(String base)
+   {
+      this.base = base;
+   }
+
+   /**
+    * Get the classname.
+    * 
+    * @return the classname.
+    */
+   public String getClassname()
+   {
+      return classname;
+   }
+
+   /**
+    * Set the classname.
+    * 
+    * @param classname The classname to set.
+    */
+   public void setClassname(String classname)
+   {
+      this.classname = classname;
+   }
+
+   /**
+    * Get the debug.
+    * 
+    * @return the debug.
+    */
+   public String getDebug()
+   {
+      return debug;
+   }
+
+   /**
+    * Set the debug.
+    * 
+    * @param debug The debug to set.
+    */
+   public void setDebug(String debug)
+   {
+      this.debug = debug;
+   }
+
+   /**
+    * Get the idl.
+    * 
+    * @return the idl.
+    */
+   public String getIdl()
+   {
+      return idl;
+   }
+
+   /**
+    * Set the idl.
+    * 
+    * @param idl The idl to set.
+    */
+   public void setIdl(String idl)
+   {
+      this.idl = idl;
+   }
+
+   /**
+    * Get the iiop.
+    * 
+    * @return the iiop.
+    */
+   public String getIiop()
+   {
+      return iiop;
+   }
+
+   /**
+    * Set the iiop.
+    * 
+    * @param iiop The iiop to set.
+    */
+   public void setIiop(String iiop)
+   {
+      this.iiop = iiop;
+   }
+
+   /**
+    * Get the verify.
+    * 
+    * @return the verify.
+    */
+   public String getVerify()
+   {
+      return verify;
+   }
+
+   /**
+    * Set the verify.
+    * 
+    * @param verify The verify to set.
+    */
+   public void setVerify(String verify)
+   {
+      this.verify = verify;
+   }
+
+   /**
+    * Get the classpath.
+    * 
+    * @return the classpath.
+    */
+   public Path getClasspath()
+   {
+      return classpath;
+   }
+
+   /**
+    * Get the includes.
+    * 
+    * @return the includes.s
+    */
+   public String getIncludes()
+   {
+      return includes;
+   }
+
+   /**
+    * Set the includes.
+    * 
+    * @param includes The includes to set.
+    */
+   public void setIncludes(String includes)
+   {
+      this.includes = includes;
+   }
+
+   /**
+    * Get the external.    * 
+    * @return the external.
+    */
+   public String getExternal()
+   {
+      return external;
+   }
+
+   /**
+    * Set the external.
+    * 
+    * @param external The external to set.
+    */
+   public void setExternal(String external)
+   {
+      this.external = external;
+   }
+
+   /**
+    * Set the classpath to be used for this compilation.
+    */
+   public void setClasspath(Path s)
+   {
+      createClasspath().append(s);
+   }
+
+   /**
+    * Creates a nested classpath element.
+    */
+   public Path createClasspath()
+   {
+      if (classpath == null)
+      {
+         classpath = new Path(getProject());
+      }
+      return classpath.createPath();
+   }
+
+   /**
+    * Adds a reference to a CLASSPATH defined elsewhere.
+    */
+   public void setClasspathRef(Reference ref)
+   {
+      createClasspath().setRefid(ref);
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/RMICHelper.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/SynchronizeComponentsTask.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/SynchronizeComponentsTask.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/SynchronizeComponentsTask.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,341 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.tasks.build;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.SortedSet;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.jboss.ant.types.Compatible;
+import org.jboss.ant.types.ComponentRef;
+import org.jboss.ant.types.Import;
+import org.jboss.ant.types.attributes.Version;
+import org.jboss.ant.types.build.Build;
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.util.DownloadUtil;
+import org.jboss.ant.util.FileUtil;
+import org.jboss.ant.util.ImportUtil;
+import org.jboss.ant.util.graph.ComponentRefGraphChildResolverVistor;
+import org.jboss.ant.util.graph.ComponentRefGraphFileResolverVisitor;
+import org.jboss.ant.util.graph.ComponentRefVertex;
+import org.jboss.ant.util.graph.Graph;
+import org.jboss.ant.util.graph.RootVertex;
+import org.jboss.ant.util.graph.Vertex;
+
+/**
+ * Task to synchronize third party dependencies.
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr </a>
+ * @version $Revision$
+ */
+public class SynchronizeComponentsTask extends BuildTask
+{
+
+   /**
+    * A task to which downloads third party dependencies based off a
+    * descriptive xml document
+    */
+
+   /** The build */
+   private String build;
+
+   public SynchronizeComponentsTask()
+   {
+   }
+
+   /**
+    * Synchronize all necessary third party dependencies
+    */
+   public void execute() throws BuildException
+   {
+      //create a new graph to hold dependency information
+      Graph componentRefGraph = createInitialGraph();
+
+      //create a file resolver visitor used to visit the graph
+      ComponentRefGraphFileResolverVisitor fileResolverVisitor = new ComponentRefGraphFileResolverVisitor();
+
+      //create a child expander visitor used to visit the graph
+      ComponentRefGraphChildResolverVistor childResolverVisitor = new ComponentRefGraphChildResolverVistor();
+
+      //traverse the graph and attempt to resolve all dependencies
+      resolveDependencies(componentRefGraph, fileResolverVisitor, childResolverVisitor);
+      
+      //store the graph in the build for later use 
+      this.getBuildInstance().setGraph(componentRefGraph);
+
+   }
+
+   /**
+    * Traverse a graph and resolve the component
+    * dependencies found at each vertex
+    * @param componentGraph the graph to traverse
+    * @param fileResolver the visitor which visits the graph and determines if files have been downloaded
+    * @param childResolver the visitor which visits the graph and determines if vertexes are fully resolved
+    */
+   private void resolveDependencies(Graph componentGraph, ComponentRefGraphFileResolverVisitor fileResolver,
+         ComponentRefGraphChildResolverVistor childResolver)
+      throws BuildException
+   {
+
+      do
+      {
+         //clear the unresolved components list
+         fileResolver.getUnresolvedComponents().clear();
+         childResolver.getUnexpandedVertexes().clear();
+
+         //clear the markings of the graph vertexes
+         componentGraph.clearMark();
+
+         //visit the tree and compile a list of any unresolved files
+         componentGraph.breadthFirstSearch(componentGraph.getVertex(0), fileResolver);
+
+         //download any unresolved items 
+         downloadDependencies(fileResolver.getUnresolvedComponents());
+
+         //clear the markings of the graph vertexes-must clear before new traversal
+         componentGraph.clearMark();
+
+         //visit the tree and compile list of any unresolved nodes
+         componentGraph.breadthFirstSearch(componentGraph.getVertex(0), childResolver);
+
+         //import any unresolved componenents
+         importComponents(childResolver.getUnexpandedVertexes(), componentGraph);
+
+      }
+      while ((fileResolver.getUnresolvedComponents().size() != 0)
+            || (childResolver.getUnexpandedVertexes().size() != 0));
+
+      componentGraph.clearMark();
+   }
+
+   /** Import a a list of files which contain component information
+    * 
+    * @param unexpandedVertexes the visitor which has determined the files to be imported
+    * @param graph the component reference graph
+    */
+   private void importComponents(Vector unexpandedVertexes, Graph graph)
+      throws BuildException
+   {
+      super.log("importComponents, unexpandedVertexes: "+unexpandedVertexes,
+         Project.MSG_VERBOSE);
+
+      Project project = (Project) this.getProject();
+      //for each vertex has that has not been resolved
+      for (int i = 0; i < unexpandedVertexes.size(); i++)
+      {
+         //get the vertex and component reference information
+         ComponentRefVertex currentComponentVertex = (ComponentRefVertex) unexpandedVertexes.elementAt(i);
+         ComponentRef currentComponentRef = currentComponentVertex.getComponentRef();
+         super.log("["+i+"]: "+currentComponentRef.getName());
+       
+         //check if a component already exists for this component ref in the ant project
+         Component newComponent = (Component) project.getReference(currentComponentRef.getName());
+         
+         //if it does not, import the file for the component ref
+         if (newComponent==null)
+         {
+            //import the file which describes the component information
+            //this information is stored in the ant project hashtable
+            ImportUtil.importFile(currentComponentRef.getComponentFile(), project);
+
+            //get the component from ant's hashtable and create a new type with it
+            super.log("checking componentref: "+currentComponentRef.getName(),
+               Project.MSG_VERBOSE);
+            
+            newComponent = (Component) project.getReference(currentComponentRef.getName());
+            
+            super.log("imported new component: "+newComponent,
+               Project.MSG_VERBOSE);
+            if( newComponent == null )
+               throw new BuildException("Failed to find componentref: "+currentComponentRef.getName());
+         }
+         else
+         {
+            super.log("Checking currentComponentRef: "+currentComponentRef);
+            super.log("against newComponent: "+newComponent);
+            //the component already exists as part of the project, it is a dependency for something else
+            //make sure the version of the exising component is agreeable with the current definition
+            super.log("Creating a new version from string: " + newComponent.getVersion().toString() + 
+                  " . This version will be placed in a compatible.", Project.MSG_VERBOSE);
+            
+            Version newVersion = newComponent.getVersion();
+            Compatible newVersionInfo = new Compatible(newVersion);
+            SortedSet oldVersions = currentComponentRef.getCompatibleVersions();
+            if ( oldVersions != null && oldVersions.contains(newVersionInfo) == false )
+            {
+               String newCompID = newComponent.getId();
+               String importCompID = currentComponentRef.getImportingComponent().getId();
+               throw new BuildException("A versioning problem exists:\n"
+                  + "Component: " + newCompID
+                  + " is at version: " + newVersion 
+                  + "\n but it is also required to be compatible with: " + oldVersions
+                  + "\n by: "+importCompID);
+            }
+         }         
+ 
+         //determine if this component is already present in the build,
+         //if it is not, then add it to build's component list
+         if (!this.getBuildInstance().componentExists(newComponent))
+         {
+            this.getBuildInstance().addComponent(newComponent);
+         }
+         
+         //add the component to the current component reference
+         currentComponentRef.setComponent(newComponent);
+
+         //for each import defined in the component, we will add a child node to the graph
+         //(an import == a component reference)
+         for (int j = 0; j < newComponent.getImports().size(); j++)
+         {
+            Import currentImport = (Import) newComponent.getImports().elementAt(j);
+
+            ComponentRef newComponentRef = new ComponentRef(currentImport);
+            newComponentRef.setProject(project);
+            newComponentRef.setName(currentImport.getComponentRef());
+            
+
+            //each import describes a list of versions it is compatible with
+            SortedSet compatibles = currentImport.getCompatibleVersions();
+            //TODO figure out how compatibles is going to work
+
+            newComponentRef.setCompatibleVersions(compatibles);
+            
+            
+            //add this new component reference to the build
+            this.getBuildInstance().addComponentRef(newComponentRef);
+            
+
+            //now adjust the graph to reflect the addition of a new component reference
+            ComponentRefVertex newComponentVertex = new ComponentRefVertex(newComponentRef.getId());
+            newComponentVertex.setComponentRef(newComponentRef);
+            graph.addVertex(newComponentVertex);
+            graph.addEdge(currentComponentVertex, newComponentVertex, 0);
+
+         }
+
+      }
+
+   }
+
+   /** Create the proper directory structure and download
+    *  component description files from the repository
+    * 
+    * @param unresolvedComponents
+    */
+   private void downloadDependencies(Vector unresolvedComponents)
+   {
+
+      //for each component in the list
+      for (int i = 0; i < unresolvedComponents.size(); i++)
+      {
+         //get the component ref information
+         ComponentRefVertex currentComponentVertex = (ComponentRefVertex) unresolvedComponents.elementAt(i);
+         ComponentRef currentComponentRef = currentComponentVertex.getComponentRef();
+
+         //get the local directory the the file should be found in
+         File filename = FileUtil.resolve(currentComponentRef.getThirdpartyDir(), currentComponentRef.getFilename());
+         File thirdpartyVersionedDir = currentComponentRef.getThirdpartyDir();
+
+         //create the directory structure if necessary
+         if (!thirdpartyVersionedDir.exists())
+         {
+            FileUtil.mkdir(thirdpartyVersionedDir, this.getProject());
+            filename = FileUtil.resolve(currentComponentRef.getThirdpartyDir(), currentComponentRef.getFilename());
+         }
+
+         //attempt to retrieve the component information from the repository
+         URL repositoryFile = null;
+
+         try
+         {
+            repositoryFile = FileUtil.resolve(currentComponentRef.getLocationURL(), currentComponentRef.getFilename());
+         }
+         catch (MalformedURLException e)
+         {
+            throw (new BuildException(repositoryFile.getProtocol() + "://" + repositoryFile.getHost() + "/"
+                  + repositoryFile.getPath() + "/" + repositoryFile.getFile(), e));
+         }
+
+         //download the file from the repository
+         File downloadedFile = DownloadUtil.getFile(filename, repositoryFile, this.getProject());
+         currentComponentRef.setFileResolved(true);
+
+      }
+
+   }
+
+   /**Display the current list of unresolvedDependencies that a visitor has
+    * 
+    * @param visitor
+    */
+   private void viewUnresolvedDependencies(ComponentRefGraphFileResolverVisitor visitor)
+   {
+      System.out.println("Currently the following components are unresolved:");
+      for (int i = 0; i < visitor.getUnresolvedComponents().size(); i++)
+      {
+         Component unresolvedComponent = (Component) visitor.getUnresolvedComponents().elementAt(i);
+
+         System.out.println(unresolvedComponent.getId());
+      }
+   }
+
+   /**
+    * Constructs a graph based upon the components contained
+    * in the build entity with a root vertex.
+    * 
+    */
+   private Graph createInitialGraph()
+   {
+      Graph componentRefGraph = new Graph();
+
+      //create a root vertex
+      Vertex root = new RootVertex("ROOT");
+
+      //add it to the empty graph
+      componentRefGraph.addVertex(root);
+
+      Build mainBuild = getBuildInstance();
+
+      //add each component defined in the main build
+      for (int i = 0; i < mainBuild.getComponentRefs().size(); i++)
+      {
+         //look at the current component
+         ComponentRef currentComponentRef = (ComponentRef) mainBuild.getComponentRefs().elementAt(i);
+
+         //store in a vertex
+         ComponentRefVertex componentRefVertex = new ComponentRefVertex(currentComponentRef.getName());
+         componentRefVertex.setComponentRef(currentComponentRef);
+
+         //add the vertex to the graph
+         componentRefGraph.addVertex(componentRefVertex);
+         componentRefGraph.addEdge(root, componentRefVertex, 1);
+
+      }
+      return (componentRefGraph);
+   }
+
+   /**
+    * Create a visitor and associate it with the current
+    * ANT project
+    * 
+    * @return the visitor
+    */
+   private ComponentRefGraphFileResolverVisitor createVisitor()
+   {
+      //create a visitor to the graph
+      ComponentRefGraphFileResolverVisitor visitor = new ComponentRefGraphFileResolverVisitor();
+
+      return visitor;
+   }
+
+
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/SynchronizeComponentsTask.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/TargetExecutor.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/TargetExecutor.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/TargetExecutor.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.tasks.build;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * A TargetExecutor.
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class TargetExecutor extends BuildTask
+{
+
+   /** The target we wish to execute*/
+   private String target;
+
+   /**
+    * Create a new TargetExecutor.
+    */
+   public TargetExecutor()
+   {
+   }
+
+   public void execute()
+   {
+
+      if (target == null)
+         throw new BuildException("A target attribute is required for tag <execute-target>");
+
+      this.getProject().executeTarget(target);
+   }
+
+   /**
+    * Get the target.
+    * 
+    * @return the target.
+    */
+   public String getTarget()
+   {
+      return target;
+   }
+
+   /**
+    * Set the target.
+    * 
+    * @param target The target to set.
+    */
+   public void setTarget(String target)
+   {
+      this.target = target;
+   }
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/TargetExecutor.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/VisitComponentRefGraphTask.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/VisitComponentRefGraphTask.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/VisitComponentRefGraphTask.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.tasks.build;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.util.graph.Graph;
+import org.jboss.ant.util.graph.Visitor;
+import org.jboss.ant.util.graph.VisitorListener;
+
+/**
+ * Uses a componentRef graph and a dynamic visitor to produce
+ * a thirdparty-licenses.xml.
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class VisitComponentRefGraphTask extends BuildTask
+{
+
+   /** The componentVisitor */
+   private String componentVisitor;
+
+   /**
+    * Sends a visitor defined as xml attrib
+    * to the graph contained in the build
+    * 
+    * 
+    */
+   public VisitComponentRefGraphTask()
+   {
+
+   }
+
+   /**
+    * Generate thirdparty-licenses.xml file
+    */
+   public void execute() throws BuildException
+   {
+      //ensure that the componentVisitor attribute was passed in
+      if (this.getComponentVisitor() == null)
+         throw new BuildException("A componentVisitor must be defined to generate the license information");
+
+      //get the graph to traverse
+      Graph graph = getGraph();
+
+      try
+      {
+         //get the correct visitor to use
+         Class dynamicComponentVisitor = Class.forName(this.getComponentVisitor());
+         Object instantiatedVisitor = dynamicComponentVisitor.newInstance();
+         
+         if( (instantiatedVisitor instanceof Visitor) == false )
+            throw new BuildException("The class " + instantiatedVisitor.getClass()
+                  + "cannot be used to visit the graph");
+
+         Visitor visitor = (Visitor) instantiatedVisitor;
+         VisitorListener listener = null;
+         if( instantiatedVisitor instanceof VisitorListener )
+            listener = (VisitorListener) instantiatedVisitor;
+
+         // Check for the visitor implementing VisitorListener
+         if( listener != null )
+            listener.beforeVisit(graph, visitor, getProject());
+
+         //ensure the graph is ready to be traversed
+         graph.clearMark();
+
+         //send the visitor to the graph
+         graph.breadthFirstSearch(graph.getVertex(0), visitor);
+
+         // Check for the visitor implementing VisitorListener
+         if( listener != null )
+            listener.afterVisit(graph, visitor, getProject());
+
+         graph.clearMark();
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw (new BuildException("Unable to find class: " + this.getComponentVisitor(), e));
+      }
+      catch (InstantiationException e)
+      {
+         throw (new BuildException("Unable to instatiate class: " + this.getComponentVisitor(), e));
+      }
+      catch (IllegalAccessException e)
+      {
+         throw (new BuildException("Unable to access class: " + this.getComponentVisitor(), e));
+      }
+
+   }
+
+   /**
+    * Get the componentVisitor.
+    * 
+    * @return the componentVisitor.
+    */
+   public String getComponentVisitor()
+   {
+      return componentVisitor;
+   }
+
+   /**
+    * Set the componentVisitor.
+    * 
+    * @param componentVisitor The componentVisitor to set.
+    */
+   public void setComponentVisitor(String componentVisitor)
+   {
+      this.componentVisitor = componentVisitor;
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/VisitComponentRefGraphTask.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/package.html
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/package.html	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/package.html	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <!-- $Id$ -->
+    <!--
+
+    JBoss: The OpenSource J2EE WebOS 
+
+    Distributable under LGPL license.
+    See terms of license at gnu.org.
+
+    -->
+  </head>
+
+  <body bgcolor="white">
+    <p>Main build tasks.
+
+    <h2>Package Specification</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+      
+    <h2>Related Documentation</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+
+    <h2>Package Status</h2>
+    <ul>
+      <li><font color="red"><b>ALPHA</b></font>
+    </ul>
+
+    <h2>Todo</h2>
+    <ul>
+      <li>???
+    </ul>
+
+    <!-- Put @see and @since tags down here. -->
+
+  </body>
+</html>


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/build/package.html
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/component/IDETask.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/component/IDETask.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/component/IDETask.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,286 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.tasks.component;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.tasks.AbstractIDETask;
+import org.jboss.ant.types.Include;
+import org.jboss.ant.types.Source;
+import org.jboss.ant.types.build.Artifact;
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.types.component.ComponentDefinition;
+import org.jboss.ant.types.component.SourceDefinition;
+import org.jboss.ant.util.FileUtil;
+import org.jboss.ant.util.XMLUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+/**
+ * A component ide task.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class IDETask extends AbstractIDETask
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new ide task
+    */
+   public IDETask()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Task overrides ------------------------------------------------
+   
+   public void execute()
+   {
+      super.execute();
+      generateEclipseClasspath();
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // AbstractIDETask overrides -------------------------------------
+
+   protected String getProjectName()
+   {
+      return getComponentDefinition().getComponent().getId();
+   }
+
+   protected String getProjectDescription()
+   {
+      return getComponentDefinition().getDescription();
+   }
+   
+   protected boolean isUpToDate(String fileName)
+   {
+      File file = FileUtil.resolve(getBaseDir(), fileName);
+      if (file.exists() == false)
+         return false;
+      
+      long lastModifiedFile = file.lastModified();
+      
+      File build = getBuildFile();
+      if (build.lastModified() > lastModifiedFile)
+         return false;
+      
+      File mainBuild = getMainBuildFile();
+      if (mainBuild != null)
+      {
+         if (mainBuild.lastModified() > lastModifiedFile)
+            return false;
+      }
+      
+      return true;
+   }
+
+   protected File getBaseDir()
+   {
+      return getComponentDefinition().getProject().getBaseDir();
+   }
+   
+   protected void appendEclipseBuildSpec(Element buildSpec)
+   {
+      if (getComponentDefinition().getSources().size() == 0)
+         return;
+      
+      Document document = buildSpec.getOwnerDocument();
+      Element buildCommand = document.createElement("buildCommand");
+      buildSpec.appendChild(buildCommand);
+      
+      Element name = document.createElement("name");
+      buildCommand.appendChild(name);
+      Text nameText = document.createTextNode("org.eclipse.jdt.core.javabuilder");
+      name.appendChild(nameText);
+      
+      Element arguments = document.createElement("arguments");
+      buildCommand.appendChild(arguments);
+   }
+
+   protected void appendEclipseNatures(Element natures)
+   {
+      if (getComponentDefinition().getSources().size() == 0)
+         return;
+      
+      Document document = natures.getOwnerDocument();
+      Element nature = document.createElement("nature");
+      natures.appendChild(nature);
+      Text natureText = document.createTextNode("org.eclipse.jdt.core.javanature");
+      nature.appendChild(natureText);
+   }
+   
+   // Protected -----------------------------------------------------
+
+   /**
+    * Get the component definition
+    * 
+    * @return the component definition
+    */
+   protected ComponentDefinition getComponentDefinition()
+   {
+      ComponentDefinition componentDefinition = ComponentDefinition.getComponentDefinition();
+      if (componentDefinition == null)
+         throw new BuildException("No component definition?");
+      return componentDefinition;
+   }
+
+   /**
+    * Get the build file
+    * 
+    * @return the main build file
+    */
+   protected File getBuildFile()
+   {
+      return getComponentDefinition().getComponent().getBuild().getBuildFile();
+   }
+
+   /**
+    * Get the main build file if any
+    * 
+    * @return the main build file
+    */
+   protected File getMainBuildFile()
+   {
+      return getComponentDefinition().getComponent().getBuild().getMainBuildFile();
+   }
+   
+   /**
+    * Generate the eclipse classpath file
+    */
+   protected void generateEclipseClasspath()
+   {
+      ComponentDefinition componentDefinition = getComponentDefinition();
+      Vector sourceDefs = componentDefinition.getSources();
+      if (sourceDefs.size() == 0)
+         return;
+
+      if (isUpToDate(".classpath"))
+         return;
+
+      String root = FileUtil.getRoot(componentDefinition.getProject()).toString();
+
+      HashMap sources = new HashMap();
+      HashSet projects = new HashSet();
+      HashSet libraries = new HashSet(); 
+      for (int i = 0; i < sourceDefs.size(); ++i)
+      {
+         // This is a source folder
+         SourceDefinition source = (SourceDefinition) sourceDefs.get(i);
+         sources.put(source.getSourcePath(), "output/eclipse-classes/" + source.getId());
+         
+         for (int j = 0; j < source.getSize(); ++j)
+         {
+            Include include = source.getInclude(j);
+            List inputs = include.getSources();
+            for (int k = 0; k < inputs.size(); ++k)
+            {
+               Source input = (Source) inputs.get(k);
+               // Reference to source
+               if (input instanceof SourceDefinition)
+               {
+                  SourceDefinition sourceDefinition = (SourceDefinition) input;
+                  ComponentDefinition componentDef = sourceDefinition.getComponentDefinition();
+                  String projectName = componentDef.getComponent().getId();
+                  projects.add(projectName);
+               }
+               else
+               {
+                  // Reference to a jar
+                  Artifact artifact = (Artifact) input;
+                  Component component = artifact.getComponent();
+                  // In a different, but local component
+                  if (component.isLocal())
+                     projects.add(component.getId());
+                  else
+                  {
+                     // In a thirdparty jar
+                     String libName = artifact.getOutput().toString();
+                     if (libName.startsWith(root))
+                        libName = libName.substring(root.length());
+                     libraries.add(libName);
+                  }
+               }
+            }
+         }
+      }
+      
+      Document document = XMLUtil.createDocument();
+      Element classpath = document.createElement("classpath");
+      document.appendChild(classpath);
+      
+      // Create an entry for each source
+      for (Iterator i = sources.entrySet().iterator(); i.hasNext();)
+      {
+         Map.Entry entry = (Map.Entry) i.next();
+         Element src = document.createElement("classpathentry");
+         classpath.appendChild(src);
+         src.setAttribute("kind", "src");
+         src.setAttribute("path", entry.getKey().toString());
+         src.setAttribute("output", entry.getValue().toString());
+      }
+      
+      // Create an entry for source in a different project
+      projects.remove(componentDefinition.getComponent().getId());
+      for (Iterator i = projects.iterator(); i.hasNext();)
+      {
+         String projectName = (String) i.next();
+         Element src = document.createElement("classpathentry");
+         classpath.appendChild(src);
+         src.setAttribute("kind", "src");
+         src.setAttribute("path", "/" + projectName);
+      }
+
+      // Create an entry for the libraries
+      for (Iterator i = libraries.iterator(); i.hasNext();)
+      {
+         String libraryName = (String) i.next();
+         Element lib = document.createElement("classpathentry");
+         classpath.appendChild(lib);
+         lib.setAttribute("kind", "lib");
+         lib.setAttribute("path", libraryName);
+      }
+      
+      // Create an entry for the jre
+      Element jre = document.createElement("classpathentry");
+      classpath.appendChild(jre);
+      jre.setAttribute("kind", "con");
+      jre.setAttribute("path", "org.eclipse.jdt.launching.JRE_CONTAINER");
+      
+      // Create a default output entry
+      Element out = document.createElement("classpathentry");
+      classpath.appendChild(out);
+      out.setAttribute("kind", "output");
+      out.setAttribute("path", "output/eclipse-classes");
+      
+      File file = FileUtil.resolve(getBaseDir(), ".classpath");
+      XMLUtil.writeXMLDocument(file, document);
+      log("Updated " + file);
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/component/IDETask.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/component/package.html
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/component/package.html	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/component/package.html	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <!-- $Id$ -->
+    <!--
+
+    JBoss: The OpenSource J2EE WebOS 
+
+    Distributable under LGPL license.
+    See terms of license at gnu.org.
+
+    -->
+  </head>
+
+  <body bgcolor="white">
+    <p>Component build tasks.
+
+    <h2>Package Specification</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+      
+    <h2>Related Documentation</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+
+    <h2>Package Status</h2>
+    <ul>
+      <li><font color="red"><b>ALPHA</b></font>
+    </ul>
+
+    <h2>Todo</h2>
+    <ul>
+      <li>???
+    </ul>
+
+    <!-- Put @see and @since tags down here. -->
+
+  </body>
+</html>


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/component/package.html
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/package.html
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/package.html	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/package.html	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <!-- $Id$ -->
+    <!--
+
+    JBoss: The OpenSource J2EE WebOS 
+
+    Distributable under LGPL license.
+    See terms of license at gnu.org.
+
+    -->
+  </head>
+
+  <body bgcolor="white">
+    <p>Abstract task implementations.
+
+    <h2>Package Specification</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+      
+    <h2>Related Documentation</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+
+    <h2>Package Status</h2>
+    <ul>
+      <li><font color="red"><b>ALPHA</b></font>
+    </ul>
+
+    <h2>Todo</h2>
+    <ul>
+      <li>???
+    </ul>
+
+    <!-- Put @see and @since tags down here. -->
+
+  </body>
+</html>


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/tasks/package.html
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/AbstractBuildDataType.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/AbstractBuildDataType.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/AbstractBuildDataType.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.jboss.ant.targets.DynamicTarget;
+
+/**
+ * An AbstractBuildDataType.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public abstract class AbstractBuildDataType extends AbstractDataType
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new data type
+    */
+   public AbstractBuildDataType()
+   {
+      super();
+   }
+   
+   // Public --------------------------------------------------------
+   
+   /**
+    * Generate the targets
+    */
+   public void generate()
+   {
+      throw new UnsupportedOperationException("generateTargets " + this);
+   }
+   
+   // AbstractDataType overrides ------------------------------------
+   
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   /**
+    * Add a target
+    * 
+    * @param target the target
+    */
+   protected void addTarget(Target target)
+   {
+      Project project = getProject();
+      if (project == null)
+         throw new IllegalStateException("Project has not been set");
+      project.addTarget(target);
+
+      if (log.isTraceEnabled())
+         log.trace("... added target: " + target);
+   }
+   
+   /**
+    * Add the dependencies
+    * 
+    * @param target the target
+    * @param dynamicType the dynamic type
+    */
+   protected void addDepends(DynamicTarget target, DynamicType dynamicType)
+   {
+      Hashtable attributes = dynamicType.getAttributes();
+      String depends = (String) attributes.get("depends");
+      if (depends != null)
+      {
+         StringTokenizer tokenizer = new StringTokenizer(depends, ",", false);
+         while (tokenizer.hasMoreTokens())
+         {
+            String token = tokenizer.nextToken().trim();
+            target.addDependency(token);
+         }
+      }
+   }
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/AbstractBuildDataType.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/AbstractDataType.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/AbstractDataType.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/AbstractDataType.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,234 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+import java.util.Hashtable;
+import java.util.Vector;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DynamicAttribute;
+import org.apache.tools.ant.types.DataType;
+import org.jboss.ant.util.ObjectUtil;
+import org.jboss.ant.util.LoggerUtil.Logger;
+
+/**
+ * An AbstractDataType.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public abstract class AbstractDataType extends DataType implements DynamicAttribute
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /** The Logger */
+   protected Logger log;
+   
+   /** The id */
+   private String id;
+   
+   /** The dynamic attributes */
+   private Hashtable attributes = new Hashtable();
+   
+   /** Whether we are validated */
+   private boolean validated = false;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new data type
+    */
+   public AbstractDataType()
+   {
+      log = new Logger(this);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   /**
+    * Get the id.
+    * 
+    * @return the id.
+    */
+   public String getId()
+   {
+      return id;
+   }
+
+   /**
+    * Set the id.
+    * 
+    * @param id The id to set.
+    */
+   public void setId(String id)
+   {
+      this.id = id;
+      
+      if (log.isTraceEnabled())
+         log.trace("Set id: " + id);
+   }
+   
+   /**
+    * Get the name
+    * 
+    * @return the id.
+    */
+   public String getName()
+   {
+      return getId();
+   }
+
+   /**
+    * Set the name.
+    * 
+    * @param id The id to set.
+    */
+   public void setName(String id)
+   {
+      setId(id);
+   }
+   
+   /**
+    * Validate
+    */
+   public void validate()
+   {
+      if (validated == false)
+      {
+         validated = true;
+         doValidate();
+      }
+   }
+
+   /**
+    * Get the short string
+    */
+   public String toShortString()
+   {
+      StringBuffer buffer = new StringBuffer();
+      buffer.append(ObjectUtil.getObjectId(this));
+      buffer.append('{');
+      appendIdentity(buffer);
+      buffer.append("}");
+      return buffer.toString();
+   }
+
+   /**
+    * Get a dynamic attribute
+    * 
+    * @param name the name
+    * @return the attribute value
+    */
+   public String getDynamicAttribute(String name)
+   {
+      return (String) attributes.get(name);
+   }
+   
+   /**
+    * Get the attributes
+    * 
+    * @return the attributes
+    */
+   public Hashtable getAttributes()
+   {
+      return attributes;
+   }
+
+   // DynamicAttribute implementation -------------------------------
+   
+   public void setDynamicAttribute(String name, String value)
+   {
+      attributes.put(name, value);
+   }
+
+   // Object overrides ----------------------------------------------
+
+   public String toString()
+   {
+      StringBuffer buffer = new StringBuffer();
+      ObjectUtil.appendObjectId(buffer, this);
+      buffer.append('{');
+      toString(buffer);
+      buffer.append('}');
+      return buffer.toString();
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   /**
+    * Resolve the referenced object
+    * 
+    * @param context the context
+    * @param refid the reference id
+    * @return the resolved object
+    */
+   protected AbstractDataType resolve(String context, String refid, Class clazz)
+   {
+      if (refid == null)
+         throw new BuildException(context + " not set for " + toShortString());
+      Object object = getProject().getReference(refid);
+      if (object == null)
+         throw new BuildException(context + " not found for " + toShortString());
+      if (clazz.isInstance(object) == false)
+         throw new BuildException(refid + " for " + context + " is not the correct type " + object.getClass().getName());
+      return (AbstractDataType) object;
+   }
+   
+   /**
+    * Do the validation
+    */
+   protected abstract void doValidate();
+
+   /**
+    * Validate a vector of data types
+    * 
+    * @todo this should be an iterator
+    * 
+    * @param vector the vector of data types
+    */
+   protected void validate(List vector)
+   {
+      for (int i = 0; i < vector.size(); ++i)
+      {
+         AbstractDataType type = (AbstractDataType) vector.get(i);
+         type.validate();
+      }
+   }
+
+   /**
+    * Append the identity
+    * 
+    * @param buffer the buffer
+    */
+   protected void appendIdentity(StringBuffer buffer)
+   {
+      buffer.append("id=").append(id);
+   }
+   
+   /**
+    * Append the class attributes to a buffer
+    * 
+    * @param buffer the buffer
+    */
+   protected void toString(StringBuffer buffer)
+   {
+      buffer.append("id=").append(id);
+      if (attributes.size() != 0)
+         buffer.append(" atts=").append(attributes);
+   }
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/AbstractDataType.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Compatible.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Compatible.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Compatible.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.types.attributes.Version;
+
+/**
+ * A compatible version
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public class Compatible extends AbstractBuildDataType
+   implements Comparable
+{
+   /** the version */
+   private Version version;
+
+   /** the compatible */
+   private String compatible;
+
+   /**
+    * Create a new Compatible.
+    */
+   public Compatible()
+   {
+      super();
+   }
+   public Compatible(Version version)
+   {
+      super();
+      setVersion(version);
+   }
+
+   /**
+    * Get the version.
+    * 
+    * @return the version.
+    */
+   public Version getVersion()
+   {
+      return version;
+   }
+
+   /**
+    * Set the version.
+    * 
+    * @param version The version to set.
+    */
+   public void setVersion(Version version)
+   {
+      System.err.println("setVersion, version="+version);
+      this.version = version;
+   }
+
+   /**
+    * Compare based on version strings
+    * 
+    * @param o - another Compatible
+    * @return version.compareTo(o.version)
+    */
+   public int compareTo(Object o)
+   {
+      int compare = -1;
+      if( o instanceof Compatible )
+      {
+         Compatible c = (Compatible) o;
+         if( this == c || this.version == c.version )
+            compare = 0;
+         else
+            compare = version.compareTo(c.version);
+      }
+      return compare;
+   }
+
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(", version=");
+      buffer.append(version);
+   }
+   /**
+    * Resolve the compatible
+    * 
+    * @return AbstractBuildDataType
+    */
+   protected AbstractBuildDataType resolveCompatible()
+   {
+      return (AbstractBuildDataType) resolve("compatible", compatible, AbstractBuildDataType.class);
+   }
+
+   protected void doValidate()
+   {
+      if (version == null)
+         throw (new BuildException("Compatible does not have a version defined"));
+
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Compatible.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/ComponentRef.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/ComponentRef.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/ComponentRef.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,377 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.SortedSet;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.jboss.ant.types.attributes.Version;
+import org.jboss.ant.types.build.Build;
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.util.FileUtil;
+
+/**
+ * A ComponentRef (component reference), describes very basic
+ * information about a component, namely the version required
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ComponentRef extends AbstractBuildDataType
+{
+   /** The ant project */
+   Project project;
+
+   /** The id of the component reference*/
+   private String id;
+
+   /** The name of the component ref*/
+   private String name;
+
+   /** The filename where the component information can be found*/
+   private String filename = "component-info.xml";
+
+   /** The location */
+   private String location;
+
+   /** The version **/
+   private Version version;
+
+   /** SortedSet<Compatible> for the versions that can be used */
+   private SortedSet compatibles;
+
+   /** The build */
+   private Build build;
+
+   /** The component */
+   private Component component;
+
+   /** The importing component */
+   private Component importingComponent;
+
+   private boolean fileResolved;
+
+   /**
+    * Create a new ComponentRef.
+    * 
+    * 
+    */
+   public ComponentRef()
+   {
+      super();
+      component = null;
+      fileResolved = false;
+   }
+
+   public ComponentRef(Import theImport)
+   {
+
+      super();
+      importingComponent = theImport.getComponent();
+      id = theImport.getComponentRef();
+      fileResolved = false;
+      //TODO needs a function here to determine which of the compatibles (if it has them) to use
+   }
+
+   /**
+    * Set the location
+    * 
+    * @param location the location
+    */
+   public void setLocation(String location)
+   {
+      this.location = location;
+   }
+
+   /** Get the third party directory location 
+    * 
+    * @return File for the thirdparty location 
+    */
+   public File getThirdparty()
+   {
+      return FileUtil.resolve(FileUtil.getRoot(this.getProject()), getThirdpartyPath());
+   }
+
+   /** Get the third party path
+    * 
+    * @return the jbossbuild.thirdparty.dir property value
+    */
+   public String getThirdpartyPath()
+   {
+      return getProject().getProperty("jbossbuild.thirdparty.dir");
+   }
+
+   /** Get the third party directory with correct version included
+    * 
+    * @return File for the thirdparty dir of this component
+    */
+   public File getThirdpartyDir()
+   {
+      File thirdpartyRoot = FileUtil.resolve(getThirdparty(), getName());
+
+      return thirdpartyRoot;
+   }
+
+   /** get the location of the file which describes component information
+    * 
+    * @return File which describes component information
+    */
+   public File getComponentFile()
+   {
+      return FileUtil.resolve(getThirdpartyDir(), getComponentFilename());
+   }
+
+   /** get the filename of the file which describes a component
+    * 
+    * @return filename which describes a component
+    */
+   private String getComponentFilename()
+   {
+      return this.filename;
+   }
+
+   protected void doValidate()
+   {
+      if (name == null)
+      {
+         throw (new BuildException("ComponentRef must have a name defined"));
+      }
+   }
+
+   /**
+    * Get the filename.
+    * 
+    * @return the filename.
+    */
+   public String getFilename()
+   {
+      return filename;
+   }
+
+   /** Return the location of the remote file
+    * 
+    * @return
+    * @throws MalformedURLException
+    */
+   public URL getLocationURL() throws MalformedURLException
+   {
+      URL locationURL = null;
+      if (location != null)
+      {
+         locationURL = new URL(location);
+      }
+      else
+      {
+         locationURL = build.getLocationURL();
+      }
+
+      URL componentLocation = FileUtil.resolve(locationURL, getName());
+
+      if (version != null)
+      {
+         return FileUtil.resolve(componentLocation, version.toString());
+      }
+      else
+      {
+         return componentLocation;
+      }
+
+   }
+
+   /**
+    * Get the version.
+    * 
+    * @return the version.
+    */
+   public Version getVersion()
+   {
+      return version;
+   }
+
+   /**
+    * Set the version.
+    * 
+    * @param version The version to set.
+    */
+   public void setVersion(String version)
+   {
+      this.getBuild().getProject().log(
+            "Creating a new version from string: '" + version + "' for componentRef with name: " + getName(),
+            Project.MSG_DEBUG);
+      this.version = new Version(version);
+   }
+
+   public SortedSet getCompatibleVersions()
+   {
+      return compatibles;
+   }
+
+   public void setCompatibleVersions(SortedSet compatibles)
+   {
+      this.compatibles = compatibles;
+      Compatible latest = (Compatible) compatibles.last();
+      setVersion(latest.getVersion().toString());
+   }
+
+   /**
+    * Get the id.
+    * 
+    * @return the id.
+    */
+   public String getId()
+   {
+      return id;
+   }
+
+   /**
+    * Set the id.
+    * 
+    * @param id The id to set.
+    */
+   public void setId(String id)
+   {
+      this.id = id;
+   }
+
+   /**
+    * Get the build.
+    * 
+    * @return the build.
+    */
+   public Build getBuild()
+   {
+      if (build == null)
+      {
+        build=Build.getBuild(); 
+      }        
+        
+      return build;
+   }
+
+   /**
+    * Set the build.
+    * 
+    * @param build The build to set.
+    */
+   public void setBuild(Build build)
+   {
+      this.build = build;
+   }
+
+   /**
+    * Get the component.
+    * 
+    * @return the component.
+    */
+   public Component getComponent()
+   {
+      return component;
+   }
+
+   /**
+    * Set the component.
+    * 
+    * @param component The component to set.
+    */
+   public void setComponent(Component component)
+   {
+      this.component = component;
+   }
+
+   /**
+    * Get the component.
+    * 
+    * @return the component.
+    */
+   public Component getImportingComponent()
+   {
+      return importingComponent;
+   }
+
+   /**
+    * Get the project.
+    * 
+    * @return the project.
+    */
+   public Project getProject()
+   {
+      return project;
+   }
+
+   /**
+    * Set the project.
+    * 
+    * @param project The project to set.
+    */
+   public void setProject(Project project)
+   {
+      this.project = project;
+   }
+
+   /**
+    * Get the name.
+    * 
+    * @return the name.
+    */
+   public String getName()
+   {
+      return name;
+   }
+
+   /**
+    * Set the name.
+    * 
+    * @param name The name to set.
+    */
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   /**
+    * Get the fileResolved flag.
+    * 
+    * @return the fileResolved.
+    */
+   public boolean isFileResolved()
+   {
+      return fileResolved;
+   }
+
+   /**
+    * Set the fileResolved.
+    * 
+    * @param fileResolved The fileResolved to set.
+    */
+   public void setFileResolved(boolean fileResolved)
+   {
+      this.fileResolved = fileResolved;
+   }
+
+   public String toString()
+   {
+      final StringBuffer sb = new StringBuffer();
+      sb.append("ComponentRef");
+      sb.append("{id=").append(id);
+      sb.append(",name=").append(name);
+      sb.append(",filename=").append(filename);
+      sb.append(",location=").append(location);
+      sb.append(",version=").append(version);
+      sb.append(",compatibles=").append(compatibles);
+      sb.append(",component=").append(component);
+      sb.append(",importingComponent=").append(importingComponent);
+      sb.append(",fileResolved=").append(fileResolved);
+      sb.append('}');
+      return sb.toString();
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/ComponentRef.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/DynamicType.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/DynamicType.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/DynamicType.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,224 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DynamicElement;
+import org.jboss.ant.util.AttributeException;
+import org.jboss.ant.util.AttributeUtil;
+
+/**
+ * A dynamic type
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class DynamicType extends AbstractDataType implements DynamicElement
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /** The text */
+   private String text;
+
+   /** The elements */
+   private Vector elements = new Vector();
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new dynamic type
+    * 
+    * @param id the id
+    */
+   public DynamicType(String id)
+   {
+      setId(id);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   /**
+    * Get the name
+    * 
+    * @return the name.
+    */
+   public String getName()
+   {
+      return getDynamicAttribute("name");
+   }
+
+   /**
+    * Set the name.
+    * 
+    * @param name the name to set.
+    */
+   public void setName(String name)
+   {
+      setDynamicAttribute("name", name);
+   }
+
+   /**
+    * Get an attribute
+    * 
+    * @param name the attribute name
+    * @param defaultValue the default value
+    * @return the value
+    */
+   public String getAttribute(String name, String defaultValue)
+   {
+      String value = getDynamicAttribute(name);
+      if (value != null)
+         return value;
+      else
+         return defaultValue;
+   }
+   
+   /**
+    * Get the elements
+    * 
+    * @return the elements
+    */
+   public Vector getElements()
+   {
+      return elements;
+   }
+   
+   /**
+    * Get the text
+    * 
+    * @return the text
+    */
+   public String getText()
+   {
+      return text;
+   }
+   
+   /**
+    * Add some text
+    * 
+    * @param text the text
+    */
+   public void addText(String text)
+   {
+      if (this.text == null)
+         this.text = text;
+      else
+         this.text += text;
+   }
+   
+   /**
+    * Test whether this dynamic type applies
+    * 
+    * @param object the reference object
+    * @return true when it applies
+    */
+   public boolean applies(Object object)
+   {
+      String when = getAttribute("when", null);
+      if (when != null)
+      {
+         try
+         {
+            AttributeUtil.replace(object, when);
+         }
+         catch (AttributeException e)
+         {
+            throw e;
+         }
+         catch (BuildException ignored)
+         {
+            return false;
+         }
+      }
+      String isNull = getAttribute("null", null);
+      if (isNull != null)
+      {
+         try
+         {
+            AttributeUtil.replace(object, isNull);
+            return false;
+         }
+         catch (AttributeException e)
+         {
+            throw e;
+         }
+         catch (BuildException expected)
+         {
+         }
+      }
+      String ifTest = getAttribute("if", null);
+      if (ifTest != null)
+      {
+         try
+         {
+            String test = AttributeUtil.replace(object, ifTest);
+            if (Boolean.valueOf(test).booleanValue() == false)
+               return false;
+         }
+         catch (AttributeException e)
+         {
+            throw e;
+         }
+         catch (BuildException ignored)
+         {
+         }
+      }
+      String unlessTest = getAttribute("unless", null);
+      if (unlessTest != null)
+      {
+         try
+         {
+            String test = AttributeUtil.replace(object, unlessTest);
+            if (Boolean.valueOf(test).booleanValue())
+               return false;
+         }
+         catch (AttributeException e)
+         {
+            throw e;
+         }
+         catch (BuildException ignored)
+         {
+         }
+      }
+      return true;
+   }
+   
+   // DynamicElement implementation ---------------------------------
+   
+   public Object createDynamicElement(String name)
+   {
+      DynamicType result = new DynamicType(name);
+      elements.add(result);
+      return result;
+   }
+   
+   // AbstractDataType overrides ------------------------------------
+   
+   protected void doValidate()
+   {
+   }
+   
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" elements=").append(elements);
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/DynamicType.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Export.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Export.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Export.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Basically this is an include which doesn't have an ID.
+ * 
+ * @author <a href="ryan.campbell at jboss.com">Ryan Campbell</a>
+ * @version $Revision$
+ */
+public class Export extends SourceSink
+{
+// Constants -----------------------------------------------------
+
+// Attributes ----------------------------------------------------
+
+   /** The component this export is a part of **/
+   //Component component = null;
+   
+// Static --------------------------------------------------------
+
+// Constructors --------------------------------------------------
+   /**
+    * Creates a new Export for a given Component.
+    */
+   public Export() 
+   {
+      //this.component = component;
+   }
+
+// Public --------------------------------------------------------
+
+// Source overrides ----------------------------------------------
+   /**
+    * @return All the includes.
+    */
+   public List getOutputs()
+   {
+      ArrayList list = new ArrayList();
+      for (int i = 0; i < getSize(); ++i)
+      {
+         Include include = getInclude(i);
+         list.addAll(include.getFiles());
+      }
+      return list;
+   }
+
+// AbstractDataType overrides ------------------------------------
+
+// Package protected ---------------------------------------------
+
+// Protected -----------------------------------------------------
+
+// Private -------------------------------------------------------
+
+// Inner classes -------------------------------------------------
+}
+


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Export.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Generate.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Generate.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Generate.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+
+/**
+ * Generate the targets
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class Generate extends AbstractDataType
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /** What to generate */
+   private String generate;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new generate
+    */
+   public Generate()
+   {
+      super();
+   }
+   
+   // Public --------------------------------------------------------
+   
+   /**
+    * Set the generate
+    * 
+    * @param generate the generate
+    */
+   public void setGenerate(String generate)
+   {
+      this.generate = generate;
+      resolveGenerate().generate();
+   }
+   
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      resolveGenerate().validate();
+   }
+   
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" generate=").append(generate);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Resolve the generate
+    * 
+    * @return the generate
+    */
+   protected AbstractBuildDataType resolveGenerate()
+   {
+      return (AbstractBuildDataType) resolve("generate", generate, AbstractBuildDataType.class);
+   }
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Generate.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Import.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Import.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Import.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+import java.util.Vector;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.TreeSet;
+import java.util.SortedSet;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.types.build.Component;
+
+/**
+ * The import datatype
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class Import extends AbstractBuildDataType
+{
+   /** The a list of versions this import is compatible with */
+   private Vector tmpVersions = new Vector();
+   private TreeSet compatibleVersions;
+
+   /** The componentRef this import is referring too*/
+   private String componentRef;
+   /** The importing component */
+   private Component component;
+
+   /**
+    * Create a new Import.
+    */
+   public Import()
+   {
+      super();
+      compatibleVersions = new TreeSet();
+   }
+
+   protected void doValidate()
+   {
+      validate(new Vector(compatibleVersions));
+      if (componentRef == null)
+      {
+         throw (new BuildException("ComponentRef id must be defined"));
+      }
+   }
+
+   /** set the component reference
+    * 
+    * @param componentRef
+    */
+   public void setComponentRef(String componentRef)
+   {
+      this.componentRef = componentRef;
+   }
+
+   /** add a compatible to the list
+    * 
+    * @param compatible
+    */
+   public void addCompatible(Compatible compatible)
+   {
+      tmpVersions.add(compatible);
+   }
+
+   /**
+    * Get the componentRef.
+    * 
+    * @return the componentRef.
+    */
+   public String getComponentRef()
+   {
+      return componentRef;
+   }
+
+   public Component getComponent()
+   {
+      return component;
+   }
+   public void setComponent(Component component)
+   {
+      this.component = component;
+   }
+
+   /**
+    * Get the compatibleVersions.
+    * 
+    * @return the compatibleVersions.
+    */
+   public SortedSet getCompatibleVersions()
+   {
+      if( tmpVersions.size() != compatibleVersions.size() )
+      {
+         compatibleVersions.clear();
+         compatibleVersions.addAll(tmpVersions);
+      }
+      return compatibleVersions;
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Import.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Include.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Include.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Include.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,274 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.util.FileUtil;
+import org.jboss.ant.util.ImportUtil;
+
+/**
+ * Include is a reference to some output
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class Include extends AbstractBuildDataType
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /** The input */
+   private String input;
+   
+   /** The prefix of the path the files should be placed */
+   private String prefix;
+
+   /** The component to import */
+   private String component;
+   
+   /** The includes */
+   private Vector includes = new Vector();
+   
+   /** The excludes */
+   private Vector excludes = new Vector();
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new input
+    */
+   public Include()
+   {
+      super();
+   }
+   
+   // Public --------------------------------------------------------
+   
+   /**
+    * Set the input
+    * 
+    * @param input the input reference
+    */
+   public void setInput(String input)
+   {
+      this.input = input;
+   }
+   
+   /**
+    * Set the prefix
+    * 
+    * @param prefix the prefix path
+    */
+   public void setPrefix(String prefix)
+   {
+      this.prefix = prefix;
+   }
+
+   /**
+    * Get the prefix
+    * 
+    * @param prefix
+    * @return the path this include should be prefixed with
+    */
+   public String getPrefix()
+   {
+      return this.prefix;
+   }
+   
+   public void setComponent(String component)
+   {
+      this.component = component;
+   }
+
+   /**
+    * Get the files
+    * 
+    * @return List<File>
+    */
+   public List getFiles()
+   {
+      Source source = resolveInput();
+      return source.getOutputs();
+   }
+
+   /**
+    * Get the sources
+    * 
+    * @return List<Source>
+    */
+   public List getSources()
+   {
+      Source source = resolveInput();
+      if (source instanceof Includes
+            || source instanceof Export)
+      {
+         SourceSink sourceSink = (SourceSink) source;
+         ArrayList list = new ArrayList();
+         for (int i = 0; i < sourceSink.getSize(); ++i)
+         {
+            Include include = sourceSink.getInclude(i);
+            list.addAll(include.getSources());
+         }
+         return list;
+      }
+      else
+      {
+         return Collections.singletonList(source);
+      }
+   }
+   
+   /**
+    * Get the includes
+    * 
+    * @param include the includes
+    */
+   public Vector getIncludes()
+   {
+      return includes;
+   }
+   
+   /**
+    * Set an include
+    * 
+    * @param include the include
+    */
+   public void addInclude(Pattern include)
+   {
+      includes.add(include);
+   }
+   
+   /**
+    * Get the excludes
+    * 
+    * @param exclude the excludes
+    */
+   public Vector getExcludes()
+   {
+      return excludes;
+   }
+   
+   /**
+    * Set an exclude
+    * 
+    * @param exclude the exclude
+    */
+   public void addExclude(Pattern exclude)
+   {
+      excludes.add(exclude);
+   }
+   /**
+    * Get the thirdparty path
+    * 
+    * @return the thirdparty path
+    */
+   public String getThirdpartyPath()
+   {
+      return getProject().getProperty("jbossbuild.thirdparty.dir");
+   }
+      
+   /**
+    * Get the thirdparty location
+    * 
+    * @return the thirdparty location
+    */
+   public File getThirdparty()
+   {
+      return FileUtil.resolve(FileUtil.getRoot(getProject()), getThirdpartyPath());
+   }
+
+   public String getComponentInfoPath()
+   {
+      return getProject().getProperty("jbossbuild.component.info");
+   }
+
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      resolveInput().validate();
+   }
+   
+   protected void appendIdentity(StringBuffer buffer)
+   {
+      super.appendIdentity(buffer);
+      buffer.append(" input=").append(input);
+   }
+   
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" input=").append(input);
+      if (includes.size() > 0)
+         buffer.append(" includes=").append(includes);
+      if (excludes.size() > 0)
+         buffer.append(" excludes=").append(excludes);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Resolve the input
+    * 
+    * @return the input
+    */
+   protected Source resolveInput()
+   {
+      if (component != null)
+      {
+         importComponent(component);
+      }
+      if (input == null && component != null) 
+      {
+         Component importedComponent = 
+            (Component) resolve("component", component, Component.class);
+         return importedComponent.getExport();
+      } 
+      else
+      {
+         return (Source) resolve("input", input, Source.class);
+      }
+   }
+   
+   // Private -------------------------------------------------------
+
+   private void importComponent(String component) 
+   {
+      String componentInfo = component + "/" + getComponentInfoPath();
+      File componentInfoFile = 
+         FileUtil.resolve(FileUtil.getRoot(getProject()), componentInfo);
+      
+      try 
+      {
+         ImportUtil.importFile(componentInfoFile, getProject());
+      } catch (BuildException buildException) 
+      {
+         if ( buildException.getCause() instanceof FileNotFoundException)
+         {
+            componentInfoFile = FileUtil.resolve(getThirdparty(), componentInfo);
+            ImportUtil.importFile(componentInfoFile, getProject());
+         } else {
+            throw buildException;
+         }
+      }
+      
+   }
+   
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Include.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Includes.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Includes.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Includes.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * A utility for naming a set of includes.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class Includes extends SourceSink
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new includes
+    */
+   public Includes()
+   {
+      super();
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Source overrides ----------------------------------------------
+   
+   public File getOutput()
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public List getOutputs()
+   {
+      ArrayList list = new ArrayList();
+      for (int i = 0; i < getSize(); ++i)
+      {
+         Include include = getInclude(i);
+         list.addAll(include.getFiles());
+      }
+      return list;
+   }
+   
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      if (getId() == null)
+         throw new BuildException("Includes has no id");
+      super.validate();
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Includes.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Pattern.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Pattern.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Pattern.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+
+/**
+ * A pattern
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class Pattern extends AbstractBuildDataType
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /** The pattern */
+   private String pattern;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new pattern
+    */
+   public Pattern()
+   {
+      super();
+   }
+   
+   // Public --------------------------------------------------------
+   
+   /**
+    * Get the pattern
+    * 
+    * @return the pattern
+    */
+   public String getPattern()
+   {
+      return pattern;
+   }
+   
+   /**
+    * Set the pattern
+    * 
+    * @param pattern the pattern
+    */
+   public void setPattern(String pattern)
+   {
+      this.pattern = pattern;
+   }
+   
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+   }
+   
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" pattern=").append(pattern);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Pattern.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Source.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Source.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Source.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * A data type that has output.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public abstract class Source extends AbstractBuildDataType
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /** The output directory */
+   private File output;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new source
+    */
+   public Source()
+   {
+      super();
+   }
+   
+   // Public --------------------------------------------------------
+   
+   /**
+    * Get the output
+    * 
+    * @return the output
+    */
+   public File getOutput()
+   {
+      return output;
+   }
+   
+   /**
+    * Set the output
+    * 
+    * @param output the output directory
+    */
+   public void setOutput(File output)
+   {
+      this.output = output;
+
+      if (log.isTraceEnabled())
+         log.trace("Set output=" + output);
+   }
+   
+   /**
+    * Get the output directory
+    * 
+    * @return the output directory
+    */
+   public File getParentDir()
+   {
+      return getOutput().getParentFile();
+   }
+
+   /**
+    * Get the outputs
+    * 
+    * @return the outputs
+    */
+   public List getOutputs()
+   {
+      return Collections.singletonList(getOutput());
+   }
+   
+   // AbstractDataType overrides ------------------------------------
+
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" output=").append(getOutput());
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/Source.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/SourceSink.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/SourceSink.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/SourceSink.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types;
+
+import java.util.Vector;
+
+/**
+ * A data type that has input and output.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public abstract class SourceSink extends Source
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+
+   /** The includes */
+   private Vector includes = new Vector();
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new source sink
+    */
+   public SourceSink()
+   {
+      super();
+   }
+   
+   // Public --------------------------------------------------------
+
+   /**
+    * Create an include
+    * 
+    * @return the include
+    */
+   public Include createInclude()
+   {
+      Include include = new Include();
+      includes.add(include);
+
+      if (log.isTraceEnabled())
+         log.trace("Added include " + include + toShortString());
+
+      return include;
+   }
+
+   /**
+    * Get the includes size
+    * 
+    * @return the include size
+    */
+   public int getSize()
+   {
+      return includes.size();
+   }
+
+   /**
+    * Get an include
+    * 
+    * @param index the index of the include
+    * @return the include
+    */
+   public Include getInclude(int index)
+   {
+      return (Include) includes.get(index);
+   }
+   
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      validate(includes);
+   }
+   
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" includes=").append(includes);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/SourceSink.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/attributes/Version.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/attributes/Version.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/attributes/Version.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,255 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.attributes;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.jboss.ant.types.build.Build;
+
+/**
+ * An implementation of a version.  A version 
+ * consists of a dot decimal tupple in the format of
+ * XX.YY.ZZ where XX is the major, YY is the minor, and
+ * ZZ is the fix.  Also supports other permutations such as
+ * 1.0 or Version1.  A true version should always have
+ * at minimum a value set for major.
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class Version
+{
+
+   /** The major portion of the version */
+   private String major;
+
+   /** The minor portion of the version*/
+   private String minor;
+
+   /** The fix portion of the version*/
+   private String fix;
+
+   /** The string representation of the version */
+   private String version;
+
+   /**
+    * Create a new version
+    * by parsing the given string
+    * and assigning values to the major,
+    * minor and fix if possible
+    */
+   public Version(String version)
+   {
+      this.version = version;
+      parseVersion(version);
+      writeVersionInfo();
+   }
+
+   /** Parse a string representation 
+    * of a version and assign values to the 
+    * major, minor, and fix if possible
+    * 
+    * @param version
+    */
+   protected void parseVersion(String version)
+   {
+      //get the first dot in the version
+      //everything before it is the major version
+      int majorDot = version.indexOf(".");
+
+      if (majorDot == 0)
+      {
+         //the version starts with a dot. this is bad.
+         throw (new BuildException(
+               "An error occurred while attempting to extract a 'major' attribute of a version from string: " + version
+                     + "\n" + "Versions which start with a '.' are not supported"));
+      }
+      else if (majorDot == -1)
+      {
+         //a dot was not found in the version,
+         //major is the entire thing
+         major = new String(version);
+         return;
+      }
+      else
+      {
+         //major is the portion of string from first character 
+         //to the first dot
+         major = new String(version.substring(0, majorDot));
+      }
+
+      //get the minor version
+      int minorDot = version.indexOf(".", majorDot + 1);
+
+      if (minorDot == majorDot + 1)
+      {
+         //the minor version starts with a dot. this is bad.
+         throw (new BuildException(
+               "An error occurred while attempting\n to extract a 'minor' attribute of a version from string: "
+                     + version + "\n" + "Versions which contain a '..' are not supported"));
+      }
+      else if (minorDot == -1)
+      {
+         //a dot was not found in the version,
+         //well assume the minor is the whole thing
+         minor = new String(version.substring(majorDot + 1));
+         return;
+      }
+      else
+      {
+         //major is the portion of string from first character 
+         //to the first dot
+         minor = new String(version.substring(majorDot + 1, minorDot));
+      }
+
+      //get the fix version if anything is left
+      if (version.length() > minorDot + 1)
+      {
+         fix = new String(version.substring(minorDot + 1));
+      }
+
+   }
+
+   /** Write the information about this version
+    * to the ant log contained within this project
+    */
+   protected void writeVersionInfo()
+   {
+      Build build = Build.getBuild();
+
+      if (build != null)
+      {
+         build.getProject().log("The version is " + this.getVersion(), Project.MSG_DEBUG);
+         build.getProject().log("The version.major value is " + this.getMajor(), Project.MSG_DEBUG);
+         build.getProject().log("The version.minor value is " + this.getMinor(), Project.MSG_DEBUG);
+         build.getProject().log("The version.fix value is " + this.getFix(), Project.MSG_DEBUG);
+      }
+   }
+
+   /**
+    * Return the string representation of a version
+    */
+   public String toString()
+   {
+      return (getVersion());
+   }
+
+   /** Compare this version to another,
+    * returning 0 if they are the same, - negative number
+    * if this version is less than the other, or 
+    * a positive number if it is greater
+    * 
+    * @param compVersion
+    * @return > 0, == 0, < 0 depending on this compared to compVersion
+    */
+   public int compareTo(Version compVersion)
+   {
+      int majorCheck = 0;
+      int minorCheck = 0;
+      int fixCheck = 0;
+
+      //compare each portion of the version to the
+      //matching portion in the version to compare with
+      if (getMajor() != null)
+         majorCheck = getMajor().compareTo(compVersion.getMajor());
+
+      if ((getMinor() == null) && (compVersion.getMinor() != null))
+         minorCheck = -1;
+      if (getMinor() != null)
+         minorCheck = getMinor().compareTo(compVersion.getMinor());
+
+      if ((getFix() == null) && (compVersion.getFix() != null))
+         fixCheck = -1;
+      if (getFix() != null && (compVersion.getFix() != null))
+         fixCheck = getFix().compareTo(compVersion.getFix());
+      else if( getFix() != null )
+         fixCheck = 1;
+
+      //check for differences in order of major, minor, fix
+      //whichever differs first is the result which gets returned
+      if (majorCheck != 0)
+         return (majorCheck);
+      else if (minorCheck != 0)
+         return (minorCheck);
+      else if (fixCheck != 0)
+         return (fixCheck);
+      else
+         return 0;
+
+   }
+
+   /**
+    * Get the fix.
+    * 
+    * @return the fix.
+    */
+   protected String getFix()
+   {
+      return fix;
+   }
+
+   /**
+    * Set the fix.
+    * 
+    * @param fix The fix to set.
+    */
+   protected void setFix(String fix)
+   {
+      this.fix = fix;
+   }
+
+   /**
+    * Get the major.
+    * 
+    * @return the major.
+    */
+   protected String getMajor()
+   {
+      return major;
+   }
+
+   /**
+    * Set the major.
+    * 
+    * @param major The major to set.
+    */
+   protected void setMajor(String major)
+   {
+      this.major = major;
+   }
+
+   /**
+    * Get the minor.
+    * 
+    * @return the minor.
+    */
+   protected String getMinor()
+   {
+      return minor;
+   }
+
+   /**
+    * Set the minor.
+    * 
+    * @param minor The minor to set.
+    */
+   protected void setMinor(String minor)
+   {
+      this.minor = minor;
+   }
+
+   /**
+    * Get the version.
+    * 
+    * @return the version.
+    */
+   protected String getVersion()
+   {
+      return version;
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/attributes/Version.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Artifact.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Artifact.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Artifact.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,455 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.build;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.targets.ArtifactTarget;
+import org.jboss.ant.types.DynamicType;
+import org.jboss.ant.types.Source;
+import org.jboss.ant.types.target.TargetDefinition;
+import org.jboss.ant.util.FileUtil;
+
+/**
+ * An artifact.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class Artifact extends Source
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /** The component */
+   private Component component;
+   
+   /** The url where the artifact can be downloaded */
+   private URL location;
+
+   /** The artifact type */
+   private String artifactType;
+   
+   /** The release location */
+   private String release;
+   
+   /** The output path */
+   private String outputPath;
+
+   /** The path of the component relative to the repository root*/
+   private String relativePath;
+   
+   /** The filename, if it must differ from the id for uniqueness **/
+   private String filename;
+   
+   /** Should the artifact be exploded upon release **/
+   private boolean exploded = false;;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new artifact
+    */
+   public Artifact()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+   
+   /**
+    * Get the component
+    * 
+    * @return the component
+    */
+   public Component getComponent()
+   {
+      return component;
+   }
+   
+   /**
+    * Get the location
+    * 
+    * @return the location
+    */
+   public URL getLocationURL() throws MalformedURLException
+   {
+      if (location == null)
+      {
+         URL componentLocation = component.getLocationURL();
+         String path = getOutputPath();
+         if (path != null)
+            return new URL(componentLocation + "/" + path + "/" + getFilename());
+         else
+            return new URL(componentLocation + "/" + getFilename());
+      }
+      return location;
+   }
+
+   /**
+    * Set the location
+    * 
+    * @param location the location
+    */
+   public void setLocation(URL location)
+   {
+      this.location = location;
+      
+      if (log.isTraceEnabled())
+         log.trace("SET location=" + location);
+   }
+   
+   /**
+    * Get the release 
+    * 
+    * @return the location
+    */
+   public File getRelease()
+   {
+      if (release == null)
+         return null;
+      else
+         return FileUtil.resolve(component.getBuild().getReleaseDir(), release);
+   }
+
+   /**
+    * Set the release 
+    * 
+    * @param release the release location
+    */
+   public void setRelease(String release)
+   {
+      this.release = release;
+      
+      if (log.isTraceEnabled())
+         log.trace("SET release=" + release);
+   }
+   
+   /**
+    * Set the artifactType.
+    * 
+    * @param artifactType The artifactType to set.
+    */
+   public void setArtifactType(String artifactType)
+   {
+      this.artifactType = artifactType;
+   }   
+   
+   /**
+    * Get the artifact type
+    * 
+    * @return the artifact type
+    */
+   public ArtifactType getArtifactType()
+   {
+      //if the artifact type has already been set, resolve it and return
+      //this may happen if a user explicitly gives a type to an artifact
+      //via an attribute
+      if (artifactType != null)
+         return (ArtifactType) resolve(artifactType);
+
+      //the user has not given the artifact an explicit type
+      //determine it from the filename
+      String name = getName();
+      int dot = name.lastIndexOf('.');
+      if (dot == -1 && dot < name.length()-1)
+         throw new BuildException("type not set for " + toShortString());
+      String type = name.substring(dot+1);
+      return (ArtifactType) resolve(type);
+   }
+   
+   public ArtifactType resolve (String type)
+   {
+      
+      ArtifactType currentType = (ArtifactType) ArtifactType.getArtifactTypes().get(type);
+      
+      return(currentType);
+      
+   }
+   
+   /**
+    * Set the artifact type
+    * 
+    * @param artifactType the artifact type 
+    */
+   public void setType(String artifactType)
+   {
+      this.artifactType = artifactType;
+   }
+   
+   /**
+    * Get the relative path of the artifact in the repository.
+    * @return the relative path
+    */
+   public String getRelativePath()
+   {
+       if (relativePath != null) 
+           return relativePath;
+       
+       String componentRelativePath = component.getRelativePath();
+       String outputPath = getOutputPath();
+       
+       return componentRelativePath + "/" + outputPath;
+   }
+   
+   /**
+    * Set the relative path of the artifact in the repository.
+    * ex: component-id/1.0.1/lib/artifact.jar
+    * 
+    * @param relativePath the relativePath
+    */
+   public void setRelativePath(String relativePath)
+   {
+       this.relativePath = relativePath;
+   }
+   
+   /**
+    * Set the filename, if it must be different from the id
+    * for reasons of uniqueness.
+    * 
+    * @param filename
+    */
+   public void setFilename(String filename)
+   {
+      this.filename=filename;
+   }
+   
+   
+   // Source overrides ----------------------------------------------
+   
+   public File getOutput()
+   {
+      File result = super.getOutput();
+      if (result != null)
+         return result;
+      else if (outputPath != null)
+      {
+         result = FileUtil.resolve(component.getOutput(), outputPath);
+         return FileUtil.resolve(result, getFilename());
+      }
+      else
+      {
+         int outputType = getArtifactType().getOutputType();
+         switch (outputType)
+         {
+            case ArtifactType.OUTPUT:
+               return getOutputDir();
+            case ArtifactType.LIB:
+               return getLibraryDir();
+            case ArtifactType.API:
+               return getAPIDir();
+            case ArtifactType.RESOURCE:
+               return getResourceDir();
+            case ArtifactType.BIN:
+               return getBinDir();
+            case ArtifactType.DTD:
+               return getDTDDir();
+            case ArtifactType.SCHEMA:
+               return getSchemaDir();
+            default:
+               throw new BuildException("Unrecognised output type " + outputType);
+         }
+      }
+   }
+   
+   public String getOutputPath()
+   {
+      if (outputPath != null)
+         return outputPath;
+      
+      int outputType = getArtifactType().getOutputType();
+      switch (outputType)
+      {
+         case ArtifactType.OUTPUT:
+            return null;
+         case ArtifactType.LIB:
+            return component.getLibPath();
+         case ArtifactType.API:
+            return component.getAPIPath();
+         case ArtifactType.RESOURCE:
+            return component.getResourceOutputPath();
+         case ArtifactType.BIN:
+            return component.getBinPath();
+         case ArtifactType.DTD:
+            return component.getDTDPath();
+         case ArtifactType.SCHEMA:
+            return component.getSchemaPath();
+         default:
+            throw new BuildException("Unrecognised output type " + outputType);
+      }
+   }
+   
+   public void setOutputPath(String outputPath)
+   {
+      this.outputPath = outputPath;
+   }
+   
+   public boolean isExploded()
+   {
+      return this.exploded;
+   }
+
+   public void setExploded(boolean exploded) 
+   {
+      this.exploded = exploded;
+   }
+   
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      component.validate();
+      if (getId() == null)
+         throw new BuildException("Artifact has no id/name");
+      getArtifactType().validate();
+   }
+   
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" type=").append(artifactType);
+      if (location != null)
+         buffer.append(" location=").append(location);
+      if (release != null)
+         buffer.append(" release=").append(release);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Generate targets
+    */
+   protected void generateTargets()
+   {
+      Build build = component.getBuild();
+      if (build.isBuild() || component.isStandalone())
+      {
+         Vector definitions = build.getTargetDefinitions();
+         for (int i = 0; i < definitions.size(); ++i)
+         {
+            TargetDefinition definition = (TargetDefinition) definitions.get(i);
+            List dynamicTypes = definition.getElement("artifact");
+            if (dynamicTypes != null)
+            {
+               for (int j = 0; j < dynamicTypes.size(); ++j)
+               {
+                  DynamicType type = (DynamicType) dynamicTypes.get(j);
+                  if (type.applies(this))
+                  {
+                     build.addDependency(new ArtifactTarget(this, definition));
+                     break;
+                  }
+               }
+            }
+         }
+      }
+   }
+
+   /**
+    * Set the component
+    * 
+    * @param component the component
+    */
+   protected void setComponent(Component component)
+   {
+      this.component = component;
+   }
+   
+   /**
+    * Get the output directory
+    * 
+    * @return the output directory
+    */
+   protected File getOutputDir()
+   {
+      return FileUtil.resolve(component.getOutput(), getFilename());
+   }
+   
+   /**
+    * Get the library directory
+    * 
+    * @return the library directory
+    */
+   protected File getLibraryDir()
+   {
+      return FileUtil.resolve(component.getLibraryDir(), getFilename());
+   }
+   
+   /**
+    * Get the api directory
+    * 
+    * @return the api directory
+    */
+   protected File getAPIDir()
+   {
+      return FileUtil.resolve(component.getAPIDir(), getFilename());
+   }
+   
+   /**
+    * Get the resource directory
+    * 
+    * @return the resource directory
+    */
+   protected File getResourceDir()
+   {
+      return FileUtil.resolve(component.getResourceDir(), getFilename());
+   }   
+   
+   /**
+    * Get the bin directory
+    * 
+    * @return the bin directory
+    */
+   protected File getBinDir()
+   {
+      return FileUtil.resolve(component.getBinDir(), getFilename());
+   }   
+   
+   /**
+    * Get the DTD directory
+    * 
+    * @return the bin directory
+    */
+   protected File getDTDDir()
+   {
+      return FileUtil.resolve(component.getDTDDir(), getFilename());
+   }
+   
+   /**
+    * Get the schema directory
+    * 
+    * @return the schema directory
+    */
+   protected File getSchemaDir()
+   {
+      return FileUtil.resolve(component.getSchemaDir(), getFilename());
+   }
+   
+   /**
+    * Get the filename
+    */
+   protected String getFilename() 
+   {
+      if (this.filename != null) 
+         return this.filename;
+      else
+         return getId();
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Artifact.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/ArtifactType.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/ArtifactType.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/ArtifactType.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.build;
+
+import java.util.HashMap;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.types.AbstractDataType;
+
+/**
+ * An artifact type.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class ArtifactType extends AbstractDataType
+{
+   // Constants -----------------------------------------------------
+   
+   /** Default output */
+   public static final int OUTPUT = 0;
+   
+   /** Library output */
+   public static final int LIB = 1;
+   
+   /** Library output */
+   public static final int API = 2;
+   
+   /** Resource output */
+   public static final int RESOURCE = 3;
+
+   /** bin output */
+   public static final int BIN = 4;
+
+   /** dtd output */
+   public static final int DTD = 5;
+
+   /** schema output */
+   public static final int SCHEMA = 6;
+  
+   // Attributes ----------------------------------------------------
+   
+   /** The output type */
+   private int outputType = OUTPUT;
+   
+   /** The type of this artifacttype*/
+   public String type;
+   
+   // Static --------------------------------------------------------
+   	static HashMap artifactTypes=new HashMap();
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new artifact type
+    */
+   public ArtifactType()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+   
+   /**
+    * Get the output type
+    * 
+    * @return the output type
+    */
+   public int getOutputType()
+   {
+      return outputType;
+   }
+   
+   /**
+    * Set the output type
+    * 
+    * @param type the output type
+    */
+   public void setOutputType(String type)
+   {
+      if (type.equals("lib"))
+         outputType = LIB;
+      else if (type.equals("api"))
+         outputType = API;
+      else if (type.equals("resource"))
+         outputType = RESOURCE;
+      else if (type.equals("bin"))
+         outputType = BIN;
+      else if (type.equals("dtd"))
+         outputType = DTD;
+      else if (type.equals("schema"))
+         outputType = SCHEMA;
+      else
+         throw new BuildException("Unregconised output type " + type);
+   }
+   
+   public String getType()
+   {
+      return type;
+   }
+   /**
+    * Set the type.
+    * 
+    * @param type The type to set.
+    */
+   public void setType(String type)
+   {
+      this.type = type;
+      artifactTypes.put(type, this);
+   }
+   
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      if (getType() == null)
+         throw new BuildException("Artifact type has no id/name");
+   
+   }
+   
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+   /**
+    * Get the type.
+    * 
+    * @return the type.
+    */
+ 
+   /**
+    * Get the artifactTypes.
+    * 
+    * @return the artifactTypes.
+    */
+   public static HashMap getArtifactTypes()
+   {
+      return artifactTypes;
+   }
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/ArtifactType.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Build.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Build.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Build.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,823 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.build;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.jboss.ant.targets.AbstractTargetDefinitionTarget;
+import org.jboss.ant.targets.ArtifactsTarget;
+import org.jboss.ant.targets.BuildTarget;
+import org.jboss.ant.targets.ComponentsTarget;
+import org.jboss.ant.targets.MainTarget;
+import org.jboss.ant.targets.ShowTarget;
+import org.jboss.ant.types.ComponentRef;
+import org.jboss.ant.types.DynamicType;
+import org.jboss.ant.types.Includes;
+import org.jboss.ant.types.Source;
+import org.jboss.ant.types.target.TargetDefinition;
+import org.jboss.ant.types.target.TargetDefinitions;
+import org.jboss.ant.util.FileUtil;
+import org.jboss.ant.util.ReferenceUtil;
+import org.jboss.ant.util.graph.Graph;
+
+/**
+ * A build.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class Build extends Source
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   /** Whether we are the build */
+   private boolean isBuild;
+
+   /** The build file */
+   private File buildFile;
+
+   /** The main build file */
+   private File mainBuildFile;
+   
+   /** The graph */
+   private Graph graph;
+
+   /** The components */
+   private Vector components = new Vector();
+
+   /** the component references */
+   private Vector componentrefs = new Vector();
+
+   /** The cvs root */
+   private String cvsRoot;
+
+   /** The location */
+   private String location;
+
+   /** The target definition components target */
+   private Hashtable targetMap = new Hashtable();
+
+   /** The output path */
+   private String outputPath = "output";
+
+   /** The source path */
+   private String sourcePath = "src";
+
+   /** The classes path */
+   private String classesPath = "classes";
+
+   /** The resource path */
+   private String resourcePath = "resources";
+
+   /** The resourceOutputPath path */
+   private String resourceOutputPath = "resources";
+
+   /** The resourceOutputPath path */
+   private String generatedSourceOutputPath = "gen-src";
+
+   /** The library path */
+   private String libPath = "lib";
+
+   /** The api path */
+   private String apiPath = "api";
+
+   /** The bin path */
+   private String binPath = "bin";
+
+   /** The dtd path */
+   private String dtdPath = "resources/dtd";
+
+   /** The dtd path */
+   private String schemaPath = "resources/schema";
+
+   /** The test path */
+   private String testPath = "reports";
+
+   /** The thirdparty path */
+   private String thirdpartyPath = "thirdparty";
+
+   /** The spec vendor */
+   private String specVendor;
+
+   /** The spec title */
+   private String specTitle;
+
+   /** The spec version */
+   private String specVersion;
+
+   /** The impl vendor */
+   private String implVendor = "UNSPECIFIED";
+
+   /** The impl title */
+   private String implTitle = "UNSPECIFED";
+
+   /** The impl version */
+   private String implVersion = "UNSPECIFED";
+
+   /** The impl url */
+   private String implURL = "UNSPECIFED";
+
+   // Static --------------------------------------------------------
+
+   /** The build instance */
+   private static Build buildInstance;
+
+   /**
+    * Get the build instance
+    * 
+    * @return the build instance
+    */
+   public static Build getBuild()
+   {
+      return buildInstance;
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new build
+    */
+   public Build()
+   {
+      if (buildInstance != null)
+         throw new BuildException("Duplicate build");
+      buildInstance = this;
+   }
+
+   // Public --------------------------------------------------------
+
+   /**
+    * Whether we are the build
+    * 
+    * @return true when it is the main build
+    */
+   public boolean isBuild()
+   {
+      return isBuild;
+   }
+
+   /**
+    * Whether the build is standalone
+    * 
+    * @return true when the build is standalone
+    */
+   public boolean isStandalone()
+   {
+      return mainBuildFile == null;
+   }
+
+   /**
+    * Get the components
+    * 
+    * @return the components
+    */
+   public Vector getComponents()
+   {
+      return components;
+   }
+
+   /**
+    * Add a component
+    * 
+    * @param component the component to add
+    */
+   public void addComponent(Component component)
+   {
+      
+      components.add(component);
+      component.setBuild(this);
+
+      if (log.isTraceEnabled())
+         log.trace("Add component: " + component.toShortString());
+   }
+   
+   /** Determine if a component already exists
+    * 
+    * @param component the component to check for existance
+    * @return
+    */
+   public boolean componentExists(Component component)
+   {
+      for (int i=0; i<components.size(); i++)
+      {
+         Component currentComponent = (Component) components.elementAt(i);
+         
+         if (currentComponent==component)
+            return(true);
+      }
+      
+      return(false);
+              
+   }
+
+   /**
+    * Get the component reference list.
+    * 
+    * @return the componentref.
+    */
+   public Vector getComponentRefs()
+   {
+      return componentrefs;
+   }
+
+   /** Add a component reference to the build
+    * 
+    * @param componentref
+    */
+   public void addComponentRef(ComponentRef componentref)
+   {
+      componentrefs.add(componentref);
+      componentref.setBuild(this);
+   }
+   
+
+
+   /**
+    * Add an includes
+    * 
+    * @param includes
+    */
+   public void addIncludes(Includes includes)
+   {
+   }
+
+   /**
+    * Get the target definitions
+    * 
+    * @return the target definitions
+    */
+   public Vector getTargetDefinitions()
+   {
+      return resolveTargetDefinitions().getTargetDefinitions();
+   }
+
+   /**
+    * Get the build file
+    * 
+    * @return the build file
+    */
+   public File getBuildFile()
+   {
+      return buildFile;
+   }
+
+   /**
+    * Get the main build file, if any
+    * 
+    * @return the main build file
+    */
+   public File getMainBuildFile()
+   {
+      return mainBuildFile;
+   }
+
+   /**
+    * Get the build directory
+    * 
+    * @return the build directory
+    */
+   public File getDir()
+   {
+      if (mainBuildFile != null)
+         return mainBuildFile.getParentFile();
+      else
+         return getBuildFile().getParentFile();
+   }
+
+   /**
+    * Get the thirdparty location
+    * 
+    * @return the thirdparty location
+    */
+   public File getThirdparty()
+   {
+      return FileUtil.resolve(getDir(), getThirdpartyPath());
+   }
+
+   /**
+    * Get the output path
+    * 
+    * @return the output path
+    */
+   public String getOutputPath()
+   {
+      return outputPath;
+   }
+
+   /**
+    * Set the output path
+    * 
+    * @param outputPath the output path
+    */
+   public void setOutputPath(String outputPath)
+   {
+      this.outputPath = outputPath;
+   }
+
+   /**
+    * Get the release name
+    * 
+    * @return the release name
+    */
+   public String getReleaseName()
+   {
+      String version = getImplVersion();
+      if (version != null)
+         return getId() + "-" + getImplVersion();
+      else
+         return getId();
+   }
+
+   /**
+    * Get the release directory
+    * 
+    * @return the release directory
+    */
+   public File getReleaseDir()
+   {
+      return FileUtil.resolve(getOutput(), getReleaseName());
+   }
+
+   /**
+    * Get the thirdparty path
+    * 
+    * @return the thirdparty path
+    */
+   public String getThirdpartyPath()
+   {
+      return thirdpartyPath;
+   }
+
+   /**
+    * Set the thirdparty path
+    * 
+    * @param thirdpartyPath the thirdparty path
+    */
+   public void setThirdpartyPath(String thirdpartyPath)
+   {
+      this.thirdpartyPath = thirdpartyPath;
+
+      if (log.isTraceEnabled())
+         log.trace("SET: thirdpartypath " + thirdpartyPath);
+   }
+
+   /**
+    * Get the dependency target name
+    * 
+    * @param targetName the raw target name
+    */
+   public String getDependencyTargetName(String targetName)
+   {
+      AbstractTargetDefinitionTarget componentsTarget = (AbstractTargetDefinitionTarget) targetMap.get(targetName);
+      if (componentsTarget == null)
+         return null;
+      else
+         return componentsTarget.getName();
+   }
+
+   /**
+    * Get the cvs root
+    * 
+    * @return the cvs root
+    */
+   public String getCvsroot()
+   {
+      return cvsRoot;
+   }
+
+   /**
+    * Set the cvs root
+    * 
+    * @param cvsRoot the cvs root
+    */
+   public void setCvsroot(String cvsRoot)
+   {
+      this.cvsRoot = cvsRoot;
+   }
+
+   /**
+    * Get the location
+    * 
+    * @return the location
+    */
+   public URL getLocationURL() throws MalformedURLException
+   {
+      if (location == null)
+         return null;
+      else
+         return new URL(location);
+   }
+
+   /**
+    * Set the location
+    * 
+    * @param location the location
+    */
+   public void setLocation(String location)
+   {
+      this.location = location;
+   }
+
+   /**
+    * Get the spec title
+    * 
+    * @return the title 
+    */
+   public String getSpecTitle()
+   {
+      if (specTitle == null)
+         return implTitle;
+      else
+         return specTitle;
+   }
+
+   /**
+    * Set the spec title
+    * 
+    * @param title the title
+    */
+   public void setSpecTitle(String title)
+   {
+      this.specTitle = title;
+   }
+
+   /**
+    * Get the spec version
+    * 
+    * @return the version
+    */
+   public String getSpecVersion()
+   {
+      if (specVersion == null)
+         return implVersion;
+      else
+         return specVersion;
+   }
+
+   /**
+    * Set the spec version
+    * 
+    * @param version the version
+    */
+   public void setSpecVersion(String version)
+   {
+      this.specVersion = version;
+   }
+
+   /**
+    * Get the spec vendor
+    * 
+    * @return the vendor
+    */
+   public String getSpecVendor()
+   {
+      if (specVendor == null)
+         return implVendor;
+      else
+         return specVendor;
+   }
+
+   /**
+    * Set the spec vendor
+    * 
+    * @param vendor the vendor
+    */
+   public void setSpecVendor(String vendor)
+   {
+      this.specVendor = vendor;
+   }
+
+   /**
+    * Get the impl title
+    * 
+    * @return the title 
+    */
+   public String getImplTitle()
+   {
+      return implTitle;
+   }
+
+   /**
+    * Set the impl title
+    * 
+    * @param title the title
+    */
+   public void setImplTitle(String title)
+   {
+      this.implTitle = title;
+   }
+
+   /**
+    * Get the impl version
+    * 
+    * @return the version
+    */
+   public String getImplVersion()
+   {
+      return implVersion;
+   }
+
+   /**
+    * Set the impl version
+    * 
+    * @param version the version
+    */
+   public void setImplVersion(String version)
+   {
+      this.implVersion = version;
+   }
+
+   /**
+    * Get the impl vendor
+    * 
+    * @return the vendor
+    */
+   public String getImplVendor()
+   {
+      return implVendor;
+   }
+
+   /**
+    * Set the impl vendor
+    * 
+    * @param vendor the vendor
+    */
+   public void setImplVendor(String vendor)
+   {
+      this.implVendor = vendor;
+   }
+
+   /**
+    * Get the impl url
+    * 
+    * @return the url
+    */
+   public String getImplURL()
+   {
+      return implURL;
+   }
+
+   /**
+    * Set the impl url
+    * 
+    * @param url the url
+    */
+   public void setImplURL(String url)
+   {
+      this.implURL = url;
+   }
+   
+   /**
+    * Get the graph.
+    * 
+    * @return the graph.
+    */
+   public Graph getGraph()
+   {
+      return graph;
+   }
+   /**
+    * Set the graph.
+    * 
+    * @param graph The graph to set.
+    */
+   public void setGraph(Graph graph)
+   {
+      this.graph = graph;
+   }
+
+   // Source overrides ----------------------------------------------
+
+   /**
+    * Get the output
+    * 
+    * @return the output
+    */
+   public File getOutput()
+   {
+      File result = super.getOutput();
+      if (result == null)
+         result = FileUtil.resolve(getDir(), getOutputPath());
+      return result;
+   }
+
+   // AbstractBuildDataType overrides -------------------------------
+
+   /**
+    * Generate the targets
+    */
+   public void generate()
+   {
+      validate();
+      if (isBuild())
+      {
+         generateBuildTargets();
+         generateComponentTargets();
+      }
+      else if (isStandalone())
+      {
+         generateStandaloneTargets();
+         generateComponentTargets();
+      }
+      addTarget(new ShowTarget(this));
+      
+   }
+
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      if (getId() == null)
+         throw new BuildException("Build has no id/name");
+      resolveTargetDefinitions().validate();
+      validate(components);
+      validate(componentrefs);
+   }
+
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" components=").append(components);
+      buffer.append(" cvsRoot=").append(cvsRoot);
+      buffer.append(" location=").append(location);
+   }
+
+   // DataType overrides --------------------------------------------
+
+   public void setProject(Project project)
+   {
+      if ("main.build".equals(project.getName()))
+         isBuild = true;
+      buildFile = new File(project.getProperty("ant.file"));
+      String mainBuild = project.getProperty("ant.file.main.build");
+      if (mainBuild != null)
+         mainBuildFile = new File(mainBuild);
+      super.setProject(project);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Resolve the target definitions
+    * 
+    * @return the target definitions
+    */
+   protected TargetDefinitions resolveTargetDefinitions()
+   {
+      return ReferenceUtil.resolveTargetDefinitions(getProject());
+   }
+
+   /**
+    * Generate the main build targets
+    */
+   protected void generateBuildTargets()
+   {
+      Vector definitions = getTargetDefinitions();
+      for (int i = 0; i < definitions.size(); ++i)
+      {
+         TargetDefinition definition = (TargetDefinition) definitions.get(i);
+
+         String componentsAttr = "before";
+         String artifactsAttr = "before";
+
+         /** Target of the main directory */
+         MainTarget mainTarget = null;
+         List main = definition.getMain();
+         if (main != null)
+         {
+            for (int j = 0; j < main.size(); ++j)
+            {
+               DynamicType type = (DynamicType) main.get(j);
+               if (type.applies(this))
+               {
+                  if (mainTarget == null)
+                  {
+                     mainTarget = new MainTarget(this, definition);
+                     addTarget(mainTarget);
+                  }
+                  addDepends(mainTarget, type);
+                  componentsAttr = type.getAttribute("components", componentsAttr);
+                  artifactsAttr = type.getAttribute("artifacts", artifactsAttr);
+                  break;
+               }
+            }
+         }
+
+         /** Target the components and artifacts */
+         ComponentsTarget componentsTarget = null;
+         ArtifactsTarget artifactsTarget = null;
+         if (definition.getComponent() != null)
+         {
+            componentsTarget = new ComponentsTarget(this, definition);
+            addTarget(componentsTarget);
+            targetMap.put(definition.getTarget(), componentsTarget);
+         }
+         else
+         {
+            /** Target the artifacts */
+            if (definition.getElement("artifact") != null)
+            {
+               artifactsTarget = new ArtifactsTarget(this, definition);
+               addTarget(artifactsTarget);
+               targetMap.put(definition.getTarget(), artifactsTarget);
+            }
+         }
+
+         /** Do everything */
+         BuildTarget target = new BuildTarget(this, definition);
+         addTarget(target);
+         
+         if (componentsTarget != null && componentsAttr.equals("before"))
+            target.addDependency(componentsTarget.getName());
+         if (artifactsTarget != null && artifactsAttr.equals("before"))
+            target.addDependency(artifactsTarget.getName());
+
+         if (mainTarget != null)
+            target.addDependency(mainTarget.getName());
+
+         if (componentsTarget != null && componentsAttr.equals("after"))
+            target.addDependency(componentsTarget.getName());
+         if (artifactsTarget != null && artifactsAttr.equals("after"))
+            target.addDependency(artifactsTarget.getName());
+      }
+   }
+
+   /**
+    * Generate the standalone targets
+    */
+   protected void generateStandaloneTargets()
+   {
+      Vector definitions = getTargetDefinitions();
+      for (int i = 0; i < definitions.size(); ++i)
+      {
+         TargetDefinition definition = (TargetDefinition) definitions.get(i);
+
+         /** Target the artifacts */
+         ArtifactsTarget artifactsTarget = null;
+         if (definition.getElement("artifact") != null)
+         {
+            artifactsTarget = new ArtifactsTarget(this, definition);
+            addTarget(artifactsTarget);
+            targetMap.put(definition.getTarget(), artifactsTarget);
+         }
+      }
+   }
+
+   /**
+    * Generate the component targets
+    */
+   protected void generateComponentTargets()
+   {
+      Vector components = getComponents();
+      for (int i = 0; i < components.size(); ++i)
+      {
+         Component component = (Component) components.get(i);
+         component.generateTargets();
+      }
+   }
+
+   /**
+    * Add dependency
+    * 
+    * @param target the target
+    */
+   protected void addDependency(AbstractTargetDefinitionTarget target)
+   {
+      addTarget(target);
+      TargetDefinition targetDefinition = target.getTargetDefinition();
+      String targetName = targetDefinition.getTarget();
+
+      AbstractTargetDefinitionTarget componentsTarget = (AbstractTargetDefinitionTarget) targetMap.get(targetName);
+      if (componentsTarget == null)
+      {
+         log.warn("No build target for " + targetName);
+         return;
+      }
+
+      componentsTarget.addDependency(target.getName());
+
+      if (log.isTraceEnabled())
+         log.trace("Added components dependency " + target.getName() + " for " + targetDefinition);
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Build.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Component.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Component.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Component.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,1070 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.build;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.tools.ant.Project;
+import org.jboss.ant.targets.ComponentMainTarget;
+import org.jboss.ant.targets.ComponentTarget;
+import org.jboss.ant.types.DynamicType;
+import org.jboss.ant.types.Export;
+import org.jboss.ant.types.Import;
+import org.jboss.ant.types.Source;
+import org.jboss.ant.types.attributes.Version;
+import org.jboss.ant.types.component.ComponentDefinition;
+import org.jboss.ant.types.target.TargetDefinition;
+import org.jboss.ant.types.target.TargetDefinitions;
+import org.jboss.ant.util.FileUtil;
+import org.jboss.ant.util.ReferenceUtil;
+
+/**
+ * A component.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class Component extends Source
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   /** The build */
+   private Build build;
+
+   /** The artifacts */
+   private Vector artifacts = new Vector();
+
+   /** The imports */
+   private Vector imports = new Vector();
+
+   /** The output path */
+   private String outputPath = "output";
+
+   /** The source path */
+   private String sourcePath = "src";
+
+   /** The classes path */
+   private String classesPath = "classes";
+
+   /** The resource path */
+   private String resourcePath = "resources";
+
+   /** The resourceOutputPath path */
+   private String resourceOutputPath = "resources";
+
+   /** The generated source output path */
+   private String generatedSourceOutputPath = "gen-src";
+
+   /** The library path */
+   private String libPath = "lib";
+
+   /** The api path */
+   private String apiPath = "api";
+
+   /** The bin path */
+   private String binPath = "bin";
+
+   /** The dtd path */
+   private String dtdPath = "resources/dtd";
+
+   /** The schema path */
+   private String schemaPath = "resources/schema";
+
+   /** The test path */
+   private String testPath = "reports";
+
+   /** Any component definition */
+   private ComponentDefinition componentDefinition;
+
+   /** The exported artifacts for this component **/
+   private Export export;
+
+   /** The cvs module */
+   private String module;
+
+   /** The location */
+   private String location;
+
+   /** The spec vendor */
+   private String specVendor;
+
+   /** The spec title */
+   private String specTitle;
+
+   /** The spec version */
+   private String specVersion;
+
+   /** The impl vendor */
+   private String implVendor = "UNSPECIFIED";
+
+   /** The impl title */
+   private String implTitle = "UNSPECIFED";
+
+   /** The impl version */
+   private String implVersion = "UNSPECIFED";
+
+   /** The impl url */
+   private String implURL = "UNSPECIFED";
+
+   /** The version **/
+   private Version version;
+
+   /** The relativePath **/
+   private String relativePath;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new component
+    */
+   public Component()
+   {
+   }
+
+   // Public --------------------------------------------------------
+
+   /**
+    * Get the build
+    * 
+    * @return the build
+    */
+   public Build getBuild()
+   {
+      if (build == null)
+         build = Build.getBuild();
+
+      return build;
+   }
+
+   /**
+    * Get the artifacts
+    * 
+    * @return the artifacts
+    */
+   public Vector getArtifacts()
+   {
+      return artifacts;
+   }
+
+   public Artifact createArtifact()
+   {
+      Artifact artifact = new Artifact();
+
+      artifacts.add(artifact);
+      artifact.setComponent(this);
+
+      if (log.isTraceEnabled())
+         log.trace("Added artifact " + artifact.toShortString());
+
+      return artifact;
+   }
+
+   /**
+    * Add the one export for this component.
+    * 
+    * @param export the export
+    */
+   public void addExport(Export export)
+   {
+      if (this.export != null)
+      {
+         throw new IllegalStateException("Export already set for " + this);
+      }
+      this.export = export;
+   }
+
+   /** Add an import to this component
+    * 
+    * @param importTag
+    */
+   public void addImport(Import importTag)
+   {
+      importTag.setComponent(this);
+      this.imports.add(importTag);
+   }
+
+   /**
+    * Get the imports.
+    * 
+    * @return the imports.
+    */
+   public Vector getImports()
+   {
+      return imports;
+   }
+
+   /**
+    * Get the export for this component.
+    * 
+    * @return the export of artifacts for this component.
+    */
+   public Export getExport()
+   {
+      return this.export;
+   }
+
+   /**
+    * Get the component directory
+    * 
+    * @return the component directory
+    */
+   public File getDir()
+   {
+      return FileUtil.resolve(FileUtil.getRoot(getProject()), getName());
+   }
+
+   /**
+    * Whether the component exists
+    * 
+    * @return true when the component is exists
+    */
+   public boolean getExists()
+   {
+      return getDir().isDirectory();
+   }
+
+   /**
+    * Whether the component is local
+    * 
+    * @return true when the component is local
+    */
+   public boolean isLocal()
+   {
+      return getExists() || (module != null && isCheckout());
+   }
+
+   /**
+    * Whether the component is standalone
+    * 
+    * @return true when the component is standalone
+    */
+   public boolean isStandalone()
+   {
+      return getBuild().isStandalone();
+   }
+
+   /**
+    * Get the output path
+    * 
+    * @return the output path
+    */
+   public String getOutputPath()
+   {
+      return outputPath;
+
+   }
+
+   /**
+    * Set the output directory
+    * 
+    * @param outputPath the output directory
+    */
+   public void setOutputPath(String outputPath)
+   {
+      this.outputPath = outputPath;
+      if (log.isTraceEnabled())
+         log.trace("setOutputPath, " + outputPath);
+   }
+
+   /**
+    * Get the source path
+    * 
+    * @return the source path
+    */
+   public String getSourcePath()
+   {
+      return sourcePath;
+   }
+
+   /**
+    * Set the source path
+    * 
+    * @param sourcePath the source path
+    */
+   public void setSourcePath(String sourcePath)
+   {
+      this.sourcePath = sourcePath;
+   }
+
+   /**
+    * Get the classes path
+    * 
+    * @return the classes path
+    */
+   public String getClassesPath()
+   {
+      return classesPath;
+   }
+
+   /**
+    * Set the classes path
+    * 
+    * @param classesPath the classes path
+    */
+   public void setClassesPath(String classesPath)
+   {
+      this.classesPath = classesPath;
+   }
+
+   /**
+    * Get the resource path
+    * 
+    * @return the resource path
+    */
+   public String getResourcePath()
+   {
+      return resourcePath;
+   }
+
+   /**
+    * Set the resource path
+    * 
+    * @param resourcePath the resource path
+    */
+   public void setResourcePath(String resourcePath)
+   {
+      this.resourcePath = resourcePath;
+   }
+
+   /**
+    * Get the resource output path
+    * 
+    * @return the resource output path
+    */
+   public String getResourceOutputPath()
+   {
+      return resourceOutputPath;
+   }
+
+   /**
+    * Set the resources output path
+    * 
+    * @param resourceOutputPath the classes path
+    */
+   public void setResourceOutputPath(String resourceOutputPath)
+   {
+      this.resourceOutputPath = resourceOutputPath;
+   }
+
+   /**
+    * Set the generated source output path
+    * 
+    * @param generatedSourceOutputPath the classes path
+    */
+   public void setGeneratedSourceOutputPath(String generatedSourceOutputPath)
+   {
+      this.generatedSourceOutputPath = generatedSourceOutputPath;
+   }
+
+   /**
+    * Get the generated source output path
+    * 
+    * @return the generated source output path
+    */
+   public String getGeneratedSourceOutputPath()
+   {
+      return generatedSourceOutputPath;
+   }
+
+   /**
+    * Get the library path
+    * 
+    * @return the library path
+    */
+   public String getLibPath()
+   {
+      return libPath;
+   }
+
+   /**
+    * Set the library path
+    * 
+    * @param libPath the library path
+    */
+   public void setLibPath(String libPath)
+   {
+      this.libPath = libPath;
+   }
+
+   /**
+    * Get the api path
+    * 
+    * @return the API path
+    */
+   public String getAPIPath()
+   {
+      return apiPath;
+   }
+
+   /**
+    * Set the api path
+    * 
+    * @param apiPath the API path
+    */
+   public void setAPIPAth(String apiPath)
+   {
+      this.apiPath = apiPath;
+   }
+
+   /**
+    * Get the bin path
+    * 
+    * @return the bin path
+    */
+   public String getBinPath()
+   {
+      return binPath;
+   }
+
+   /**
+    * Set the bin path
+    * 
+    * @param binPath the bin path
+    */
+   public void setBinPath(String binPath)
+   {
+      this.binPath = binPath;
+   }
+
+   /**
+    * Get the dtd path
+    * 
+    * @return the dtd path
+    */
+   public String getDTDPath()
+   {
+      return dtdPath;
+   }
+
+   /**
+    * Set the bin path
+    * 
+    * @param dtdPath the dtd path
+    */
+   public void setDTDPath(String dtdPath)
+   {
+      this.dtdPath = dtdPath;
+   }
+
+   /**
+    * Get the schema path
+    * 
+    * @return the schema path
+    */
+   public String getSchemaPath()
+   {
+      return schemaPath;
+   }
+
+   /**
+    * Set the schema path
+    * 
+    * @param schemaPath the schema path
+    */
+   public void setSchemaPath(String schemaPath)
+   {
+      this.schemaPath = schemaPath;
+   }
+
+   /**
+    * Get the test path
+    * 
+    * @return the test path
+    */
+   public String getTestPath()
+   {
+      return testPath;
+   }
+
+   /**
+    * Set the test path
+    * 
+    * @param testPath the test path
+    */
+   public void setTestPath(String testPath)
+   {
+      this.testPath = testPath;
+   }
+
+   /**
+    * Set the component definition
+    * 
+    * @param componentDefinition the component definition
+    */
+   public void setComponentDefinition(ComponentDefinition componentDefinition)
+   {
+      if (this.componentDefinition != null)
+         throw new IllegalStateException("Component definition already set " + this);
+      this.componentDefinition = componentDefinition;
+   }
+
+   /**
+    * Get the cvs module
+    * 
+    * @return the cvs module
+    */
+   public String getModule()
+   {
+      return module;
+   }
+
+   /**
+    * Set the module
+    * 
+    * @param module the module
+    */
+   public void setModule(String module)
+   {
+      this.module = module;
+   }
+
+   /**
+    * Get the location
+    * 
+    * @return the location
+    */
+   public URL getLocationURL() throws MalformedURLException
+   {
+      URL locationURL = null;
+      if (location != null)
+      {
+         locationURL = new URL(location);
+      }
+      else
+      {
+         locationURL = build.getLocationURL();
+      }
+
+      URL componentLocation = FileUtil.resolve(locationURL, getId());
+
+      if (version != null)
+      {
+         return FileUtil.resolve(componentLocation, version.toString());
+      }
+      else
+      {
+         return componentLocation;
+      }
+
+   }
+
+   /**
+    * Set the location
+    * 
+    * @param location the location
+    */
+   public void setLocation(String location)
+   {
+      this.location = location;
+   }
+
+   /**
+    * Set the version.  If this is set, will be included in location.
+    * 
+    * @param version the version
+    */
+   public void setVersion(String version)
+   {
+      this.version = new Version(version);
+   }
+
+   /**
+    * Gets the version
+    * @return the version
+    */
+   public Version getVersion()
+   {
+      return version;
+   }
+
+   /**
+    * Get the spec title
+    * 
+    * @return the title 
+    */
+   public String getSpecTitle()
+   {
+      if (specTitle == null)
+      {
+         return implTitle;
+      }
+      else
+         return specTitle;
+   }
+
+   /**
+    * Set the spec title
+    * 
+    * @param title the title
+    */
+   public void setSpecTitle(String title)
+   {
+      this.specTitle = title;
+   }
+
+   /**
+    * Get the spec version
+    * 
+    * @return the version
+    */
+   public String getSpecVersion()
+   {
+      if (specVersion == null)
+      {
+         return implVersion;
+      }
+      else
+         return specVersion;
+   }
+
+   /**
+    * Set the spec version
+    * 
+    * @param version the version
+    */
+   public void setSpecVersion(String version)
+   {
+      this.specVersion = version;
+   }
+
+   /**
+    * Get the spec vendor
+    * 
+    * @return the vendor
+    */
+   public String getSpecVendor()
+   {
+      if (specVendor == null)
+      {
+         return implVendor;
+      }
+      else
+         return specVendor;
+   }
+
+   /**
+    * Set the spec vendor
+    * 
+    * @param vendor the vendor
+    */
+   public void setSpecVendor(String vendor)
+   {
+      this.specVendor = vendor;
+   }
+
+   /**
+    * Get the impl title
+    * 
+    * @return the title 
+    */
+   public String getImplTitle()
+   {
+      return implTitle;
+   }
+
+   /**
+    * Set the impl title
+    * 
+    * @param title the title
+    */
+   public void setImplTitle(String title)
+   {
+      this.implTitle = title;
+   }
+
+   /**
+    * Get the impl version
+    * 
+    * @return the version
+    */
+   public String getImplVersion()
+   {
+      return implVersion;
+   }
+
+   /**
+    * Set the impl version
+    * 
+    * @param version the version
+    */
+   public void setImplVersion(String version)
+   {
+      this.implVersion = version;
+   }
+
+   /**
+    * Get the impl vendor
+    * 
+    * @return the vendor
+    */
+   public String getImplVendor()
+   {
+      return implVendor;
+   }
+
+   /**
+    * Set the impl vendor
+    * 
+    * @param vendor the vendor
+    */
+   public void setImplVendor(String vendor)
+   {
+      this.implVendor = vendor;
+   }
+
+   /**
+    * Get the impl url
+    * 
+    * @return the url
+    */
+   public String getImplURL()
+   {
+      return implURL;
+   }
+
+   /**
+    * Set the impl url
+    * 
+    * @param url the url
+    */
+   public void setImplURL(String url)
+   {
+      this.implURL = url;
+   }
+
+   /**
+    * Get the relative path
+    * 
+    * @param relativePath the path of the module relative to the repository root
+    */
+   public void setRelativePath(String relativePath)
+   {
+      this.relativePath = relativePath;
+   }
+
+   /**
+    * Get the relative path
+    * 
+    * @return the path for the componenent relative to the repository root
+    */
+   public String getRelativePath()
+   {
+      if (relativePath != null)
+         return relativePath;
+
+      if (version != null)
+         return getId() + "/" + version;
+      else
+         return getId();
+   }
+
+   /**
+    * Get the thirdparty path
+    * 
+    * @return the thirdparty path
+    */
+   public String getThirdpartyPath()
+   {
+      return getProject().getProperty("jbossbuild.thirdparty.dir");
+   }
+
+   /**
+    * Get the thirdparty location
+    * 
+    * @return the thirdparty location
+    */
+   public File getThirdparty()
+   {
+      return FileUtil.resolve(FileUtil.getRoot(getProject()), getThirdpartyPath());
+   }
+
+   /**
+    * Get the target definitions
+    * 
+    * @return the target definitions
+    */
+   public Vector getTargetDefinitions()
+   {
+      return resolveTargetDefinitions().getTargetDefinitions();
+   }
+
+   /**
+    * The component's thirdparty directory - ie thirdparty/component-id/1.2
+    * 
+    * This needs to be renamed so as not to be confused with getThirdparty()
+    * 
+    * If the component has a version and the directory for that version exists, use it.
+    * 
+    * @return the component's thirdparty directory
+    */
+   public File getThirdpartyDir()
+   {
+      File thirdpartyRoot = FileUtil.resolve(getThirdparty(), getId());
+
+      return thirdpartyRoot;
+   }
+
+   // Source overrides ----------------------------------------------
+
+   public File getOutput()
+   {
+      File result = super.getOutput();
+      if (result == null)
+      {
+         if (isLocal() == false)
+            result = getThirdpartyDir();
+         else
+            result = FileUtil.resolve(getDir(), getOutputPath());
+      }
+      return result;
+   }
+
+   // AbstractBuildDataType overrides -------------------------------
+
+   /**
+    * Generate the targets
+    */
+   public void generate()
+   {
+      if (componentDefinition != null)
+         componentDefinition.generate();
+      else
+         throw new IllegalStateException("Component definition not set " + this);
+   }
+
+   /**
+    * Get the virtual machine version
+    * 
+    * @return the version
+    */
+   public String getVMVersion()
+   {
+      return System.getProperty("java.vm.version");
+   }
+
+   /**
+    * Get the virtual machine vendor
+    * 
+    * @return the vendor
+    */
+   public String getVMVendor()
+   {
+      return System.getProperty("java.vm.vendor");
+   }
+
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      validate(artifacts);
+      validate(imports);
+   }
+
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" version=").append(version);
+      buffer.append(" isLocal=").append(isLocal());
+      buffer.append(" artifacts=").append(artifacts);
+      if (componentDefinition != null)
+         buffer.append(" CD=").append(componentDefinition.toShortString());
+      buffer.append(" module=").append(module);
+      buffer.append(" location=").append(location);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Generate the targets
+    */
+   protected void generateTargets()
+   {
+      //if this method is called, build will be non-null
+      if (build.isBuild())
+      {
+         if (isLocal())
+            generateComponentTargets();
+         generateComponentMainTargets();
+      }
+      generateArtifactTargets();
+   }
+
+   /**
+    * Generate component targets
+    */
+   protected void generateComponentTargets()
+   {
+      Vector definitions = getBuild().getTargetDefinitions();
+      for (int i = 0; i < definitions.size(); ++i)
+      {
+         TargetDefinition definition = (TargetDefinition) definitions.get(i);
+         List dynamicTypes = definition.getComponent();
+         if (dynamicTypes != null)
+         {
+            for (int j = 0; j < dynamicTypes.size(); ++j)
+            {
+               DynamicType type = (DynamicType) dynamicTypes.get(j);
+               if (type.getAttribute("nomain", null) == null)
+               {
+                  build.addDependency(new ComponentTarget(this, definition));
+                  break;
+               }
+            }
+         }
+      }
+   }
+
+   /**
+    * Generate component main targets
+    */
+   protected void generateComponentMainTargets()
+   {
+      Vector definitions = getBuild().getTargetDefinitions();
+      for (int i = 0; i < definitions.size(); ++i)
+      {
+         TargetDefinition definition = (TargetDefinition) definitions.get(i);
+         List dynamicTypes = definition.getElement("componentmain");
+         if (dynamicTypes != null)
+         {
+            for (int j = 0; j < dynamicTypes.size(); ++j)
+            {
+               DynamicType type = (DynamicType) dynamicTypes.get(j);
+               if (type.applies(this))
+               {
+                  build.addDependency(new ComponentMainTarget(this, definition));
+                  break;
+               }
+            }
+         }
+      }
+   }
+
+   /**
+    * Generate the artifact targets
+    */
+   protected void generateArtifactTargets()
+   {
+      Vector artifacts = getArtifacts();
+      for (int i = 0; i < artifacts.size(); ++i)
+      {
+         Artifact artifact = (Artifact) artifacts.get(i);
+         artifact.generateTargets();
+      }
+   }
+
+   /**
+    * Resolve the target definitions
+    * 
+    * @return the target definitions
+    */
+   protected TargetDefinitions resolveTargetDefinitions()
+   {
+      return ReferenceUtil.resolveTargetDefinitions(getProject());
+   }
+
+   /**
+    * Set the build
+    * 
+    * @param build the build
+    */
+   protected void setBuild(Build build)
+   {
+      this.build = build;
+   }
+
+   /**
+    * Get the library directory
+    * 
+    * @return the library directory
+    */
+   protected File getLibraryDir()
+   {
+      return FileUtil.resolve(getOutput(), getLibPath());
+   }
+
+   /**
+    * Get the api directory
+    * 
+    * @return the api directory
+    */
+   protected File getAPIDir()
+   {
+      return FileUtil.resolve(getOutput(), getAPIPath());
+   }
+
+   /**
+    * Get the resource directory
+    * 
+    * @return the resource directory
+    */
+   protected File getResourceDir()
+   {
+      return FileUtil.resolve(getOutput(), getResourceOutputPath());
+   }
+
+   /**
+    * Get the bin directory
+    * 
+    * @return the bin directory
+    */
+   protected File getBinDir()
+   {
+      return FileUtil.resolve(getOutput(), getBinPath());
+   }
+
+   /**
+    * Get the dtd directory
+    * 
+    * @return the dtd directory
+    */
+   protected File getDTDDir()
+   {
+      return FileUtil.resolve(getOutput(), getDTDPath());
+   }
+
+   /**
+    * Get the schema directory
+    * 
+    * @return the schema directory
+    */
+   protected File getSchemaDir()
+   {
+      return FileUtil.resolve(getOutput(), getSchemaPath());
+   }
+
+   // Private -------------------------------------------------------
+
+   /** 
+    * Does the developer want this component to be checked as source?
+    * 
+    * @return true if the component should be checked out.
+    */
+   private boolean isCheckout()
+   {
+      String checkout = getProject().getProperty("checkout." + getId());
+      if ("true".equalsIgnoreCase(checkout) || "yes".equalsIgnoreCase(checkout))
+      {
+         return true;
+      }
+      else
+      {
+         return false;
+      }
+   }
+   // Inner classes -------------------------------------------------
+
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/Component.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/package.html
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/package.html	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/package.html	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <!-- $Id$ -->
+    <!--
+
+    JBoss: The OpenSource J2EE WebOS 
+
+    Distributable under LGPL license.
+    See terms of license at gnu.org.
+
+    -->
+  </head>
+
+  <body bgcolor="white">
+    <p>Main build definitions.
+
+    <h2>Package Specification</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+      
+    <h2>Related Documentation</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+
+    <h2>Package Status</h2>
+    <ul>
+      <li><font color="red"><b>ALPHA</b></font>
+    </ul>
+
+    <h2>Todo</h2>
+    <ul>
+      <li>???
+    </ul>
+
+    <!-- Put @see and @since tags down here. -->
+
+  </body>
+</html>


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/build/package.html
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ArtifactDefinition.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ArtifactDefinition.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ArtifactDefinition.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,214 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.component;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.jboss.ant.targets.ArtifactDefinitionTarget;
+import org.jboss.ant.types.DynamicType;
+import org.jboss.ant.types.Include;
+import org.jboss.ant.types.Source;
+import org.jboss.ant.types.SourceSink;
+import org.jboss.ant.types.build.Artifact;
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * An artifact definition.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class ArtifactDefinition extends SourceSink
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+
+   /** The component definition */
+   private ComponentDefinition componentDefinition;
+
+   /** The artifact */
+   private String artifact;
+   
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new artifact definition
+    */
+   public ArtifactDefinition()
+   {
+      super();
+   }
+   
+   // Public --------------------------------------------------------
+
+   /**
+    * Resolve the artifact
+    * 
+    * @return the artifact
+    */
+   public Artifact getArtifact()
+   {
+      return (Artifact) resolve("artifact", artifact, Artifact.class);
+   }
+
+   /**
+    * Resolve the component
+    * 
+    * @return the component
+    */
+   public Component getComponent()
+   {
+      return getArtifact().getComponent();
+   }
+   
+   /**
+    * Set the artifact
+    * 
+    * @param artifact the artifact id
+    */
+   public void setArtifact(String artifact)
+   {
+      this.artifact = artifact;
+   }
+   
+   /**
+    * Get the target name
+    * 
+    * @return the target name
+    */
+   public String getTargetName()
+   {
+      return getArtifact().getName();
+   }
+   
+   /**
+    * Get the classpath
+    * 
+    * @return a space separate list of included jar artifacts
+    */
+   public String getClasspath()
+   {
+      boolean space = false;
+      StringBuffer buffer = new StringBuffer();
+      for (int i = 0; i < getSize(); ++i)
+      {
+         Include include = getInclude(i);
+         for (Iterator j = include.getSources().iterator(); j.hasNext();)
+         {
+            Source source = (Source) j.next();
+            if (source instanceof SourceDefinition)
+            {
+               SourceDefinition sourceDefinition = (SourceDefinition) source;
+               if (space == false)
+                  space = true;
+               else
+                  buffer.append(" ");
+               sourceDefinition.appendClasspath(buffer);
+            }
+         }
+      }
+      return buffer.toString();
+   }
+   
+   // Source overrides ----------------------------------------------
+   
+   public File getOutput()
+   {
+      return getArtifact().getOutput();
+   }
+
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      getArtifact().validate();
+      componentDefinition.validate();
+      super.doValidate();
+   }
+   
+   protected void appendIdentity(StringBuffer buffer)
+   {
+      super.appendIdentity(buffer);
+      buffer.append(" artifact=").append(artifact);
+   }
+
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" artifact=").append(artifact);
+   }
+   
+   // DataType overrides --------------------------------------------
+   
+   public String getDescription()
+   {
+      String description = super.getDescription();
+      if (description == null)
+         description = getArtifact().getDescription();
+      if (description == null)
+         description = componentDefinition.getDescription();
+      if (description == null)
+         description = getArtifact().getId();
+      return description;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Generate the targets
+    */
+   protected void generateTargets()
+   {
+      Vector definitions = componentDefinition.getComponent().getTargetDefinitions();
+      for (int i = 0; i < definitions.size(); ++i)
+      {
+         TargetDefinition definition = (TargetDefinition) definitions.get(i);
+         List dynamicTypes = definition.getElement(getArtifact().getArtifactType().getType());
+         if (dynamicTypes != null)
+         {
+            for (int j = 0; j < dynamicTypes.size(); ++ j)
+            {
+               ArtifactDefinitionTarget target = null;
+               DynamicType dynamicType = (DynamicType) dynamicTypes.get(j);
+               if (dynamicType.applies(this))
+               {
+                  if (target == null)
+                  {
+                     target = new ArtifactDefinitionTarget(this, definition);
+                     componentDefinition.addDependency(target);
+                  }
+                  addDepends(target, dynamicType);
+                  break;
+               }
+            }
+         }
+      }
+   }
+
+   /**
+    * Set the component definition
+    * 
+    * @param componentDefinition the component definition
+    */
+   protected void setComponentDefinition(ComponentDefinition componentDefinition)
+   {
+      this.componentDefinition = componentDefinition;
+   }
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ArtifactDefinition.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ComponentDefinition.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ComponentDefinition.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ComponentDefinition.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,452 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.component;
+
+import java.io.File;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.targets.AbstractTargetDefinitionTarget;
+import org.jboss.ant.targets.ComponentDefinitionTarget;
+import org.jboss.ant.targets.ShowTarget;
+import org.jboss.ant.types.DynamicType;
+import org.jboss.ant.types.Source;
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.types.target.TargetDefinition;
+import org.jboss.ant.util.FileUtil;
+
+/**
+ * A component definition.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class ComponentDefinition extends Source
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   /** The component */
+   private String component;
+   
+   /** The artifact definitions */
+   private Vector artifactDefinitions = new Vector();
+   
+   /** The source definitions */
+   private Vector sourceDefinitions = new Vector();
+
+   /** The resource definitions */
+   private Vector resourceDefinitions = new Vector();
+
+   /** The generated source definitions */
+   private Vector generatedSourceDefinitions = new Vector();
+
+   /** The target definition components target */
+   private Hashtable targetMap = new Hashtable();
+   
+   // Static --------------------------------------------------------
+
+   /** The component definition instance */
+   private static ComponentDefinition componentDefinitionInstance;
+   
+   /**
+    * Get the component definition instance
+    *
+    * @return the component definition instsance
+    */
+   public static ComponentDefinition getComponentDefinition()
+   {
+      return componentDefinitionInstance;
+   }
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new component definition
+    */
+   public ComponentDefinition()
+   {
+      if (componentDefinitionInstance != null)
+         throw new BuildException("Duplicate component definition");
+      componentDefinitionInstance = this;
+   }
+   
+   // Public --------------------------------------------------------
+
+   /**
+    * Get the component
+    * 
+    * @return the component
+    */
+   public Component getComponent()
+   {
+      return (Component) resolve("component", component, Component.class);
+   }
+   
+   /**
+    * Set the component
+    * 
+    * @param component the component
+    */
+   public void setComponent(String component)
+   {
+      this.component = component;
+      if (log.isTraceEnabled())
+         log.trace("Set component: " + component);
+      getComponent().setComponentDefinition(this);
+   }
+   
+   /**
+    * Get the sources
+    * 
+    * @return the sources
+    */
+   public Vector getSources()
+   {
+      return sourceDefinitions;
+   }
+   
+   /**
+    * Add a source
+    * 
+    * @param sourceDefinition the source definition
+    */
+   public void addSource(SourceDefinition sourceDefinition)
+   {
+      sourceDefinitions.add(sourceDefinition);
+      sourceDefinition.setComponentDefinition(this);
+
+      if (log.isTraceEnabled())
+         log.trace("Added source " + sourceDefinition.toShortString());
+   }
+   
+   /**
+    * Get the resources
+    * 
+    * @return the resources
+    */
+   public Vector getResources()
+   {
+      return resourceDefinitions;
+   }
+
+   /**
+    * Add a resource
+    * 
+    * @param resourceDefinition the resource definition
+    */
+   public void addResource(ResourceDefinition resourceDefinition)
+   {
+      resourceDefinitions.add(resourceDefinition);
+      resourceDefinition.setComponentDefinition(this);
+
+      if (log.isTraceEnabled())
+         log.trace("Added resource " + resourceDefinition.toShortString());
+   }
+   
+   /**
+    * Get the generated sources
+    * 
+    * @return the generated sources
+    */
+   public Vector getGeneratedSources()
+   {
+      return generatedSourceDefinitions;
+   }
+
+   /**
+    * Add a generated source
+    * 
+    * @param generatedSourceDefinition the generated source definition
+    */
+   public void addGeneratedSource(GeneratedSourceDefinition generatedSourceDefinition)
+   {
+      generatedSourceDefinitions.add(generatedSourceDefinition);
+      generatedSourceDefinition.setComponentDefinition(this);
+
+      if (log.isTraceEnabled())
+         log.trace("Added generated source " + generatedSourceDefinition.toShortString());
+   }
+
+   /**
+    * Get the artifacts
+    * 
+    * @return the artifacts
+    */
+   public Vector getArtifacts()
+   {
+      return artifactDefinitions;
+   }
+   
+   /**
+    * Add an artifact
+    * 
+    * @param artifactDefinition the artifact definition
+    */
+   public void addArtifactDef(ArtifactDefinition artifactDefinition)
+   {
+      artifactDefinitions.add(artifactDefinition);
+      artifactDefinition.setComponentDefinition(this);
+
+      if (log.isTraceEnabled())
+         log.trace("Added artifact " + artifactDefinition.toShortString());
+   }
+   
+   // Source overrides ----------------------------------------------
+   
+   /**
+    * Get the output
+    * 
+    * @return the output
+    */
+   public File getOutput()
+   {
+      return getComponent().getOutput();
+   }
+
+   // AbstractBuildDataType overrides -------------------------------
+   
+   /**
+    * Generate the targets
+    */
+   public void generate()
+   {
+      validate();
+      generateTargets();
+      generateResourceTargets();
+      generateGeneratedSourceTargets();
+      generateSourceTargets();
+      generateArtifactTargets();
+      addTarget(new ShowTarget(this));
+   }
+
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      getComponent().validate();
+      validate(sourceDefinitions);
+      validate(artifactDefinitions);
+      validate(resourceDefinitions);
+      validate(generatedSourceDefinitions);
+   }
+   
+   protected void appendIdentity(StringBuffer buffer)
+   {
+      super.appendIdentity(buffer);
+      buffer.append(" component=").append(component);
+   }
+
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" component=").append(component);
+      if (sourceDefinitions.size() > 0)
+         buffer.append(" sources=").append(sourceDefinitions);
+      if (artifactDefinitions.size() > 0)
+         buffer.append(" artifactDefs=").append(artifactDefinitions);
+   }
+   
+   // DataType overrides --------------------------------------------
+   
+   public String getDescription()
+   {
+      String description = super.getDescription();
+      if (description == null)
+         description = getComponent().getDescription();
+      if (description == null)
+         description = getComponent().getBuild().getDescription();
+      return description;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Generate the target definition targets
+    */
+   protected void generateTargets()
+   {
+      Vector definitions = getComponent().getTargetDefinitions();
+      for (int i = 0; i < definitions.size(); ++i)
+      {
+         TargetDefinition definition = (TargetDefinition) definitions.get(i);
+         List component = definition.getComponent();
+         if (component != null)
+         {
+            ComponentDefinitionTarget target = null;
+            for (int j = 0; j < component.size(); ++j)
+            {
+               DynamicType type = (DynamicType) component.get(j);
+               if (type.applies(this))
+               {
+                  if (target == null)
+                  {
+                     target = new ComponentDefinitionTarget(this, definition);
+                     addTarget(target);
+                     targetMap.put(definition.getTarget(), target);
+                     addDepends(target, type);
+                     break;
+                  }
+               }
+            }
+         }
+      }
+   }
+   
+   /**
+    * Generate the source targets
+    */
+   protected void generateSourceTargets()
+   {
+      Vector sources = getSources();
+      for (int i = 0; i < sources.size(); ++i)
+      {
+         SourceDefinition source = (SourceDefinition) sources.get(i);
+         source.generateTargets();
+      }
+   }
+
+   /**
+    * Generate the source targets
+    */
+   protected void generateResourceTargets()
+   {
+      Vector resources = getResources();
+      for (int i = 0; i < resources.size(); ++i)
+      {
+         ResourceDefinition resource = (ResourceDefinition) resources.get(i);
+         resource.generateTargets();
+      }
+   }
+
+   /**
+    * Generate the generated source targets
+    */
+   protected void generateGeneratedSourceTargets()
+   {
+      Vector generatedSources = getGeneratedSources();
+      for (int i = 0; i < generatedSources.size(); ++i)
+      {
+         GeneratedSourceDefinition genSource = 
+            (GeneratedSourceDefinition) generatedSources.get(i);
+         genSource.generateTargets();
+      }
+   }
+   
+   /**
+    * Generate the artifact targets
+    */
+   protected void generateArtifactTargets()
+   {
+      Vector artifacts = getArtifacts();
+      for (int i = 0; i < artifacts.size(); ++i)
+      {
+         ArtifactDefinition artifact = (ArtifactDefinition) artifacts.get(i);
+         artifact.generateTargets();
+      }
+   }
+
+   /**
+    * Add dependency
+    * 
+    * @param target the target
+    */
+   protected void addDependency(AbstractTargetDefinitionTarget target)
+   {
+      addTarget(target);
+      TargetDefinition targetDefinition = target.getTargetDefinition();
+      String targetName = targetDefinition.getTarget();
+      ComponentDefinitionTarget componentsTarget = (ComponentDefinitionTarget) targetMap.get(targetName);
+      if (componentsTarget == null)
+         throw new BuildException("No components target for " + targetDefinition);
+      componentsTarget.addDependency(target.getName());
+      
+      if (log.isTraceEnabled())
+         log.trace("Added components dependency " + target.getName() + " for " + targetDefinition);
+   }
+   
+   /**
+    * Get the source path
+    * 
+    * @param name the name of the source
+    * @return the source path
+    */
+   protected String getSourcePath(String name)
+   {
+      return getComponent().getSourcePath() + "/" + name;
+   }
+
+   /**
+    * Get the resource path
+    * 
+    * @param name the name of the resource
+    * @return the resource path
+    */
+   protected String getResourcePath(String name)
+   {
+      return getComponent().getResourcePath() + "/" + name;
+   }
+
+   /**
+    * Get the test path
+    * 
+    * @param name the name of the source
+    * @return the test path
+    */
+   protected String getTestPath(String name)
+   {
+      return getComponent().getTestPath() + "/" + name;
+   }
+   
+   /**
+    * Get the class output
+    * 
+    * @param name the name of the source
+    * @return the class output directory
+    */
+   protected File getClassOutput(String name)
+   {
+      File output = getOutput();
+      File classes = FileUtil.resolve(output, getComponent().getClassesPath());
+      return FileUtil.resolve(classes, name);
+   }
+
+   /**
+    * Get the resource output
+    * 
+    * @param name the name of the resource
+    * @return the resource output directory
+    */
+   protected File getResourceOutput(String name)
+   {
+      File output = getOutput();
+      File resources = FileUtil.resolve(output, getComponent().getResourceOutputPath());
+      return FileUtil.resolve(resources, name);
+   }
+
+   /**
+    * Get the resource output
+    * 
+    * @param name the name of the resource
+    * @return the resource output directory
+    */
+   protected File getGeneratedSourceOutput(String name)
+   {
+      File output = getOutput();
+      File resources = FileUtil.resolve(output, getComponent().getGeneratedSourceOutputPath());
+      return FileUtil.resolve(resources, name);
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ComponentDefinition.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/GeneratedSourceDefinition.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/GeneratedSourceDefinition.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/GeneratedSourceDefinition.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,176 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.component;
+
+import java.io.File;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.targets.GeneratedSourceDefinitionTarget;
+import org.jboss.ant.types.DynamicType;
+import org.jboss.ant.types.SourceSink;
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.types.target.TargetDefinition;
+
+/**
+ * A resource definition.
+ * 
+ * @author <a href="ryan.campbell at jboss.com">Ryan Campbell</a>
+ * @version $Revision$
+ */
+public class GeneratedSourceDefinition extends SourceSink
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   /** The component definition */
+   private ComponentDefinition componentDefinition;
+
+   /** A custom resource path, I.E. not the name which is the default **/
+   private String path;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new resource definition
+    */
+   public GeneratedSourceDefinition()
+   {
+   }
+
+   // Public --------------------------------------------------------
+
+   /**
+    * Get the component
+    * 
+    * @return the component
+    */
+   public Component getComponent()
+   {
+      return componentDefinition.getComponent();
+   }
+
+   /**
+    * Get the component definition
+    * 
+    * @return the component definition
+    */
+   public ComponentDefinition getComponentDefinition()
+   {
+      return componentDefinition;
+   }
+
+   /**
+    * Set the path - allows overriding of conventional id/name as path
+    * 
+    * @param path the relative path to the generatedSource
+    */
+   public void setPath(String path)
+   {
+   	this.path = path;
+   }
+   
+   /**
+    * Get the path to the generatedSource
+    * 
+    * @return the path to the generatedSource
+    */
+   public String getPath() 
+   {
+       if (path == null) 
+           return getName();
+       else
+           return path;
+   }
+   
+   
+   
+   // Source overrides ----------------------------------------------
+
+   public File getOutput()
+   {
+      File result = super.getOutput();
+      if (result == null)
+         result = componentDefinition.getGeneratedSourceOutput(getPath());
+      return result;
+   }
+
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      componentDefinition.validate();
+      if (getId() == null)
+         throw new BuildException("GeneratedSource has no id/name");
+      super.doValidate();
+   }
+
+   // DataType overrides --------------------------------------------
+
+   public String getDescription()
+   {
+      String description = super.getDescription();
+      if (description == null)
+         description = componentDefinition.getDescription();
+      if (description == null)
+         description = getId();
+      return description;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Generate the targets
+    */
+   protected void generateTargets()
+   {
+      Vector definitions = getComponent().getTargetDefinitions();
+      for (int i = 0; i < definitions.size(); ++i)
+      {
+         TargetDefinition definition = (TargetDefinition) definitions.get(i);
+         List dynamicTypes = definition.getElement("generatedsource");
+         if (dynamicTypes != null)
+         {
+            for (int j = 0; j < dynamicTypes.size(); ++ j)
+            {
+               GeneratedSourceDefinitionTarget target = null;
+               DynamicType dynamicType = (DynamicType) dynamicTypes.get(j);
+               if (dynamicType.applies(this))
+               {
+                  if (target == null)
+                  {
+                     target = new GeneratedSourceDefinitionTarget(this, definition);
+                     componentDefinition.addDependency(target);
+                  }
+                  addDepends(target, dynamicType);
+                  break;
+               }
+            }
+         }
+      }
+   }
+
+   /**
+    * Set the component definition
+    * 
+    * @param componentDefinition the component definition
+    */
+   protected void setComponentDefinition(ComponentDefinition componentDefinition)
+   {
+      this.componentDefinition = componentDefinition;
+   }
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/GeneratedSourceDefinition.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ResourceDefinition.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ResourceDefinition.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ResourceDefinition.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,197 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.component;
+
+import java.io.File;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.targets.ResourceDefinitionTarget;
+import org.jboss.ant.types.DynamicType;
+import org.jboss.ant.types.SourceSink;
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.types.target.TargetDefinition;
+import org.jboss.ant.util.FileUtil;
+
+/**
+ * A resource definition.
+ * 
+ * @author <a href="ryan.campbell at jboss.com">Ryan Campbell</a>
+ * @version $Revision$
+ */
+public class ResourceDefinition extends SourceSink
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   /** The component definition */
+   private ComponentDefinition componentDefinition;
+
+   /** A custom resource path, I.E. not the name which is the default **/
+   private String path;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new resource definition
+    */
+   public ResourceDefinition()
+   {
+   }
+
+   // Public --------------------------------------------------------
+
+   /**
+    * Get the component
+    * 
+    * @return the component
+    */
+   public Component getComponent()
+   {
+      return componentDefinition.getComponent();
+   }
+
+   /**
+    * Get the component definition
+    * 
+    * @return the component definition
+    */
+   public ComponentDefinition getComponentDefinition()
+   {
+      return componentDefinition;
+   }
+
+   /**
+    * Get the source path
+    * 
+    * @return the source path
+    */
+   public String getResourcePath()
+   {
+      return componentDefinition.getResourcePath(getName());
+   }
+
+   /**
+    * Get the source directory
+    * 
+    * @return the source directory
+    */
+   public File getResourceDir()
+   {
+      return FileUtil.resolve(getProject().getBaseDir(), getResourcePath());
+   }
+
+   /**
+    * Set the path - allows overriding of conventional id/name as path
+    * 
+    * @param path the relative path to the resource
+    */
+   public void setPath(String path)
+   {
+   	this.path = path;
+   }
+   
+   /**
+    * Get the path to the resource
+    * 
+    * @return the path to the resource
+    */
+   public String getPath() 
+   {
+       if (path == null) 
+           return getName();
+       else
+           return path;
+   }
+   
+   
+   
+   // Source overrides ----------------------------------------------
+
+   public File getOutput()
+   {
+      File result = super.getOutput();
+      if (result == null)
+         result = componentDefinition.getResourceOutput(getPath());
+      return result;
+   }
+
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      componentDefinition.validate();
+      if (getId() == null)
+         throw new BuildException("Resource has no id/name");
+      super.doValidate();
+   }
+
+   // DataType overrides --------------------------------------------
+
+   public String getDescription()
+   {
+      String description = super.getDescription();
+      if (description == null)
+         description = componentDefinition.getDescription();
+      if (description == null)
+         description = getId();
+      return description;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Generate the targets
+    */
+   protected void generateTargets()
+   {
+      Vector definitions = getComponent().getTargetDefinitions();
+      for (int i = 0; i < definitions.size(); ++i)
+      {
+         TargetDefinition definition = (TargetDefinition) definitions.get(i);
+         List dynamicTypes = definition.getElement("resource");
+         if (dynamicTypes != null)
+         {
+            for (int j = 0; j < dynamicTypes.size(); ++ j)
+            {
+               ResourceDefinitionTarget target = null;
+               DynamicType dynamicType = (DynamicType) dynamicTypes.get(j);
+               if (dynamicType.applies(this))
+               {
+                  if (target == null)
+                  {
+                     target = new ResourceDefinitionTarget(this, definition);
+                     componentDefinition.addDependency(target);
+                  }
+                  addDepends(target, dynamicType);
+                  break;
+               }
+            }
+         }
+      }
+   }
+
+   /**
+    * Set the component definition
+    * 
+    * @param componentDefinition the component definition
+    */
+   protected void setComponentDefinition(ComponentDefinition componentDefinition)
+   {
+      this.componentDefinition = componentDefinition;
+   }
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/ResourceDefinition.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/SourceDefinition.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/SourceDefinition.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/SourceDefinition.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,254 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.component;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.targets.SourceDefinitionTarget;
+import org.jboss.ant.types.DynamicType;
+import org.jboss.ant.types.Include;
+import org.jboss.ant.types.Source;
+import org.jboss.ant.types.SourceSink;
+import org.jboss.ant.types.build.Artifact;
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.types.target.TargetDefinition;
+import org.jboss.ant.util.FileUtil;
+
+/**
+ * A source definition.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class SourceDefinition extends SourceSink
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   /** The component definition */
+   private ComponentDefinition componentDefinition;
+
+   /** The test pattern */
+   private String test;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new source definition
+    */
+   public SourceDefinition()
+   {
+   }
+
+   // Public --------------------------------------------------------
+
+   /**
+    * Get the component
+    * 
+    * @return the component
+    */
+   public Component getComponent()
+   {
+      return componentDefinition.getComponent();
+   }
+
+   /**
+    * Get the component definition
+    * 
+    * @return the component definition
+    */
+   public ComponentDefinition getComponentDefinition()
+   {
+      return componentDefinition;
+   }
+
+   /**
+    * Get the source path
+    * 
+    * @return the source path
+    */
+   public String getSourcePath()
+   {
+      return componentDefinition.getSourcePath(getName());
+   }
+
+   /**
+    * Get the source directory
+    * 
+    * @return the source directory
+    */
+   public File getSourceDir()
+   {
+      return FileUtil.resolve(getProject().getBaseDir(), getSourcePath());
+   }
+
+   /**
+    * Get the test path
+    * 
+    * @return the test path
+    */
+   public String getTestPath()
+   {
+      return componentDefinition.getTestPath(getName());
+   }
+
+   /**
+    * Get the test directory
+    * 
+    * @return the test directory
+    */
+   public File getTestDir()
+   {
+      return FileUtil.resolve(componentDefinition.getOutput(), getTestPath());
+   }
+
+   /**
+    * Get the test pattern
+    * 
+    * @return the test pattern.
+    */
+   public String getTest()
+   {
+      return test;
+   }
+
+   /**
+    * Set the test pattern.
+    * 
+    * @param test the test pattern.
+    */
+   public void setTest(String test)
+   {
+      this.test = test;
+   }
+
+   // Source overrides ----------------------------------------------
+
+   public File getOutput()
+   {
+      File result = super.getOutput();
+      if (result == null)
+         result = componentDefinition.getClassOutput(getName());
+      return result;
+   }
+
+   // AbstractDataType overrides ------------------------------------
+
+   protected void doValidate()
+   {
+      componentDefinition.validate();
+      if (getId() == null)
+         throw new BuildException("Source has no id/name");
+      super.doValidate();
+   }
+
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      if (test != null)
+         buffer.append(" test=").append(test);
+   }
+
+   // DataType overrides --------------------------------------------
+
+   public String getDescription()
+   {
+      String description = super.getDescription();
+      if (description == null)
+         description = componentDefinition.getDescription();
+      if (description == null)
+         description = getId();
+      return description;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Generate the targets
+    */
+   protected void generateTargets()
+   {
+      Vector definitions = getComponent().getTargetDefinitions();
+      
+      for (int i = 0; i < definitions.size(); ++i)
+      {
+         TargetDefinition definition = (TargetDefinition) definitions.get(i);
+         List dynamicTypes = definition.getElement("source");
+         if (dynamicTypes != null)
+         {
+            for (int j = 0; j < dynamicTypes.size(); ++ j)
+            {
+               SourceDefinitionTarget target = null;
+               DynamicType dynamicType = (DynamicType) dynamicTypes.get(j);
+               if (dynamicType.applies(this))
+               {
+                  if (target == null)
+                  {
+                     target = new SourceDefinitionTarget(this, definition);
+                     componentDefinition.addDependency(target);
+                  }
+                  addDepends(target, dynamicType);
+                  break;
+               }
+            }
+         }
+      }
+   }
+
+   /**
+    * Set the component definition
+    * 
+    * @param componentDefinition the component definition
+    */
+   protected void setComponentDefinition(ComponentDefinition componentDefinition)
+   {
+      this.componentDefinition = componentDefinition;
+   }
+   
+   /**
+    * Append the classpath
+    * 
+    * @return a space separate list of included jar artifacts
+    */
+   protected void appendClasspath(StringBuffer buffer)
+   {
+      boolean space = false;
+      for (int i = 0; i < getSize(); ++i)
+      {
+         Include include = getInclude(i);
+         for (Iterator j = include.getSources().iterator(); j.hasNext();)
+         {
+            Source source = (Source) j.next();
+            if (source instanceof Artifact)
+            {
+               Artifact artifact = (Artifact) source;
+               if ("jar".equals(artifact.getArtifactType().getId()))
+               {
+                  if (space == false)
+                     space = true;
+                  else
+                     buffer.append(" ");
+                  buffer.append(artifact.getId());
+               }
+            }
+         }
+      }
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/SourceDefinition.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/package.html
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/package.html	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/package.html	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <!-- $Id$ -->
+    <!--
+
+    JBoss: The OpenSource J2EE WebOS 
+
+    Distributable under LGPL license.
+    See terms of license at gnu.org.
+
+    -->
+  </head>
+
+  <body bgcolor="white">
+    <p>Component build definitions.
+
+    <h2>Package Specification</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+      
+    <h2>Related Documentation</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+
+    <h2>Package Status</h2>
+    <ul>
+      <li><font color="red"><b>ALPHA</b></font>
+    </ul>
+
+    <h2>Todo</h2>
+    <ul>
+      <li>???
+    </ul>
+
+    <!-- Put @see and @since tags down here. -->
+
+  </body>
+</html>


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/component/package.html
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/package.html
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/package.html	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/package.html	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <!-- $Id$ -->
+    <!--
+
+    JBoss: The OpenSource J2EE WebOS 
+
+    Distributable under LGPL license.
+    See terms of license at gnu.org.
+
+    -->
+  </head>
+
+  <body bgcolor="white">
+    <p>Classes to help with type implementations.
+
+    <h2>Package Specification</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+      
+    <h2>Related Documentation</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+
+    <h2>Package Status</h2>
+    <ul>
+      <li><font color="red"><b>ALPHA</b></font>
+    </ul>
+
+    <h2>Todo</h2>
+    <ul>
+      <li>???
+    </ul>
+
+    <!-- Put @see and @since tags down here. -->
+
+  </body>
+</html>


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/package.html
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/TargetDefinition.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/TargetDefinition.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/TargetDefinition.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,233 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.target;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DynamicElement;
+import org.jboss.ant.types.AbstractDataType;
+import org.jboss.ant.types.DynamicType;
+
+/**
+ * The target definition.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class TargetDefinition extends AbstractDataType implements DynamicElement
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+
+   /** The target definitions */
+   private TargetDefinitions targetDefinitions;
+   
+   /** The target name */
+   private String target;
+   
+   /** The common definition */
+   private ArrayList common;
+   
+   /** The main definition */
+   private ArrayList main;
+   
+   /** The component definition */
+   private ArrayList component;
+   
+   /** The dynamic types */
+   private Hashtable elements = new Hashtable();
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new build targets
+    */
+   public TargetDefinition()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+   
+   /**
+    * Get the target
+    * 
+    * @return the target
+    */
+   public String getTarget()
+   {
+      return target;
+   }
+   
+   /**
+    * Set the target name
+    * 
+    * @param target the target name 
+    */
+   public void setTarget(String target)
+   {
+      this.target = target;
+      
+      if (log.isTraceEnabled())
+         log.trace("Set target: " + target);
+   }
+   
+   /**
+    * Get the common definition
+    * 
+    * @return the common definition
+    */
+   public List getCommon()
+   {
+      return common;
+   }
+   
+   /**
+    * Create the common definition
+    * 
+    * @return the common definition
+    */
+   public DynamicType createCommon()
+   {
+      if (common == null)
+         common = new ArrayList();
+      DynamicType result = new DynamicType("common");
+      common.add(result);
+      return result;
+   }
+   
+   /**
+    * Get the main definition
+    * 
+    * @return the main definition
+    */
+   public List getMain()
+   {
+      if (main == null)
+         return common;
+      else
+         return main;
+   }
+   
+   /**
+    * Create the main definition
+    * 
+    * @return the main definition
+    */
+   public DynamicType createMain()
+   {
+      if (main == null)
+         main = new ArrayList();
+      DynamicType result = new DynamicType("main");
+      main.add(result);
+      return result;
+   }
+   
+   /**
+    * Get the component definition
+    * 
+    * @return the component definition
+    */
+   public List getComponent()
+   {
+      if (component == null)
+         return common;
+      else
+         return component;
+   }
+   
+   /**
+    * Create the component definition
+    * 
+    * @return the component definition
+    */
+   public DynamicType createComponent()
+   {
+      if (component == null)
+         component = new ArrayList();
+      DynamicType result = new DynamicType("component");
+      component.add(result);
+      return result;
+   }
+   
+   /**
+    * Get an element
+    * 
+    * @return the element
+    */
+   public ArrayList getElement(String name)
+   {
+      return (ArrayList) elements.get(name);
+   }
+   
+   // DynamicElement implementation ---------------------------------
+   
+   public Object createDynamicElement(String element)
+   {
+      if( log.isTraceEnabled() )
+         log.trace("Adding DynamicElement: "+element);
+      ArrayList dynamicTypes = (ArrayList) elements.get(element);
+      if (dynamicTypes == null)
+      {
+         dynamicTypes = new ArrayList();
+         elements.put(element, dynamicTypes);
+      }
+      DynamicType dynamicType = new DynamicType(element);
+      dynamicTypes.add(dynamicType);
+      return dynamicType;
+   }
+
+   // AbstractDataType overrides ------------------------------------
+   
+   protected void doValidate()
+   {
+      targetDefinitions.validate();
+      if (target == null)
+         throw new BuildException("Target has not been set");
+   }
+   
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" target=").append(target);
+      if (common != null)
+         buffer.append(" common");
+      if (main != null)
+         buffer.append(" main");
+      if (component != null)
+         buffer.append(" component");
+      if (elements.size() != 0)
+      {
+         for (Iterator i = elements.keySet().iterator(); i.hasNext();)
+            buffer.append(" ").append(i.next());
+      }
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   /**
+    * Set the target definitions
+    * 
+    * @param targetDefinitions the target
+    */
+   protected void setTargetDefinitions(TargetDefinitions targetDefinitions)
+   {
+      this.targetDefinitions = targetDefinitions;
+   }
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/TargetDefinition.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/TargetDefinitions.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/TargetDefinitions.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/TargetDefinitions.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.types.target;
+
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.types.AbstractDataType;
+
+/**
+ * The set of target definitions.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock </a>
+ * @version $Revision$
+ */
+public class TargetDefinitions extends AbstractDataType
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   /** The target definitions */
+   private Vector targetDefinitions = new Vector();
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new build targets
+    */
+   public TargetDefinitions()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+   
+   /**
+    * Get the build targets
+    * 
+    * @return the build targets
+    */   
+   public Vector getTargetDefinitions()
+   {
+      return targetDefinitions;
+   }
+   
+   /**
+    * Add a build target definition
+    * 
+    * @param targetDefinition the targetDefinition
+    */
+   public void addTargetDef(TargetDefinition targetDefinition)
+   {
+      targetDefinitions.add(targetDefinition);
+      targetDefinition.setTargetDefinitions(this);
+      
+      if (log.isTraceEnabled())
+         log.trace("Add target definition: " + targetDefinition.toShortString());
+   }
+   
+   // AbstractDataType overrides ------------------------------------
+   
+   protected void doValidate()
+   {
+      if (getId() == null)
+         throw new BuildException("Targets has no id/name");
+      validate(targetDefinitions);
+   }
+   
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" targetDefinitions=").append(targetDefinitions);
+   }
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/TargetDefinitions.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/package.html
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/package.html	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/package.html	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <!-- $Id$ -->
+    <!--
+
+    JBoss: The OpenSource J2EE WebOS 
+
+    Distributable under LGPL license.
+    See terms of license at gnu.org.
+
+    -->
+  </head>
+
+  <body bgcolor="white">
+    <p>Target definitions.
+
+    <h2>Package Specification</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+      
+    <h2>Related Documentation</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+
+    <h2>Package Status</h2>
+    <ul>
+      <li><font color="red"><b>ALPHA</b></font>
+    </ul>
+
+    <h2>Todo</h2>
+    <ul>
+      <li>???
+    </ul>
+
+    <!-- Put @see and @since tags down here. -->
+
+  </body>
+</html>


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/types/target/package.html
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/AttributeException.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/AttributeException.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/AttributeException.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * An attribute Exception.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public class AttributeException extends BuildException
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   /**
+    * Rethrow as an attribute exception
+    * 
+    * @param message the message
+    * @param value the value
+    * @param object the object
+    * @param t the throwable 
+    */
+   public static void rethrow(String message, String value, Object object, Throwable t)
+   {
+      if (t instanceof AttributeException)
+         throw (AttributeException) t;
+      else
+         throw new AttributeException(message, value, object, t);
+   }
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Create a new attribute exception
+    * 
+    * @param message the message
+    * @param value the value
+    * @param object the object
+    */
+   public AttributeException(String message, String value, Object object)
+   {
+      super(message + " '" + value + "' for " + object);
+   }
+
+   /**
+    * Create a new attribute exception
+    * 
+    * @param message the message
+    * @param value the value
+    * @param object the object
+    * @param t the throwable
+    */
+   public AttributeException(String message, String value, Object object, Throwable t)
+   {
+      super(message + " '" + value + "' for " + object + "\nCause: " + t.toString(), t);
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/AttributeException.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/AttributeUtil.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/AttributeUtil.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/AttributeUtil.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tools.ant.BuildException;
+import org.jboss.ant.types.AbstractDataType;
+
+/**
+ * Attribute utility.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public abstract class AttributeUtil
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+
+   /**
+    * Replace values in the string with values from the object
+    * 
+    * @param object the reference object
+    * @param value the value
+    * @return the processed value
+    */
+   public static String replace(Object object, String value)
+   {
+      int lastIndex = -1;
+      int state = 0;
+      StringBuffer result = new StringBuffer();
+      for (int i = 0; i < value.length(); ++i)
+      {
+         char current = value.charAt(i);
+         switch (state)
+         {
+            // Normal
+            case 0:
+            {
+               if (current == '@')
+               {
+                  state = 1;
+                  break;
+               }
+               result.append(current);
+               lastIndex = i;
+               break;
+            }
+            // Seen @
+            case 1:
+            {
+               if (current == '{')
+               {
+                  state = 2;
+                  break;
+               }
+               result.append('@').append(current);
+               lastIndex = i;
+               state = 0;
+               break;
+            }
+            // Seen @{
+            case 2:
+            {
+               if (current == '}')
+               {
+                  result.append(resolveAttributeAsString(object, value.substring(lastIndex+3, i)));
+                  lastIndex = i;
+                  state = 0;
+                  break;
+               }
+            }
+         }
+      }
+      if (state != 0)
+         result.append(value.substring(lastIndex+1));
+      return result.toString();
+   }
+
+   /**
+    * Resolve an attribute as a string
+    * 
+    * @param object the reference object
+    * @param value the value
+    * @return the string version of the attribute
+    */
+   public static String resolveAttributeAsString(Object object, String value)
+   {
+      int len = value.length();
+      if (len == 0)
+         return value;
+      
+      int dot = value.indexOf(".");
+      if (dot != -1)
+      {
+         String first = value.substring(0, dot);
+         Object next = resolveAttribute(object, first);
+         String remaining = value.substring(dot+1);
+         return resolveAttributeAsString(next, remaining);
+      }
+      return resolveAttribute(object, value).toString();
+   }
+   
+
+   /**
+    * Resolve an attribute
+    * 
+    * @param object the reference object
+    * @param value the value
+    * @return the attribute value
+    */
+   public static Object resolveAttribute(Object object, String value)
+   {
+      Method getter = null;
+      try
+      {
+         String getterName = "get" + Character.toUpperCase(value.charAt(0));
+         if (value.length() > 1)
+            getterName = getterName.concat(value.substring(1));
+
+         getter = object.getClass().getMethod(getterName, null);
+      }
+      catch (NoSuchMethodException e)
+      {
+         try
+         {
+            String getterName = "is" + Character.toUpperCase(value.charAt(0));
+            if (value.length() > 1)
+               getterName = getterName.concat(value.substring(1));
+
+            getter = object.getClass().getMethod(getterName, null);
+         }
+         catch (NoSuchMethodException e1)
+         {
+            if (object instanceof AbstractDataType)
+            {
+               Object result = ((AbstractDataType) object).getDynamicAttribute(value);
+               if (result != null)
+                  return result;
+               else
+                  throw new BuildException("Value not set '" + value + "' for " + object);
+            }
+               
+            e.printStackTrace();
+            throw new AttributeException("Getter not found", value, object, e);
+         }
+      }
+
+      try
+      {
+         Object result = getter.invoke(object, null);
+         if (result != null)
+            return result;
+         else
+            throw new BuildException("Value not set '" +  value + "' for " + object);
+      }
+      catch (InvocationTargetException e)
+      {
+         throw new AttributeException("Error getting attribute", value, object, e);
+      }
+      catch (IllegalAccessException e)
+      {
+         throw new AttributeException("Illegal access getting attribute", value, object, e);
+      }
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Not to be instantiated
+    */
+   private AttributeUtil()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/AttributeUtil.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/DownloadUtil.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/DownloadUtil.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/DownloadUtil.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util;
+
+import java.io.File;
+import java.net.URL;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Get;
+
+/**
+ * File Downloading Utility.
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public abstract class DownloadUtil
+{
+
+   /**
+    * Not to be instantiated
+    */
+   private DownloadUtil()
+   {
+   }
+
+   /** Gets a particular file from a URL source.
+    * 
+    * @param file the file to retrieve
+    * @param url the location to copy it to
+    * @param project the current ant project
+    */
+   public static File getFile(File file, URL url, Project project)
+   {
+      Get getTask = new Get();
+      
+      getTask.setTaskName("get");
+      getTask.setProject(project);
+      getTask.setSrc(url);
+      getTask.setDest(file);
+      getTask.setVerbose(true);
+
+      try
+      {
+         getTask.execute();
+      }
+      catch (Exception e)
+      {
+         throw (new BuildException("Unable to get remote file=" + file + " url=" + url));
+      }
+      return (file);
+
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/DownloadUtil.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/FileUtil.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/FileUtil.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/FileUtil.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Mkdir;
+import org.apache.tools.ant.util.FileUtils;
+
+/**
+ * File utility.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public abstract class FileUtil
+{
+   // Constants -----------------------------------------------------
+
+   /** The file utils */
+   private static FileUtils fileUtils = FileUtils.newFileUtils();
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   /**
+    * Resolve a name relative to a file
+    * 
+    * @param file the reference file
+    * @param name the name
+    * @return the resulting file
+    */
+   public static File resolve(File file, String name)
+   {
+      return fileUtils.resolveFile(file, name);
+   }
+
+   /**
+    * Get the root of the build/components
+    * 
+    * @param project the project
+    * @return the root
+    */
+   public static File getRoot(Project project)
+   {
+      return project.getBaseDir().getParentFile();
+   }
+
+   /**
+    * Resolve a URL relative to a URL directory.  This works like 
+    * resolve(File,Sring) instead of new URL(URL,String)
+    * 
+    * @param url
+    * @param name
+    * @return
+    */
+   public static URL resolve(URL url, String name) throws MalformedURLException
+   {
+      return new URL(url + "/" + name);
+   }
+
+   /** create a directory
+    * 
+    * @param directory the directory to create
+    * @param project the current ant project
+    */
+   public static void mkdir(File directory, Project project)
+   {
+      Mkdir mkdir = new Mkdir();
+      mkdir.setTaskName("mkdir");
+      mkdir.setProject(project);
+      mkdir.setDir(directory);
+      mkdir.execute();
+
+      return;
+
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Not to be instantiated
+    */
+   private FileUtil()
+   {
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/FileUtil.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ImportUtil.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ImportUtil.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ImportUtil.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+
+/**
+ * Util for importing other build files.
+ * 
+ * @author <a href="mailto:ryan.campbell at jboss.com">Ryan Campbell</a>
+ * @version $Revision$
+ */
+public abstract class ImportUtil
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   private static Set importedFiles = new HashSet();
+   
+   // Static --------------------------------------------------------
+
+   
+   public static void importFile(File component, Project project)
+   {
+
+      ProjectHelper helper = (ProjectHelper) project.getReference("ant.projectHelper");
+
+      if (! importedFiles.contains(component)) {
+         helper.parse(project, component);
+         importedFiles.add(component);
+      } else {
+         project.log("Skipping previously imported component: "+component,Project.MSG_VERBOSE);
+      }
+      
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Not to be instantiated
+    */
+   private ImportUtil()
+   {
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ImportUtil.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/LoggerUtil.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/LoggerUtil.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/LoggerUtil.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectComponent;
+
+/**
+ * Logger utility.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public abstract class LoggerUtil
+{
+   // Constants -----------------------------------------------------
+
+   /** Whether we have determined if logging is enabled */
+   private static boolean determinedVerbose = false;
+   
+   /** Whether verbose logging is enabled */
+   private static boolean verbose = false;
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   /**
+    * Determine whether logging is verbose
+    * 
+    * @param projectComponent a reference project component
+    */
+   private static boolean isVerbose(ProjectComponent projectComponent)
+   {
+      if (determinedVerbose == false)
+      {
+         Project project = projectComponent.getProject();
+         if (project != null)
+         {
+            determinedVerbose = true;
+            verbose = Boolean.valueOf(project.getProperty("org.jboss.ant.verbose")).booleanValue();
+         }
+      }
+      return verbose;
+   }
+   
+   /**
+    * Log a message
+    * 
+    * @param projectComponent the project component
+    * @param message the message 
+    */
+   public static void info(ProjectComponent projectComponent, Object message)
+   {
+      projectComponent.log(message.toString());
+   }
+   
+   /**
+    * Log a warning
+    * 
+    * @param projectComponent the project component
+    * @param message the message 
+    */
+   public static void warn(ProjectComponent projectComponent, Object message)
+   {
+      projectComponent.log(message.toString(), Project.MSG_WARN);
+   }
+   
+   /**
+    * Log a verbose message
+    * 
+    * @param projectComponent the project component
+    * @param message the message 
+    */
+   public static void trace(ProjectComponent projectComponent, Object object, Object message)
+   {
+      StringBuffer buffer = new StringBuffer();
+      ObjectUtil.appendObjectId(buffer, object);
+      buffer.append(": ");
+      buffer.append(message.toString());
+      projectComponent.log(buffer.toString(), Project.MSG_VERBOSE);
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Not to be instantiated
+    */
+   private LoggerUtil()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+   
+   /**
+    * A logger
+    */
+   public static class Logger
+   {
+      /** The project component */
+      private ProjectComponent projectComponent;
+
+      /** The referencing object */
+      private Object object;
+      
+      /**
+       * Create a new Logger.
+       * 
+       * @param projectComponent the project component
+       */
+      public Logger(ProjectComponent projectComponent)
+      {
+         this(projectComponent, projectComponent);
+      }
+      
+      /**
+       * Create a new Logger.
+       * 
+       * @param projectComponent the project component
+       * @param object the logging object
+       */
+      public Logger(ProjectComponent projectComponent, Object object)
+      {
+         this.projectComponent = projectComponent;
+         this.object = object;
+      }
+      
+      /**
+       * Log a message
+       * 
+       * @param message the message
+       */
+      public void info(Object message)
+      {
+         LoggerUtil.info(projectComponent, message);
+      }
+      
+      /**
+       * Log a warning
+       * 
+       * @param message the message
+       */
+      public void warn(Object message)
+      {
+         LoggerUtil.warn(projectComponent, message);
+      }
+      
+      /**
+       * Log a verbose message
+       * 
+       * @param message the message
+       */
+      public void trace(Object message)
+      {
+         LoggerUtil.trace(projectComponent, object, message);
+      }
+      
+      /**
+       * Whether trace is enabled
+       * 
+       * @return true for trace enabled
+       */
+      public boolean isTraceEnabled()
+      {
+         return isVerbose(projectComponent);
+      }
+   }
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/LoggerUtil.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/MacroUtil.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/MacroUtil.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/MacroUtil.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,905 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.RuntimeConfigurable;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.UnknownElement;
+import org.jboss.ant.types.DynamicType;
+import org.jboss.ant.types.Include;
+import org.jboss.ant.types.Pattern;
+import org.jboss.ant.types.Source;
+import org.jboss.ant.types.SourceSink;
+import org.jboss.ant.types.build.Artifact;
+import org.jboss.ant.types.component.GeneratedSourceDefinition;
+import org.jboss.ant.types.component.SourceDefinition;
+
+/**
+ * Macro utility.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public abstract class MacroUtil
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   /**
+    * Create a macro
+    * 
+    * @param name the name of the macro
+    * @param project the project
+    * @param target the target
+    * @return the runtime configurable for the macro
+    */
+   public static RuntimeConfigurable createMacro(String name, Project project, Target target)
+   {
+      UnknownElement element = new UnknownElement(name);
+      RuntimeConfigurable rc = new RuntimeConfigurable(element, name);
+      element.setRuntimeConfigurableWrapper(rc);
+      element.setNamespace("");
+      element.setTaskName(name);
+      element.setTaskType(name);
+      initTask(element, project, target);
+      return rc;
+   }
+   
+   /**
+    * Configure
+    * 
+    * @param rc the runtime configurable
+    * @param dataType the data
+    * @param taskDefinition the task definition
+    * @param project the project
+    * @param target the target
+    */
+   public static void configure(RuntimeConfigurable rc, DynamicType taskDefinition, Object dataType, Project project, Target target)
+   {
+      // Set the text
+      String text = taskDefinition.getText();
+      if (text != null)
+         rc.addText(AttributeUtil.replace(dataType, text));
+
+      // Set the attributes
+      Hashtable attributes = taskDefinition.getAttributes();
+      for (Iterator i = attributes.keySet().iterator(); i.hasNext();)
+      {
+         String key = (String) i.next();
+         String value = AttributeUtil.replace(dataType,(String) attributes.get(key));
+         rc.setAttribute(key, value);
+      }
+      
+      // Nested elements
+      Vector children = taskDefinition.getElements();
+      for (int i = 0; i < children.size(); ++i)
+      {
+         DynamicType child = (DynamicType) children.get(i);
+
+         if ("output".equals(child.getId()))
+            appendFileSet(dataType, rc, project, target);
+         else if ("pathelements".equals(child.getId()))
+         {
+            HashSet set = new HashSet();
+            getPathElements(set, dataType, true);
+            appendPaths(set, rc, project, target);
+         }
+         else if ("buildpathelements".equals(child.getId()))
+         {
+            HashSet set = new HashSet();
+            getBuildPathElements(set, dataType, true);
+            appendPaths(set, rc, project, target);
+         }
+         else if ("filesets".equals(child.getId()))
+         {
+            Set set = getFileSets(dataType);
+            appendPaths(set, rc, project, target);
+         }
+         else if ("sourcepaths".equals(child.getId()))
+         {
+            HashSet set = new HashSet();
+            getSourcePaths(set, dataType);
+            appendPaths(set, rc, project, target);
+         }
+         else if ("sourcepathelements".equals(child.getId()))
+         {
+            HashSet set = new HashSet();
+            getSourcePathElements(set, dataType);
+            appendPaths(set, rc, project, target);
+         }
+         else if ("srcelements".equals(child.getId()))
+         {
+            HashSet set = new HashSet();
+            getSourceElements(set, dataType);
+            appendPaths(set, rc, project, target);
+         }
+         else
+         {
+            RuntimeConfigurable childrc = createChild(rc, child.getId(), project, target);
+            configure(childrc, child, dataType, project, target);
+         }
+      }
+   }
+   
+   /**
+    * Initialize task
+    * 
+    * @param task the task to initialize
+    * @param project the project
+    * @param target the target
+    */
+   protected static void initTask(Task task, Project project, Target target)
+   {
+      task.setProject(project);
+      task.setOwningTarget(target);
+      task.init();
+   }
+
+   /**
+    * Dump the macro
+    * 
+    * @param element the macro
+    * @return the string version
+    */
+   public static String dumpMacro(UnknownElement element)
+   {
+      StringBuffer buffer = new StringBuffer();
+      dumpElement(buffer, element, 0);
+      return buffer.toString();
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Not to be instantiated
+    */
+   private MacroUtil()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   /**
+    * Add paths
+    * 
+    * @param set the paths
+    * @param rc the runtime confgurable
+    * @param project the project
+    * @param target the target
+    */
+   protected static void appendPaths(Set set, RuntimeConfigurable rc, Project project, Target target)
+   {
+      for (Iterator i = set.iterator(); i.hasNext();)
+      {
+         PathDescription pd = (PathDescription) i.next();
+         pd.appendPath(rc, project, target);
+      }
+   }
+   
+   /**
+    * Add file set
+    * 
+    * @param dataType the data type
+    * @param rc the runtime confgurable
+    * @param project the project
+    * @param target the target
+    */
+   protected static void appendFileSet(Object dataType, RuntimeConfigurable rc, Project project, Target target)
+   {
+      PathDescription pd = getFileSet(dataType);
+      pd.appendPath(rc, project, target);
+   }
+   
+   /**
+    * Get file set
+    * 
+    * @param dataType the data type
+    * @return the path description
+    */
+   protected static PathDescription getFileSet(Object dataType)
+   {
+      if (dataType instanceof Source)
+      {
+         Source source = (Source) dataType;
+         File file = source.getOutput();
+         if (file.isDirectory())
+            return new DirectoryFileSet(file.toString(), null, null);
+         else
+            return new FileFileSet(file.toString(), null);
+      }
+      else
+         throw new BuildException("Not a Source " + dataType);
+   }
+   
+   /**
+    * Add path elements
+    *
+    * @param set the set of the path elements used as output 
+    * @param dataType the data type
+    * @param output whether to include the output
+    */
+   protected static void getPathElements(Set set, Object dataType, boolean output)
+   {
+      if (dataType instanceof SourceSink)
+      {
+         SourceSink sink = (SourceSink) dataType;
+         if (output)
+         {
+            File file = sink.getOutput();
+            set.add(new PathElement(file.toString())); 
+         }
+         for (int j = 0; j < sink.getSize(); ++j)
+         {
+            Include include = sink.getInclude(j);
+            List sources = include.getSources();
+            for (int k = 0; k < sources.size(); ++k)
+            {
+               Source source = (Source) sources.get(k);
+               if (source instanceof SourceDefinition 
+                     || source instanceof Artifact)
+               {
+                  File file = source.getOutput();
+                  set.add(new PathElement(file.toString()));
+                  if (source instanceof SourceDefinition)
+                     getPathElements(set, source, false);
+                  if (source instanceof Artifact)
+                     getArtifactClassPath(set, (Artifact) source);
+               }
+            }
+         }
+      }
+      else
+         throw new BuildException("Not a SourceSink " + dataType);
+   }
+   
+   /**
+    * Add build path elements.  This differs from getPathElements in that it does
+    * not include transitive dependencies (ie, dependencies of a jar).
+    *
+    * @param set the set of the path elements used as output 
+    * @param dataType the data type
+    * @param output whether to include the output
+    */
+   protected static void getBuildPathElements(Set set, Object dataType, boolean output)
+   {
+      if (dataType instanceof SourceSink)
+      {
+         SourceSink sink = (SourceSink) dataType;
+         if (output)
+         {
+            File file = sink.getOutput();
+            set.add(new PathElement(file.toString())); 
+         }
+         for (int j = 0; j < sink.getSize(); ++j)
+         {
+            Include include = sink.getInclude(j);
+            List sources = include.getSources();
+            for (int k = 0; k < sources.size(); ++k)
+            {
+               Source source = (Source) sources.get(k);
+               if (source instanceof SourceDefinition 
+                     || source instanceof Artifact)
+               {
+                  File file = source.getOutput();
+                  set.add(new PathElement(file.toString()));
+               }
+            }
+         }
+      }
+      else
+         throw new BuildException("Not a SourceSink " + dataType);
+   }
+ 
+   protected static void getArtifactClassPath(Set set, Artifact artifact)
+   {
+      if ("jar".equals(artifact.getArtifactType().getId()))
+      {
+         File file = artifact.getOutput();
+         try
+         {
+            JarFile jarFile = new JarFile(file);
+            try
+            {
+               Manifest manifest = jarFile.getManifest();
+               Attributes attributes = manifest.getMainAttributes();
+               String classPath = attributes.getValue(Attributes.Name.CLASS_PATH);
+               if (classPath != null)
+               {
+                  StringTokenizer tokenizer = new StringTokenizer(classPath);
+                  while (tokenizer.hasMoreTokens())
+                  {
+                     String id = tokenizer.nextToken();
+                     Object reference = artifact.getProject().getReference(id);
+                     if (reference == null)
+                        artifact.log("Unable to locate '" + id + "' in Class-Path of " + artifact.getId());
+                     if (reference instanceof Artifact)
+                     {
+                        Artifact referenced = (Artifact) reference;
+                        set.add(new PathElement(referenced.getOutput().toString()));
+                        getArtifactClassPath(set, referenced);
+                     }
+                  }
+               }
+            }
+            finally
+            {
+               jarFile.close();
+            }
+         }
+         catch (IOException e)
+         {
+            artifact.log("IOException reading manifest: " + e, Project.MSG_WARN);
+         }
+      }
+   }
+   
+   /**
+    * Get file sets
+    * 
+    * @param dataType the data type
+    * @return the set of file sets
+    */
+   protected static Set getFileSets(Object dataType)
+   {
+      if (dataType instanceof SourceSink)
+      {
+         HashSet set = new HashSet();
+         SourceSink sink = (SourceSink) dataType;
+         for (int j = 0; j < sink.getSize(); ++j)
+         {
+            Include include = sink.getInclude(j);
+            List files = include.getFiles();
+            for (int k = 0; k < files.size(); ++k)
+            {
+               File file = (File) files.get(k);
+               if (file.isDirectory())
+                  set.add(new DirectoryFileSet(file.toString(), include.getPrefix(),
+                                              include.getIncludes(), include.getExcludes()));
+               else if (include.getIncludes().size() > 0 || include.getExcludes().size() > 0)
+                  set.add(new ArchiveFileSet(file.toString(), include.getIncludes(), include.getExcludes()));
+               else
+                  set.add(new FileFileSet(file.toString(), include.getPrefix()));
+            }
+         }
+         return set;
+      }
+      else
+         throw new BuildException("Not a SourceSink " + dataType);
+   }
+   
+   /**
+    * Add source paths
+    * 
+    * @param set the set of path elements used as output
+    * @param dataType the data type
+    * @param rc the runtime confgurable
+    * @param project the project
+    * @param target the target
+    */
+   protected static void getSourcePaths(Set set, Object dataType)
+   {
+      if (dataType instanceof SourceSink)
+      {
+         SourceSink sink = (SourceSink) dataType;
+         for (int j = 0; j < sink.getSize(); ++j)
+         {
+            Include include = sink.getInclude(j);
+            List sources = include.getSources();
+            for (int k = 0; k < sources.size(); ++k)
+            {
+               Source source = (Source) sources.get(k);
+               if (source instanceof SourceDefinition)
+               {
+                  SourceDefinition definition = (SourceDefinition) source;
+                  set.add(new PathElement(definition.getSourcePath()));
+               }
+            }
+         }
+      }
+      else
+         throw new BuildException("Not a SourceSink " + dataType);
+   }
+   
+   /**
+    * Add src elements (for javac)
+    * 
+    * @param set the set of src elements used as output
+    * @param dataType the data type
+    * @param rc the runtime confgurable
+    * @param project the project
+    * @param target the target
+    */
+   protected static void getSourceElements(Set set, Object dataType)
+   {
+      if (dataType instanceof SourceDefinition)
+      {
+         SourceDefinition source = (SourceDefinition) dataType;
+         for (int j = 0; j < source.getSize(); ++j)
+         {
+            Include include = source.getInclude(j);
+            List sources = include.getSources();
+            for (int k = 0; k < sources.size(); ++k)
+            {
+               Source includedSource = (Source) sources.get(k);
+               if (includedSource instanceof GeneratedSourceDefinition) 
+               {
+                  GeneratedSourceDefinition genSrcDef = 
+                     (GeneratedSourceDefinition) includedSource;
+                  set.add(new SrcElement(genSrcDef.getOutput().getPath()));
+               }
+            }
+         }
+      }
+      else
+         throw new BuildException("Not a SourceDefinition " + dataType);
+   }
+
+   /**
+    * Add source path elements
+    * 
+    * @param set the set of path elements used as output
+    * @param dataType the data type
+    */
+   protected static void getSourcePathElements(Set set, Object dataType)
+   {
+      if (dataType instanceof SourceSink)
+      {
+         SourceSink sink = (SourceSink) dataType;
+         for (int j = 0; j < sink.getSize(); ++j)
+         {
+            Include include = sink.getInclude(j);
+            List sources = include.getSources();
+            for (int k = 0; k < sources.size(); ++k)
+            {
+               Source source = (Source) sources.get(k);
+               if (source instanceof SourceDefinition)
+               {
+                  SourceDefinition definition = (SourceDefinition) source;
+                  getPathElements(set, definition, false);
+               }
+            }
+         }
+      }
+      else
+         throw new BuildException("Not a SourceSink " + dataType);
+   }
+
+   /**
+    * Append includes/excludes to the parent 
+    * 
+    * @param parent the parent
+    * @param includes the includes
+    * @param excludes the excludes
+    * @param project the project
+    * @param target the target
+    */
+   protected static void appendIncludesExcludes(RuntimeConfigurable parent, Vector includes, Vector excludes, Project project, Target target)
+   {
+      if (includes != null && includes.size() > 0)
+      {
+         for (int i = 0; i < includes.size(); ++i)
+         {
+            Pattern theInclude = (Pattern) includes.get(i);
+            RuntimeConfigurable rc = createChild(parent, "include", project, target);
+            rc.setAttribute("name", theInclude.getPattern());
+         }
+      }
+      if (excludes != null && excludes.size() > 0)
+      {
+         for (int i = 0; i < excludes.size(); ++i)
+         {
+            Pattern theExclude = (Pattern) excludes.get(i);
+            RuntimeConfigurable rc = createChild(parent, "exclude", project, target);
+            rc.setAttribute("name", theExclude.getPattern());
+         }
+      }
+   }
+   
+   /**
+    * Create a child element
+    * 
+    * @param parent the parent runtime configurable
+    * @param name the name of the element
+    * @return the element
+    */
+   protected static RuntimeConfigurable createChild(RuntimeConfigurable parent, String name, Project project, Target target)
+   {
+      RuntimeConfigurable rc = createMacro(name, project, target);
+      parent.addChild(rc);
+      ((UnknownElement) parent.getProxy()).addChild((UnknownElement) rc.getProxy());
+      return rc;
+   }
+   
+   /**
+    * Append the element to the buffer
+    * 
+    * @param buffer the buffer
+    * @param element the element
+    * @param indent the indentation level
+    */
+   protected static void dumpElement(StringBuffer buffer, UnknownElement element, int indent)
+   {
+      dumpIndent(buffer, indent);
+      buffer.append("<").append(element.getTag());
+      dumpAttributes(buffer, element);
+      String text = element.getRuntimeConfigurableWrapper().getText().toString().trim();
+      List children = element.getChildren();
+      if (children != null || text.length() > 0)
+      {
+         buffer.append(">");
+         if (text.length() > 0)
+            buffer.append(text);
+         if (children != null)
+         {
+            dumpChildren(buffer, element, indent);
+            dumpIndent(buffer, indent);
+         }
+         buffer.append("</").append(element.getTag()).append('>');
+      }
+      else
+         buffer.append("/>");
+   }
+   
+   /**
+    * Append the attributes of an element to the buffer
+    * 
+    * @param buffer the buffer
+    * @param element the element
+    */
+   protected static void dumpAttributes(StringBuffer buffer, UnknownElement element)
+   {
+      RuntimeConfigurable rc = element.getRuntimeConfigurableWrapper();
+      Hashtable attributes = rc.getAttributeMap();
+      for (Iterator i = attributes.keySet().iterator(); i.hasNext();)
+      {
+         String key = (String) i.next();
+         buffer.append(' ').append(key).append("=\"").append(attributes.get(key)).append("\"");
+      }
+   }
+   
+   /**
+    * Append the children of an element to the buffer
+    * 
+    * @param buffer the buffer
+    * @param element the element
+    * @param indent the indentation level
+    */
+   protected static void dumpChildren(StringBuffer buffer, UnknownElement element, int indent)
+   {
+      List list = element.getChildren();
+      for (int i = 0; i < list.size(); ++i)
+      {
+         UnknownElement child = (UnknownElement) list.get(i);
+         dumpElement(buffer, child, indent+1);
+      }
+   }
+
+   /**
+    * Indent
+    * 
+    * @param buffer the buffer
+    * @param indent the indentation level
+    */
+   protected static void dumpIndent(StringBuffer buffer, int indent)
+   {
+      buffer.append('\n');
+      for (int i = 0; i < indent; ++i)
+         buffer.append("  ");
+   }
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+   
+   /**
+    * A path description
+    */
+   protected static abstract class PathDescription
+   {
+      /**
+       * Append this path description
+       * 
+       * @param rc the runtime confgurable
+       * @param project the project
+       * @param target the target
+       */
+      public abstract void appendPath(RuntimeConfigurable rc, Project project, Target target);
+      
+      /** 
+       * Utility to compare two vectors
+       * 
+       * @param one vector one
+       * @param two vector two
+       * @return true when equal
+       */
+      public boolean equalsVector(Vector one, Vector two)
+      {
+         if (one == null && two == null)
+            return true;
+         if (one == null && two != null)
+            return false;
+         return one.equals(two);
+      }
+   }
+   
+   /**
+    * A directory fileset
+    */
+   protected static class DirectoryFileSet extends PathDescription
+   {
+      /** The directory */
+      private String directory;
+      
+      /** The prefix */
+      private String prefix;
+
+      /** The includes */
+      private Vector includes;
+      
+      /** The excludes */
+      private Vector excludes;
+      
+      /**
+       * Create a new DirectoryFileSet.
+       * 
+       * @param directory the directory
+       * @param includes the includes
+       * @param excludes the excludes
+       */
+      public DirectoryFileSet(String directory, Vector includes, Vector excludes)
+      {
+         this.directory = directory;
+         this.includes = includes;
+         this.excludes = excludes;
+      }
+      
+      /**
+       * Create a new DirectoryFileSet.
+       * 
+       * @param directory the directory
+       * @param includes the includes
+       * @param excludes the excludes
+       */
+      public DirectoryFileSet(String directory, String prefix, Vector includes, Vector excludes)
+      {
+         this.directory = directory;
+         this.prefix = prefix;
+         this.includes = includes;
+         this.excludes = excludes;
+      }
+      
+      public void appendPath(RuntimeConfigurable rc, Project project, Target target)
+      {
+         RuntimeConfigurable fileSet = null;
+         if (prefix == null)
+            fileSet = createChild(rc, "fileset", project, target);
+         else
+         {   
+            fileSet = createChild(rc, "zipfileset", project, target);
+            fileSet.setAttribute("prefix",prefix);
+         }
+            
+         fileSet.setAttribute("dir", directory);
+         appendIncludesExcludes(fileSet, includes, excludes, project, target);
+      }
+      
+      public boolean equals(Object object)
+      {
+         if (object == null || object instanceof DirectoryFileSet == false)
+            return false;
+         DirectoryFileSet other = (DirectoryFileSet) object;
+         if (directory.equals(other.directory) == false)
+            return false;
+         return equalsVector(includes, other.includes) && equalsVector(excludes, other.excludes);
+      }
+      
+      public int hashCode()
+      {
+         return directory.hashCode();
+      }
+   }
+
+   /**
+    * An fileset from another archive (jar, zip, etc)
+    */
+   protected static class ArchiveFileSet extends PathDescription
+   {
+      /** The directory */
+      private String archive;
+      
+      /** The includes */
+      private Vector includes;
+      
+      /** The excludes */
+      private Vector excludes;
+      
+      /**
+       * Create a new DirectoryFileSet.
+       * 
+       * @param directory the directory
+       * @param includes the includes
+       * @param excludes the excludes
+       */
+      public ArchiveFileSet(String archive, Vector includes, Vector excludes)
+      {
+         this.archive = archive;
+         this.includes = includes;
+         this.excludes = excludes;
+      }
+      
+      public void appendPath(RuntimeConfigurable rc, Project project, Target target)
+      {
+         RuntimeConfigurable fileSet = createChild(rc, "zipfileset", project, target);
+         fileSet.setAttribute("src", archive);
+         appendIncludesExcludes(fileSet, includes, excludes, project, target);
+      }
+      
+      public boolean equals(Object object)
+      {
+         if (object == null || object instanceof ArchiveFileSet == false)
+            return false;
+         ArchiveFileSet other = (ArchiveFileSet) object;
+         if (archive.equals(other.archive) == false)
+            return false;
+         return equalsVector(includes, other.includes) && equalsVector(excludes, other.excludes);
+      }
+      
+      public int hashCode()
+      {
+         return archive.hashCode();
+      }
+   }
+
+   
+   /**
+    * A file fileset
+    */
+   protected static class FileFileSet extends PathDescription
+   {
+      /** The file */
+      private String file;
+      
+      /** The prefix for output location */
+      private String prefix;
+      
+      /**
+       * Create a new FileFileSet.
+       * 
+       * @param file the file
+       */
+      public FileFileSet(String file, String prefix)
+      {
+         this.file = file;
+         this.prefix=prefix;
+      }
+      
+      public void appendPath(RuntimeConfigurable rc, Project project, Target target)
+      {
+         RuntimeConfigurable fileSet = null;
+         if (prefix == null)
+            fileSet = createChild(rc, "fileset", project, target);
+         else
+         {   
+            fileSet = createChild(rc, "zipfileset", project, target);
+            fileSet.setAttribute("prefix",prefix);
+         }
+         
+         fileSet.setAttribute("file", file);
+      }
+      
+      public boolean equals(Object object)
+      {
+         if (object == null || object instanceof FileFileSet == false)
+            return false;
+         FileFileSet other = (FileFileSet) object;
+         return file.equals(other.file);
+      }
+      
+      public int hashCode()
+      {
+         return file.hashCode();
+      }
+   }
+   
+   /**
+    * A path element
+    */
+   protected static class PathElement extends PathDescription
+   {
+      /** The location */
+      private String location;
+      
+      /**
+       * Create a new PathElement.
+       * 
+       * @param location the location
+       */
+      public PathElement(String location)
+      {
+         this.location = location;
+      }
+      
+      public void appendPath(RuntimeConfigurable rc, Project project, Target target)
+      {
+         RuntimeConfigurable pathElement = createChild(rc, "pathelement", project, target);
+         pathElement.setAttribute("location", location);
+      }
+      
+      public boolean equals(Object object)
+      {
+         if (object == null || object instanceof PathElement == false)
+            return false;
+         PathElement other = (PathElement) object;
+         return location.equals(other.location);
+      }
+      
+      public int hashCode()
+      {
+         return location.hashCode();
+      }
+   }
+   /**
+    * A javac src element
+    */
+   protected static class SrcElement extends PathDescription
+   {
+      /** The source directory */
+      private String sourceDir;
+      
+      /**
+       * Create a new SrcElement.
+       * 
+       * @param location the location
+       */
+      public SrcElement(String sourceDir)
+      {
+         this.sourceDir = sourceDir;
+      }
+      
+      public void appendPath(RuntimeConfigurable rc, Project project, Target target)
+      {
+         RuntimeConfigurable pathElement = createChild(rc, "src", project, target);
+         pathElement.setAttribute("path", sourceDir);
+      }
+      
+      public boolean equals(Object object)
+      {
+         if (object == null || object instanceof SrcElement == false)
+            return false;
+         SrcElement other = (SrcElement) object;
+         return sourceDir.equals(other.sourceDir);
+      }
+      
+      public int hashCode()
+      {
+         return sourceDir.hashCode();
+      }
+   }
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/MacroUtil.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ObjectUtil.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ObjectUtil.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ObjectUtil.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util;
+
+
+/**
+ * Object utility.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public abstract class ObjectUtil
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   /**
+    * Append the class short name
+    * 
+    * @param buffer the buffer
+    * @param clazz the class
+    */
+   public static void appendClassShortName(StringBuffer buffer, Class clazz)
+   {
+      String name = clazz.getName();
+      int dot = name.lastIndexOf('.');
+      if (dot != -1)
+         buffer.append(name.substring(dot+1));
+      else
+         buffer.append(name);
+   }
+
+   /**
+    * Append the object id
+    * 
+    * @param buffer the buffer
+    * @param id the object
+    */
+   public static void appendObjectId(StringBuffer buffer, Object id)
+   {
+      appendClassShortName(buffer, id.getClass());
+      buffer.append('@');
+      buffer.append(Integer.toHexString(System.identityHashCode(id)));
+   }
+   
+   /**
+    * Get the object id
+    * 
+    * @param id the object
+    * @return the object id
+    */
+   public static String getObjectId(Object id)
+   {
+      StringBuffer buffer = new StringBuffer();
+      appendObjectId(buffer, id);
+      return buffer.toString();
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Not to be instantiated
+    */
+   private ObjectUtil()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ObjectUtil.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ReferenceUtil.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ReferenceUtil.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ReferenceUtil.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.jboss.ant.types.AbstractDataType;
+import org.jboss.ant.types.target.TargetDefinitions;
+
+
+/**
+ * Util for resolving commonly used objects
+ * 
+ * @author <a href="mailto:ryan.campbell at jboss.com">Ryan Campbell</a>
+ * @version $Revision$
+ */
+public abstract class ReferenceUtil
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+
+   private static final String TARGETDEFS_PROP = "jbossbuild.targetdefs.refid";
+   
+   // Constructors --------------------------------------------------
+
+   /**
+    * Not to be instantiated
+    */
+   private ReferenceUtil()
+   {
+   }
+
+   /** 
+    * Resolves an object from the project.
+    * 
+    * @param context The name of the attribute set by the user to resolve the object.
+    * @param refid The reference id of the object being resolved.
+    * @param clazz The expected type of the object being resolved.
+    * @return
+    */
+   public static AbstractDataType resolve(String refid, Class clazz, Project project)
+   {
+
+      Object object = project.getReference(refid);
+      if (object == null)
+         throw new BuildException("Could not resolve refid "+refid+" of type "+clazz);
+      if (clazz.isInstance(object) == false)
+         throw new BuildException("Project reference '"+refid+
+               "' does not reference expected type "+clazz);
+      return (AbstractDataType) object;
+   }
+
+   /** 
+    * Find the targetdefintions for this project.
+    * 
+    * @param project
+    * @return
+    */
+   public static TargetDefinitions resolveTargetDefinitions(Project project)
+   {
+      String refid = project.getProperty(TARGETDEFS_PROP);
+      
+      if (refid == null)
+      {
+         throw new BuildException("Could not resolve property: "+TARGETDEFS_PROP);
+      }
+      
+      return (TargetDefinitions) resolve(refid, TargetDefinitions.class, project);
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}
\ No newline at end of file


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ReferenceUtil.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ValidateLicenseHeaders.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ValidateLicenseHeaders.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ValidateLicenseHeaders.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,377 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.ant.util;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.FileWriter;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.nio.channels.FileChannel;
+import java.nio.ByteBuffer;
+import java.net.URL;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+
+/**
+ * This is a copy of the jbossas varia org.jboss.tools.license.ValidateLicenseHeaders
+ * that needs to be updated to work with any project and provide better pass/fail
+ * feedback when there are invalid headers.
+ *
+ * A utility which scans all java source files in the cvs tree and validates
+ * the license header prior to the package statement for headers that match
+ * those declared in thirdparty/licenses/license-info.xml
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ValidateLicenseHeaders
+{
+   static final String DEFAULT_HEADER = "/*\n" +
+      "* JBoss, Home of Professional Open Source\n" +
+      "*\n" +
+      "* Distributable under LGPL license.\n" +
+      "* See terms of license at gnu.org.\n" +
+      "*/\n";
+   static Logger log = Logger.getLogger("ValidateCopyrightHeaders");
+   static boolean addDefaultHeader = false;
+   static FileFilter dotJavaFilter = new DotJavaFilter();
+   /**
+    * The term-headers from the thirdparty/license/license-info.xml
+    */ 
+   static HashMap licenseHeaders = new HashMap();
+   /**
+    * Java source files with no license header
+    */ 
+   static ArrayList noheaders = new ArrayList();
+   /**
+    * Java source files with a header that does not match one from licenseHeaders
+    */ 
+   static ArrayList invalidheaders = new ArrayList();
+   static int totalCount;
+
+   /**
+    * ValidateLicenseHeaders jboss-src-root
+    * @param args
+    */ 
+   public static void main(String[] args)
+      throws Exception
+   {
+      if( args.length == 0 || args[0].startsWith("-h") )
+      {
+         log.info("Usage: ValidateLicenseHeaders [-addheader] jboss-src-root");
+         System.exit(1);
+      }
+      int rootArg = 0;
+      if( args.length == 2 )
+      {
+         if( args[0].startsWith("-add") )
+            addDefaultHeader = true;
+         else
+         {
+            log.severe("Uknown argument: "+args[0]);
+            log.info("Usage: ValidateLicenseHeaders [-addheader] jboss-src-root");
+            System.exit(1);
+            
+         }
+         rootArg = 1;
+      }
+
+      File jbossSrcRoot = new File(args[rootArg]);
+      if( jbossSrcRoot.exists() == false )
+      {
+         log.info("Src root does not exist, check "+jbossSrcRoot.getAbsolutePath());
+         System.exit(1);
+      }
+
+      URL u = Thread.currentThread().getContextClassLoader().getResource("META-INF/services/javax.xml.parsers.DocumentBuilderFactory");
+      System.err.println(u);
+
+      // Load the valid copyright statements for the licenses
+      File licenseInfo = new File(jbossSrcRoot, "thirdparty/licenses/license-info.xml");
+      if( licenseInfo.exists() == false )
+      {
+         log.severe("Failed to find the thirdparty/licenses/license-info.xml under the src root");
+         System.exit(1);
+      }
+      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+      DocumentBuilder db = factory.newDocumentBuilder();
+      Document doc = db.parse(licenseInfo);
+      NodeList licenses = doc.getElementsByTagName("license");
+      for(int i = 0; i < licenses.getLength(); i ++)
+      {
+         Element license = (Element) licenses.item(i);
+         String key = license.getAttribute("id");
+         ArrayList headers = new ArrayList();
+         licenseHeaders.put(key, headers);
+         NodeList copyrights = license.getElementsByTagName("terms-header");
+         for(int j = 0; j < copyrights.getLength(); j ++)
+         {
+            Element copyright = (Element) copyrights.item(j);
+            copyright.normalize();
+            String id = copyright.getAttribute("id");
+            String text = getElementContent(copyright);
+            if( text == null )
+               continue;
+            // Replace all duplicate whitespace with a single space
+            text = text.replaceAll("[\\s*]+", " ");
+            if( text.length() == 1)
+               continue;
+
+            text = text.toLowerCase();
+            LicenseHeader lh = new LicenseHeader(id, text);
+            headers.add(lh);
+         }
+      }
+      log.fine(licenseHeaders.toString());
+
+      File[] files = jbossSrcRoot.listFiles(dotJavaFilter);
+      log.info("Root files count: "+files.length);
+      processSourceFiles(files, 0);
+
+      log.info("Processed "+totalCount);
+      log.info("Files with no headers: "+noheaders.size());
+      FileWriter fw = new FileWriter("NoHeaders.txt");
+      for(Iterator iter = noheaders.iterator(); iter.hasNext();)
+      {
+         File f = (File) iter.next();
+         fw.write(f.getAbsolutePath());
+         fw.write('\n');
+      }
+      fw.close();
+      log.info("Files with invalid headers: "+invalidheaders.size());
+      fw = new FileWriter("InvalidHeaders.txt");
+      for(Iterator iter = invalidheaders.iterator(); iter.hasNext();)
+      {
+         File f = (File) iter.next();
+         fw.write(f.getAbsolutePath());
+         fw.write('\n');
+      }
+      fw.close();
+   }
+
+   /**
+    * Get all non-comment content from the element.
+    * @param element
+    * @return the concatenated text/cdata content
+    */ 
+   public static String getElementContent(Element element)
+   {
+      if (element == null)
+         return null;
+
+      NodeList children = element.getChildNodes();
+      StringBuffer result = new StringBuffer();
+      for (int i = 0; i < children.getLength(); i++)
+      {
+         Node child = children.item(i);
+         if (child.getNodeType() == Node.TEXT_NODE || 
+             child.getNodeType() == Node.CDATA_SECTION_NODE)
+         {
+            result.append(child.getNodeValue());
+         }
+         else if( child.getNodeType() == Node.COMMENT_NODE )
+         {
+            // Ignore comment nodes
+         }
+         else
+         {
+            result.append(child.getFirstChild());
+         }
+      }
+      return result.toString().trim();
+   }
+
+   /**
+    * Validate the headers of all java source files
+    * 
+    * @param files
+    * @param level
+    * @throws IOException
+    */ 
+   static void processSourceFiles(File[] files, int level)
+      throws IOException
+   {
+      for(int i = 0; i < files.length; i ++)
+      {
+         File f = files[i];
+         if( level == 0 )
+            log.info("processing "+f);
+         if( f.isDirectory() )
+         {
+            File[] children = f.listFiles(dotJavaFilter);
+            processSourceFiles(children, level+1);
+         }
+         else
+         {
+            parseHeader(f);
+         }
+      }
+   }
+
+   /**
+    * Read the first comment upto the package ...; statement
+    * @param javaFile
+    */ 
+   static void parseHeader(File javaFile)
+      throws IOException
+   {
+      totalCount ++;
+      FileReader fr = new FileReader(javaFile);
+      BufferedReader br = new BufferedReader(fr);
+      String line = br.readLine();
+      StringBuffer tmp = new StringBuffer();
+      while( line != null )
+      {
+         line = line.trim();
+         if( line.startsWith("package") || line.startsWith("import") )
+            break;
+
+         // Ignore any single line comments
+         if( line.startsWith("//") )
+         {
+            line = br.readLine();
+            continue;
+         }
+
+         if( line.startsWith("/**") )
+            tmp.append(line.substring(3));
+         else if( line.startsWith("/*") )
+            tmp.append(line.substring(2));
+         else if( line.startsWith("*") )
+            tmp.append(line.substring(1));
+         else
+            tmp.append(line);
+         tmp.append(' ');
+         line = br.readLine();
+      }
+      br.close();
+      fr.close();
+
+      if( tmp.length() == 0 )
+      {
+         addDefaultHeader(javaFile);
+         return;
+      }
+
+      String text = tmp.toString();
+      // Replace all duplicate whitespace with a single space
+      text = text.replaceAll("[\\s*]+", " ");
+      if( tmp.length() == 1 )
+      {
+         addDefaultHeader(javaFile);
+         return;
+      }
+      text = text.toLowerCase();
+      // Search for a matching header
+      boolean matches = false;
+      Iterator iter = licenseHeaders.values().iterator();
+      escape:
+      while( iter.hasNext() )
+      {
+         List list = (List) iter.next();
+         Iterator jiter = list.iterator();
+         while( jiter.hasNext() )
+         {
+            LicenseHeader lh = (LicenseHeader) jiter.next();
+            if( text.startsWith(lh.text) )
+            {
+               matches = true;
+               if( log.isLoggable(Level.FINE) )
+                  log.fine(javaFile+" matches copyright "+lh.id);
+               break escape;
+            }
+            else if( javaFile.getName().equals("CompressionConstants.java") )
+            {
+               log.fine("Does not match: "+lh.id);
+            }
+         }
+      }
+      text = null;
+      tmp.setLength(0);
+      if( matches == false )
+         invalidheaders.add(javaFile);
+   }
+
+   /**
+    * Add the default jboss lgpl header
+    */ 
+   static void addDefaultHeader(File javaFile)
+      throws IOException
+   {
+      if( addDefaultHeader )
+      {
+         FileInputStream fis = new FileInputStream(javaFile);
+         FileChannel fc = fis.getChannel();
+         int size = (int) fc.size();
+         ByteBuffer contents = ByteBuffer.allocate(size);
+         fc.read(contents);
+         fis.close();
+         
+         ByteBuffer hdr = ByteBuffer.wrap(DEFAULT_HEADER.getBytes());
+         FileOutputStream fos = new FileOutputStream(javaFile);
+         fos.write(hdr.array());
+         fos.write(contents.array());
+         fos.close();
+      }
+
+      noheaders.add(javaFile);
+   }
+
+   /**
+    * A class that encapsulates the license id and valid terms header
+    */ 
+   static class LicenseHeader
+   {
+      String id;
+      String text;
+      LicenseHeader(String id, String text)
+      {
+         this.id = id;
+         this.text = text;
+      }
+   }
+   /**
+    * A filter which accepts files ending in .java (but not _Stub.java), or
+    * directories other than gen-src and gen-parsers
+    */ 
+   static class DotJavaFilter implements FileFilter
+   {
+      public boolean accept(File pathname)
+      {
+         boolean accept = false;
+         String name = pathname.getName();
+         if( pathname.isDirectory() )
+         {
+            // Ignore the gen-src directories for generated output
+            accept = name.equals("gen-src") == false
+               && name.equals("gen-parsers") == false;
+         }
+         else
+         {
+            accept = name.endsWith("_Stub.java") == false && name.endsWith(".java");
+         }
+         
+         return accept;
+      }
+   }
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/ValidateLicenseHeaders.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/XMLUtil.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/XMLUtil.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/XMLUtil.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util;
+
+import java.io.File;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.tools.ant.BuildException;
+import org.w3c.dom.Document;
+
+/**
+ * XML utility.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public abstract class XMLUtil
+{
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   /**
+    * Create a new document
+    * 
+    * @return the document
+    */
+   public static Document createDocument()
+   {
+      try
+      {
+         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+         DocumentBuilder builder = factory.newDocumentBuilder();
+         return builder.newDocument();
+      }
+      catch (Exception e)
+      {
+         throw new BuildException(e);
+      }
+   }
+   
+   /**
+    * Write a document to a file
+    * 
+    * @param file the file
+    * @param document the document
+    */
+   public static void writeXMLDocument(File file, Document document)
+   {
+      try
+      {
+         TransformerFactory factory = TransformerFactory.newInstance();
+         Transformer transformer = factory.newTransformer();
+         DOMSource domSource = new DOMSource(document);
+         StreamResult streamResult = new StreamResult(file);
+         transformer.transform(domSource, streamResult);
+      }
+      catch (Exception e)
+      {
+         throw new BuildException(e);
+      }
+   }
+
+   // Constructors --------------------------------------------------
+
+   /**
+    * Not to be instantiated
+    */
+   private XMLUtil()
+   {
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/XMLUtil.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphChildResolverVistor.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphChildResolverVistor.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphChildResolverVistor.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util.graph;
+
+import java.util.Vector;
+
+/**
+ * Examines a component reference graph vertex and determines 
+ * if a component has been resolved for the reference.
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class ComponentRefGraphChildResolverVistor implements Visitor
+{
+   /** a list of vertexes which need to be expanded */
+   private Vector unexpandedVertexes;
+
+   /**
+    * Create a new ComponentRefGraphChildResolverVistor.
+    * 
+    */
+   public ComponentRefGraphChildResolverVistor()
+   {
+      super();
+      unexpandedVertexes = new Vector();
+   }
+
+   /**
+    *If the the component reference in this vertex
+    *does not have a component, add the vertex to a list
+    */
+   public void visit(Graph g, Vertex v)
+   {
+
+      if (v instanceof ComponentRefVertex)
+      {
+         ComponentRefVertex currentComponentRefVertex = (ComponentRefVertex) v;
+
+         if (currentComponentRefVertex.getComponentRef().getComponent() == null)
+         {
+            this.getUnexpandedVertexes().add(currentComponentRefVertex);
+         }
+
+      }
+
+   }
+
+   public void visit(Graph g, Vertex v, Edge e)
+   {
+      //not implemented
+
+   }
+
+   /**
+    * Get the unexpandedVertexes.
+    * 
+    * @return the unexpandedVertexes.
+    */
+   public Vector getUnexpandedVertexes()
+   {
+      return unexpandedVertexes;
+   }
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphChildResolverVistor.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphClasspathVisitor.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphClasspathVisitor.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphClasspathVisitor.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util.graph;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.util.HashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.jboss.ant.types.build.Component;
+
+/**
+ * A visitor who writes classpath information in buildmagic format
+ *  to a file
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class ComponentRefGraphClasspathVisitor implements Visitor
+{
+
+   /** The bufferedWriter */
+   private BufferedWriter bufferedWriter;
+
+   /** The map used to store visited component id's, used to ensure no duplications */
+   private HashMap map;
+   /** The current project for logging */
+   private Project project;
+
+   /**
+    * Create a new ComponentRefGraphClasspathVisitor.
+    * 
+    * 
+    */
+   public ComponentRefGraphClasspathVisitor(Project project)
+   {
+      map = new HashMap();
+      this.project = project;
+   }
+
+   /**
+    *  For a given vertex, append 
+    *  a comment, a root property, a lib property
+    * and a list of path elements to a file
+    */
+   public void visit(Graph g, Vertex v)
+   {
+      project.log("ComponentRefGraphClasspathVisitor.visit: "+v.getName()
+         +", type: "+v.getClass(), Project.MSG_VERBOSE);
+
+      if (v instanceof ComponentRefVertex)
+      {
+         ComponentRefVertex componentRefVertex = (ComponentRefVertex) v;
+         Component component = componentRefVertex.getComponentRef().getComponent();
+         String pathName = component.getId();
+         project.log("Checking component: "+pathName, Project.MSG_VERBOSE);
+
+         //check if this component has already had classpath info generated
+         //if it has, return to calling method
+         //otherwise add it to list so we do not get duplicate entries
+         if (this.getMap().get(pathName) != null)
+            return;
+         this.getMap().put(pathName, component);
+         project.log("Generating classpath for: "+pathName, Project.MSG_VERBOSE);
+
+         try
+         {
+            //perform replacement operation on the pathname to try and match
+            //the existing libraries.ent as closely as possible
+                          
+            if (pathName.indexOf('-') != -1)
+               pathName = pathName.replace('-', '.');
+            else if (pathName.indexOf('/') != -1)
+               pathName = pathName.replace('/', '.');
+            else
+               pathName = pathName + '.' + pathName;
+
+            //add a comment
+            bufferedWriter.write("<!-- " + component.getId() + " -->");
+            bufferedWriter.newLine();
+
+            //add a root property
+            bufferedWriter.write("<property name=\"" + pathName + ".root\" value=\"${project.thirdparty}/"
+                  + component.getId() + "\"/>");
+            bufferedWriter.newLine();
+
+            //add a lib property
+            bufferedWriter.write("<property name=\"" + pathName + ".lib\" value=\"${" + pathName + ".root}/"
+                  + "lib/\"/>");
+            bufferedWriter.newLine();
+
+            //add a resource property
+            bufferedWriter.write("<property name=\"" + pathName + ".resources\" value=\"${" + pathName + ".root}/"
+                  + "resources/\"/>");
+            bufferedWriter.newLine();
+
+            //add a path id
+            bufferedWriter.write("<path id=\"" + pathName + ".classpath\">");
+            bufferedWriter.newLine();
+
+            //for each of the component's exports write out a pathelement
+            for (int i = 0; i < component.getExport().getOutputs().size(); i++)
+            {
+               File output = (File) component.getExport().getOutputs().get(i);
+
+               //add a path id
+               bufferedWriter.write("   <pathelement path=\"${" + pathName + ".lib}/" + output.getName() + "\"/>");
+               bufferedWriter.newLine();
+            }
+
+            //add a path close element
+            bufferedWriter.write("</path>");
+            bufferedWriter.newLine();
+            bufferedWriter.newLine();
+
+         }
+         catch (Exception e)
+         {
+            System.out.println(e.getMessage());
+            throw (new BuildException("Error adding information to file ", e));
+         }
+      }
+   }
+
+   public void visit(Graph g, Vertex v, Edge e)
+   {
+      //not implemented
+
+   }
+
+   /**
+    * Get the bufferedWriter.
+    * 
+    * @return the bufferedWriter.
+    */
+   public BufferedWriter getBufferedWriter()
+   {
+      return bufferedWriter;
+   }
+
+   /**
+    * Set the bufferedWriter.
+    * 
+    * @param bufferedWriter The bufferedWriter to set.
+    */
+   public void setBufferedWriter(BufferedWriter bufferedWriter)
+   {
+      this.bufferedWriter = bufferedWriter;
+   }
+
+   /**
+    * Get the map.
+    * 
+    * @return the map.
+    */
+   public HashMap getMap()
+   {
+      return map;
+   }
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphClasspathVisitor.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphFileResolverVisitor.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphFileResolverVisitor.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphFileResolverVisitor.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util.graph;
+
+import java.io.File;
+import java.util.Vector;
+
+import org.jboss.ant.util.FileUtil;
+import org.jboss.ant.types.ComponentRef;
+
+/**
+ * Examines a component reference graph vertex and determines 
+ * if a component-info.xml file has been resolved for the reference.
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class ComponentRefGraphFileResolverVisitor implements Visitor
+{
+
+   /**a list of components for which we cannot resolve their dependencies*/
+   private Vector unresolvedComponents;
+
+   /**
+    * Create a new ComponentRefGraphFileResolverVisitor.
+    */
+   public ComponentRefGraphFileResolverVisitor()
+   {
+      super();
+      unresolvedComponents = new Vector();
+   }
+
+   /**
+    *Examines the component contained in a vertex and resolves it's 
+    *depedency file or add's it to a list of unresolved dependencies
+    */
+   public void visit(Graph g, Vertex v)
+   {
+
+      if (v instanceof ComponentRefVertex)
+      {
+         ComponentRefVertex currentVertex = (ComponentRefVertex) v;
+         ComponentRef ref = currentVertex.getComponentRef();
+         //get a reference to the component-info.xml file
+         File filename = FileUtil.resolve(ref.getThirdpartyDir(), ref.getFilename());
+
+         if ((!filename.exists()) || (ref.isFileResolved()==false))
+         {
+            unresolvedComponents.add(currentVertex);
+         }
+      }
+      return;
+
+   }
+
+   /**
+    *Not implemented
+    */
+   public void visit(Graph g, Vertex v, Edge e)
+   {
+      //not implemented
+   }
+
+   /**
+    * Get the unresolvedComponents.
+    * 
+    * @return the unresolvedComponents.
+    */
+   public Vector getUnresolvedComponents()
+   {
+      return unresolvedComponents;
+   }
+
+   /**
+    * Set the unresolvedComponents.
+    * 
+    * @param unresolvedComponents The unresolvedComponents to set.
+    */
+   public void setUnresolvedComponents(Vector unresolvedComponents)
+   {
+      this.unresolvedComponents = unresolvedComponents;
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphFileResolverVisitor.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphLicenseVisitor.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphLicenseVisitor.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphLicenseVisitor.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util.graph;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Hashtable;
+import java.util.Vector;
+import java.util.HashSet;
+import java.io.File;
+import java.io.FileWriter;
+import java.net.URL;
+
+import org.jboss.ant.types.build.Component;
+import org.jboss.ant.types.build.Artifact;
+import org.jboss.ant.types.ComponentRef;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.taskdefs.Get;
+
+/**
+ * A visitor which generates a thirdparty/licenses directory containing a
+ * thirdparty-licenses.xml describing the licenses as well as the license
+ * files.
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ComponentRefGraphLicenseVisitor
+   implements Visitor, VisitorListener
+{
+   /** The HashMap<String, Component> id to Component */
+   private HashMap components = new HashMap();
+
+   /**
+    * Create a new ComponentRefGraphLicenseVisitor.
+    * 
+    * 
+    */
+   public ComponentRefGraphLicenseVisitor()
+   {
+      super();
+   }
+
+   public void beforeVisit(Graph graph, Visitor visitor, Project project)
+   {
+      project.log("beforeVisit", Project.MSG_VERBOSE);
+   }
+   public void afterVisit(Graph graph, Visitor visitor, Project project)
+      throws BuildException
+   {
+      project.log("afterVisit", Project.MSG_VERBOSE);
+      String baseDir = project.getProperty("basedir");
+      File licensesDir = new File(baseDir, "../thirdparty/licenses");
+      licensesDir.mkdirs();
+      project.log("Writing license info to dir: "+licensesDir);
+      File licenseInfo = new File(licensesDir, "thirdparty-licenses.xml");
+      HashSet licenses = new HashSet();
+      try
+      {
+         FileWriter fw = new FileWriter(licenseInfo);
+         fw.write("<thirdparty-licenses>");
+         Iterator iter = components.values().iterator();
+         while( iter.hasNext() )
+         {
+            Component comp = (Component) iter.next();
+            Hashtable attributes = comp.getAttributes();
+            project.log("Component, name: "+comp.getName()+", attrs: "+attributes);
+            fw.write("\t<module name='");
+            fw.write(comp.getName());
+            fw.write("'\n\t\tlicenseType='");
+            String license = (String) attributes.get("licensetype");
+            if( license == null )
+               project.log("No licenseType for component: "+comp.getName(), Project.MSG_ERR);
+            else
+               licenses.add(license);
+            fw.write(""+license);
+            fw.write("'\n\t\tversion='");
+            fw.write(comp.getVersion().toString());
+            fw.write("'\n\t\tprojectHome='");
+            fw.write(""+attributes.get("projecthome"));
+            fw.write("'\n\t\tdescription='");
+            String description = comp.getDescription();
+            fw.write(description == null ? "no description" : description);
+            fw.write("'>\n");
+            Vector artifacts = comp.getArtifacts();
+            for(int n = 0; n < artifacts.size(); n ++)
+            {
+               Artifact artifact = (Artifact) artifacts.get(n);
+               fw.write("\t\t<jar name='");
+               fw.write(artifact.getId());
+               fw.write("' />\n");
+            }
+            fw.write("\t</module>\n");
+         }
+         fw.write("</thirdparty-licenses>");
+         fw.close();
+
+         // Create a getLicenses target to obtain the licenses in use
+         URL licensesURL = new URL("http://repository.jboss.com/licenses/");
+         iter = licenses.iterator();
+         Target target = new Target();
+         target.setName("getLicenses");
+         target.setProject(project);
+         while( iter.hasNext() )
+         {
+            Get get = new Get();
+            String type = (String) iter.next();
+            File licenseFile = new File(licensesDir, type+".txt");
+            URL licenseSrc = new URL(licensesURL, type+".txt");
+            get.setTaskName("get-"+type);
+            get.setSrc(licenseSrc);
+            get.setDest(licenseFile);
+            get.setUseTimestamp(true);
+            get.setIgnoreErrors(true);
+            get.setVerbose(true);
+            get.setProject(project);
+            target.addTask(get);
+         }
+         // Get the licenses/license-info.xml file
+         Get getInfo = new Get();
+         File licenseFile = new File(licensesDir, "license-info.xml");
+         URL licenseSrc = new URL(licensesURL, "license-info.xml");
+         getInfo.setTaskName("get-license-info.xml");
+         getInfo.setSrc(licenseSrc);
+         getInfo.setDest(licenseFile);
+         getInfo.setUseTimestamp(true);
+         getInfo.setIgnoreErrors(true);
+         getInfo.setVerbose(true);
+         getInfo.setProject(project);
+         target.addTask(getInfo);
+
+         project.addTarget(target);
+         project.executeTarget("getLicenses");
+      }
+      catch(Exception e)
+      {
+         throw new BuildException(e);
+      }
+   }
+
+   /**
+    * Visit a vertex and perform some action regarding the license
+    */
+   public void visit(Graph g, Vertex v)
+   {
+      if (v instanceof ComponentRefVertex)
+      {
+         ComponentRefVertex currentVertex = (ComponentRefVertex) v;
+         ComponentRef compRef = currentVertex.getComponentRef();
+         Component comp = compRef.getComponent();
+         components.put(comp.getName(), comp);
+      }
+      return;
+   }
+
+   public void visit(Graph g, Vertex v, Edge e)
+   {
+      //not implemented
+
+   }
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefGraphLicenseVisitor.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefVertex.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefVertex.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefVertex.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util.graph;
+
+import org.jboss.ant.types.ComponentRef;
+
+/**
+ * A vertex which contains a component reference
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehrk</a>
+ * @version $Revision$
+ */
+public class ComponentRefVertex extends Vertex
+{
+   /** The componentRef held at this vertex */
+   private ComponentRef componentRef;
+
+   /**
+    * Create a new ComponentRefVertex.
+    */
+   public ComponentRefVertex()
+   {
+      super();
+   }
+
+   /**
+    * Create a new ComponentRefVertex.
+    * 
+    * @param n
+    */
+   public ComponentRefVertex(String n)
+   {
+      super(n);
+   }
+
+   /**
+    * Get the component.
+    * 
+    * @return the component.
+    */
+   public ComponentRef getComponentRef()
+   {
+      return componentRef;
+   }
+
+   /**
+    * Set the component.
+    * 
+    * @param componentRef The component to set.
+    */
+   public void setComponentRef(ComponentRef componentRef)
+   {
+      this.componentRef = componentRef;
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/ComponentRefVertex.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Edge.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Edge.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Edge.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.ant.util.graph;
+
+/**
+ * A directed, weighted edge in a graph
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class Edge
+{
+	private Vertex from;
+	private Vertex to;
+	private int cost;
+	private boolean mark;
+	
+	// Create an edge with 0 cost
+	public Edge(Vertex one, Vertex two)
+	{
+		from = one;
+		to = two;
+		cost = 0;
+		mark = false;
+	}
+	
+	// Create an edge and define the cost
+	public Edge(Vertex one, Vertex two, int c)
+	{
+		from = one;
+		to = two;
+		cost = c;
+		mark = false;
+	}
+	
+   public Vertex getTo()
+   {
+      return to;
+   }
+   public Vertex getFrom()
+   {
+      return from;
+   }
+   public int getCost()
+   {
+      return cost;
+   }
+
+	// Mark an edge
+	public void mark()
+	{
+		mark = true;
+	}
+	
+	// Clear the mark
+	public void clearMark()
+	{
+		mark = false;
+	}
+	
+	// Test the mark
+	public boolean isMarked()
+	{
+		return mark;
+	}
+	
+	public String toString()
+	{
+		StringBuffer tmp = new StringBuffer("Edge[from: ");
+      tmp.append(from.getName());
+      tmp.append(",to: ");
+      tmp.append(to.getName());
+      tmp.append(", cost: ");
+      tmp.append(cost);
+      tmp.append("]");
+      return tmp.toString();
+	}
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Edge.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Graph.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Graph.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Graph.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,316 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.ant.util.graph;
+
+import java.util.Vector;
+import java.util.LinkedList;
+import java.util.ArrayList;
+
+/**
+ * A directed graph data structure.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class Graph
+{
+   /** Color used to mark unvisited nodes */
+   public static final int VISIT_COLOR_WHITE = 1;
+   /** Color used to mark nodes as they are first visited in DFS order */
+   public static final int VISIT_COLOR_GREY = 2;
+   /** Color used to mark nodes after descendants are completely visited */
+   public static final int VISIT_COLOR_BLACK = 3;
+   /** Vector<Vertex> of graph verticies */
+   private Vector verticies;
+   /** Vector<Edge> of edges in the graph */
+   private Vector edges;
+
+   // Construct a new graph
+   public Graph()
+   {
+      verticies = new Vector();
+      edges = new Vector();
+   }
+
+   /**
+    * Are there any verticies in the graph
+    * @return true if there are no verticies in the graph
+    */ 
+   public boolean isEmpty()
+   {
+      return verticies.size() == 0;
+   }
+
+   /**
+    * Add a vertex to the graph
+    * @param v the Vertex to add
+    * @return true if the vertex was added, false if it was already in the graph.
+    */ 
+   public boolean addVertex(Vertex v)
+   {
+      return verticies.add(v);
+   }
+
+   /**
+    * Get the vertex count.
+    * @return the number of verticies in the graph.
+    */ 
+   public int size()
+   {
+      return verticies.size();
+   }
+
+   /**
+    * Get the given Vertex.
+    * @param n the index [0, size()-1] of the Vertex to access
+    * @return the nth Vertex
+    */ 
+   public Vertex getVertex(int n)
+   {
+      Vertex v = (Vertex) verticies.get(n);
+      return v;
+   }
+
+   /**
+    * Insert a directed, weighted edge into the graph
+    * @param from - the edge starting vertex
+    * @param to - the edge ending vertex
+    * @param cost - the edge weight/cost
+    * @return true if the edge was added, false if from already has this edge
+    */ 
+   public boolean addEdge(Vertex from, Vertex to, int cost)
+   {
+      Edge ed = new Edge(from, to, cost);
+      if (from.findEdge(to) != null)
+         return false;
+      else
+      {
+         from.addEdge(ed);
+         to.addEdge(ed);
+         edges.addElement(ed);
+         return true;
+      }
+   }
+
+   /**
+    * Insert a bidirectional edge in the graph
+    * @param from - the edge starting vertex
+    * @param to - the edge ending vertex
+    * @param cost - the edge weight/cost
+    * @return true if edges between both nodes were added, false otherwise
+    */ 
+   public boolean insertBiEdge(Vertex from, Vertex to, int cost)
+   {
+      return addEdge(from, to, cost) && addEdge(to, from, cost);
+   }
+
+   /**
+    * Remove a vertex from the graph
+    * @param from the Vertex to remove
+    * @return true if the Vertex was removed
+    */ 
+   public boolean removeVertex(Vertex from)
+   {
+      if (!verticies.contains(from))
+         return false;
+
+      verticies.removeElement(from);
+		for(int n = 0; n < from.getOutgoingEdgeCount(); n ++)
+      {
+         Edge e = from.getOutgoingEdge(n);
+         from.remove(e);
+         Vertex to = e.getTo();
+         to.remove(e);
+         edges.removeElement(e);
+      }
+      for(int n = 0; n < from.getIncomingEdgeCount(); n ++)
+      {
+         Edge e = from.getIncomingEdge(n);
+         from.remove(e);
+         Vertex predecessor = e.getFrom();
+         predecessor.remove(e);
+      }
+      return true;
+   }
+
+   /**
+    * Remove an edge from the graph
+    * @param from - the edge starting vertex
+    * @param to - the edge ending vertex
+    * @return true if the edge exists, false otherwise
+    */ 
+   public boolean removeEdge(Vertex from, Vertex to)
+   {
+      Edge e = from.findEdge(to);
+      if (e == null)
+         return false;
+      else
+      {
+         from.remove(e);
+         to.remove(e);
+         edges.removeElement(e);
+         return true;
+      }
+   }
+
+   /**
+    * Clear the mark state of all verticies in the graph by calling
+    * clearMark() on all verticies.
+    * @see Vertex#clearMark()
+    */ 
+   public void clearMark()
+   {
+      for (int i = 0; i < verticies.size(); i++)
+      {
+         Vertex w = (Vertex) verticies.elementAt(i);
+         w.clearMark();
+      }
+   }
+
+   /**
+    * Clear the mark state of all edges in the graph by calling
+    * clearMark() on all edges.
+    * @see Edge#clearMark()
+    */ 
+   public void clearEdges()
+   {
+      for (int i = 0; i < edges.size(); i++)
+      {
+         Edge e = (Edge) edges.elementAt(i);
+         e.clearMark();
+      }
+   }
+
+   /**
+    * Perform a depth first serach using recursion.
+    * @param v - the Vertex to start the search from
+    * @param visitor - the vistor to inform prior to 
+    * @see Visitor#visit(Graph, Vertex) 
+    */ 
+   public void depthFirstSearch(Vertex v, Visitor visitor)
+   {
+      if( visitor != null )
+         visitor.visit(this, v);      
+      v.visit();
+      for (int i = 0; i < v.getOutgoingEdgeCount(); i++)
+      {
+         Edge e = v.getOutgoingEdge(i);
+         if (!e.getTo().visited())
+         {
+            depthFirstSearch(e.getTo(), visitor);
+         }
+      }
+   }
+
+   // Breadth First Search
+   public void breadthFirstSearch(Vertex v, Visitor visitor)
+   {
+      LinkedList q = new LinkedList();
+
+      q.add(v);
+      if( visitor != null )
+         visitor.visit(this, v);
+      v.visit();
+      while (q.isEmpty() == false)
+      {
+         v = (Vertex) q.removeFirst();
+         for (int i = 0; i < v.getOutgoingEdgeCount(); i++)
+         {
+            Edge e = v.getOutgoingEdge(i);
+            if (!e.getTo().visited())
+            {
+               q.add(e.getTo());
+               if( visitor != null )
+                  visitor.visit(this, e.getTo());
+               e.getTo().visit();
+            }
+         }
+      }
+   }
+
+   // Find Spanning Tree
+   public void dfsSpanningTree(Vertex v, Visitor visitor)
+   {
+      v.visit();
+      if( visitor != null )
+         visitor.visit(this, v);
+
+      for (int i = 0; i < v.getOutgoingEdgeCount(); i++)
+      {
+         Edge e = v.getOutgoingEdge(i);
+         if (!e.getTo().visited())
+         {
+            if( visitor != null )
+               visitor.visit(this, v, e);
+            e.mark();
+            dfsSpanningTree(e.getTo(), visitor);
+         }
+      }
+   }
+
+
+   /*
+   In order to detect cycles, we use a modified depth first search called a
+   colored DFS. All nodes are initially marked white. When a node is
+   encountered, it is marked grey, and when its descendants are completely
+   visited, it is marked black. If a grey node is ever encountered, then there
+   is a cycle. 
+   */
+   public Edge[] findCycles()
+   {
+      ArrayList cycleEdges = new ArrayList();
+      // Mark all verticies as white
+      for(int n = 0; n < verticies.size(); n ++)
+      {
+         Vertex v = getVertex(n);
+         v.setMarkState(VISIT_COLOR_WHITE);
+      }
+      for(int n = 0; n < verticies.size(); n ++)
+      {
+         Vertex v = getVertex(n);
+         visit(v, cycleEdges);
+      }
+      Edge[] cycles = new Edge[cycleEdges.size()];
+      cycleEdges.toArray(cycles);
+      return cycles;
+   }
+
+   private void visit(Vertex v, ArrayList cycleEdges)
+   {
+      v.setMarkState(VISIT_COLOR_GREY);
+      int count = v.getOutgoingEdgeCount();
+      for(int n = 0; n < count; n ++)
+      {
+         Edge e = v.getOutgoingEdge(n);
+         Vertex u = e.getTo();
+         if( u.getMarkState() == VISIT_COLOR_GREY )
+         {
+            // A cycle edge
+            cycleEdges.add(e);
+         }
+         else if( u.getMarkState() == VISIT_COLOR_WHITE )
+         {
+            visit(u, cycleEdges);
+         }
+      }
+      v.setMarkState(VISIT_COLOR_BLACK);
+   }
+
+   public String toString()
+   {
+      StringBuffer tmp = new StringBuffer("Graph[");
+      for (int i = 0; i < verticies.size(); i++)
+      {
+         Vertex v = (Vertex) verticies.elementAt(i);
+         tmp.append(v);
+      }
+      tmp.append(']');
+      return tmp.toString();
+   }
+   
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Graph.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/RootVertex.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/RootVertex.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/RootVertex.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util.graph;
+
+/**
+ * A root vertex
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class RootVertex extends Vertex
+{
+   /**
+    * Create a new RootVertex.
+    * 
+    * 
+    */
+   public RootVertex()
+   {
+      super();
+   }
+
+   /**
+    * Create a new RootVertex.
+    * 
+    * @param n
+    */
+   public RootVertex(String n)
+   {
+      super(n);
+   }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/RootVertex.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Vertex.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Vertex.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Vertex.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,218 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.ant.util.graph;
+
+import java.util.Vector;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class Vertex
+{
+	private Vector incomingEdges;
+	private Vector outgoingEdges;
+	private String name;
+	private boolean mark;
+	private int markState;
+
+   /**
+    * Calls this(null).
+    */ 
+   public Vertex()
+   {
+      this(null);
+   }
+	/**
+    * Create a vertex with the given name
+    * @param n
+    */ 
+	public Vertex(String n)
+	{
+		incomingEdges = new Vector();
+		outgoingEdges = new Vector();
+		name = new String(n);
+		mark = false;
+	}
+
+   public String getName()
+   {
+      return name;
+   }
+
+	/**
+    * 
+    * @param e
+    * @return true if the edge was added, false otherwise
+    */ 
+	public boolean addEdge(Edge e)
+	{
+		if (e.getFrom() == this)
+         outgoingEdges.addElement(e);
+		else if (e.getTo() == this)
+         incomingEdges.addElement(e);
+		else 
+			return false;
+		return true;
+	}
+	
+	/**
+    * 
+    * @param e
+    * @return
+    */ 
+	public boolean hasEdge(Edge e)
+	{
+		if (e.getFrom() == this)
+			return incomingEdges.contains(e);
+		else if (e.getTo() == this)
+			return outgoingEdges.contains(e);
+		else 
+			return false;
+	}
+	
+	// Remove an edge from this vertex
+	public boolean remove(Edge e)
+	{
+		if (e.getFrom() == this)
+			incomingEdges.removeElement(e);
+		else if (e.getTo() == this)
+			outgoingEdges.removeElement(e);
+		else 
+			return false;
+		return true;
+	}
+	
+	public int getIncomingEdgeCount()
+	{
+		return incomingEdges.size();
+	}
+	
+	public Edge getIncomingEdge(int i)
+	{
+      Edge e = (Edge) incomingEdges.get(i);
+      return e;
+	}
+
+   public int getOutgoingEdgeCount()
+   {
+      return outgoingEdges.size();
+   }
+   public Edge getOutgoingEdge(int i)
+	{
+      Edge e = (Edge) outgoingEdges.get(i);
+      return e;
+	}
+	
+	// Do we have an edge that goes to dest?
+	public Edge findEdge(Vertex dest)
+	{
+		for (int i = 0; i < incomingEdges.size(); i++)
+		{
+			Edge e = (Edge)incomingEdges.elementAt(i);
+			if (e.getTo() == dest)
+				return e;
+		}
+		return null;
+	}	
+	
+	// Do we have the edge e?  Only looks at sucessors
+	public Edge findEdge(Edge e)
+	{
+		if (incomingEdges.contains(e))
+			return e;
+		else
+			return null;
+	}	
+
+   /**
+    * What is the cost to this vertex.
+    * Return Integer.MAX_VALUE if we have no edge to dest
+    * @param dest
+    * @return
+    */ 
+	public int cost(Vertex dest)
+	{
+		if (dest == this)
+			return 0;
+			
+		Edge e = findEdge(dest);
+		if (e != null)
+			return e.getCost();
+		else
+			return Integer.MAX_VALUE;
+	}
+		
+	// Do we have an edge to dest?
+	public boolean hasEdge(Vertex dest)
+	{
+		return (findEdge(dest) != null);
+	}
+	
+	// Have we been here before?
+	public boolean visited()
+	{
+		return mark;
+	}
+	
+   public void mark()
+   {
+      mark = true;
+   }
+   public void setMarkState(int state)
+   {
+      markState = state;
+   }
+	public int getMarkState()
+   {
+      return markState;
+   }
+
+	public void visit()
+	{
+		mark();
+	}
+	
+	// Clear the mark
+	public void clearMark()
+	{
+		mark = false;
+	}
+	
+   public String toString()
+   {
+      StringBuffer tmp = new StringBuffer("Vertex(");
+      tmp.append(name);
+      tmp.append("), in:[");
+      for (int i = 0; i < incomingEdges.size(); i++)
+      {
+         Edge e = (Edge) incomingEdges.elementAt(i);
+         if( i > 0 )
+            tmp.append(',');
+         tmp.append('{');
+         tmp.append(e.getFrom().name);
+         tmp.append(',');
+         tmp.append(e.getCost());
+         tmp.append('}');
+      }
+      tmp.append("], out:[");
+      for (int i = 0; i < outgoingEdges.size(); i++)
+      {
+         Edge e = (Edge) outgoingEdges.elementAt(i);
+         if( i > 0 )
+            tmp.append(',');
+         tmp.append('{');
+         tmp.append(e.getTo().name);
+         tmp.append(',');
+         tmp.append(e.getCost());
+         tmp.append('}');
+      }
+      tmp.append(']');
+      return tmp.toString();
+   }
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Vertex.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Visitor.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Visitor.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Visitor.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util.graph;
+
+/**
+ * A graph visitor interface.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface Visitor
+{
+   /**
+    * Called by the graph traversal methods when a vertex is first visited.
+    * 
+    * @param g - the graph
+    * @param v - the vertex being visited.
+    */
+   public void visit(Graph g, Vertex v);
+
+   /**
+    * Used dfsSpanningTree to notify the visitor of each outgoing edge to
+    * an unvisited vertex.
+    * 
+    * @param g - the graph
+    * @param v - the vertex being visited
+    * @param e - the outgoing edge from v
+    */
+   public void visit(Graph g, Vertex v, Edge e);
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/Visitor.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/VisitorListener.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/VisitorListener.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/VisitorListener.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ant.util.graph;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.BuildException;
+
+/**
+ * An interface for listeners of graph visitations.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface VisitorListener
+{
+   /**
+    * Called before a graph traversal is performed.
+    * 
+    * @param graph - the graph
+    * @param visitor - the visitor that will be notified during traversal
+    * @param project - the current project
+    */
+   public void beforeVisit(Graph graph, Visitor visitor, Project project)
+      throws BuildException;
+
+   /**
+    * Called after a graph traversal is performed.
+    *  
+    * @param graph - the graph
+    * @param visitor - the visitor that will be notified during traversal
+    * @param project - the current project
+    */
+   public void afterVisit(Graph graph, Visitor visitor, Project project)
+      throws BuildException;
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/graph/VisitorListener.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/package.html
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/package.html	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/package.html	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <!-- $Id$ -->
+    <!--
+
+    JBoss: The OpenSource J2EE WebOS 
+
+    Distributable under LGPL license.
+    See terms of license at gnu.org.
+
+    -->
+  </head>
+
+  <body bgcolor="white">
+    <p>Utility classes.
+
+    <h2>Package Specification</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+      
+    <h2>Related Documentation</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+
+    <h2>Package Status</h2>
+    <ul>
+      <li><font color="red"><b>ALPHA</b></font>
+    </ul>
+
+    <h2>Todo</h2>
+    <ul>
+      <li>???
+    </ul>
+
+    <!-- Put @see and @since tags down here. -->
+
+  </body>
+</html>


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/ant/util/package.html
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/test/GraphTestCase.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/test/GraphTestCase.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/test/GraphTestCase.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,190 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.test;
+
+import java.util.ArrayList;
+
+import junit.framework.TestCase;
+
+import org.jboss.ant.util.graph.Graph;
+import org.jboss.ant.util.graph.Edge;
+import org.jboss.ant.util.graph.Vertex;
+import org.jboss.ant.util.graph.Visitor;
+
+/**
+ * Tests of the graph package
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class GraphTestCase extends TestCase
+{
+   Vertex a = new Vertex("A");
+   Vertex b = new Vertex("B");
+   Vertex c = new Vertex("C");
+   Vertex d = new Vertex("D");
+   Vertex e = new Vertex("E");
+   Vertex f = new Vertex("F");
+   Vertex g = new Vertex("G");
+   Vertex h = new Vertex("H");
+   Vertex i = new Vertex("I");
+
+   /** Depth first search of digraph1
+    * @throws Exception
+    */ 
+   public void testDFS()
+      throws Exception
+   {
+      Graph graph = buildGraph1();
+
+      final ArrayList order = new ArrayList();
+      Visitor visitor = new Visitor()
+      {
+         public void visit(Graph g, Vertex v)
+         {
+            System.out.println("visit "+v.getName());
+            order.add(v);
+         }
+         public void visit(Graph g, Vertex v, Edge e)
+         {
+         }
+      };
+      graph.depthFirstSearch(a, visitor);
+
+      assertTrue("Visted count == 8("+order.size()+")", order.size() == 8);
+      // Validate the expected order and visited state
+      for(int n = 0; n < order.size(); n ++)
+      {
+         Vertex v = (Vertex) order.get(n);
+         System.out.println(v);
+         assertTrue(v.getName()+" is visited", v.visited());
+      }
+      String[] names = {"A", "B", "C", "H", "G", "I", "E", "F"};
+      for(int n = 0; n < order.size(); n ++)
+      {
+         Vertex v = (Vertex) order.get(n);
+         assertTrue("#"+n+" is "+names[n]+"("+v.getName()+")",
+            v.getName().equals(names[n]));
+      }
+   }
+
+   /** Breadth first search of digraph1
+    * @throws Exception
+    */ 
+   public void testBFS()
+      throws Exception
+   {
+      Graph graph = buildGraph1();
+
+      final ArrayList order = new ArrayList();
+      Visitor visitor = new Visitor()
+      {
+         public void visit(Graph g, Vertex v)
+         {
+            System.out.println("visit "+v.getName());
+            order.add(v);
+         }
+         public void visit(Graph g, Vertex v, Edge e)
+         {
+         }
+      };
+      graph.breadthFirstSearch(a, visitor);
+
+      assertTrue("Visted count == 8("+order.size()+")", order.size() == 8);
+      // Validate the expected order and visited state
+      for(int n = 0; n < order.size(); n ++)
+      {
+         Vertex v = (Vertex) order.get(n);
+         System.out.println(v);
+         assertTrue(v.getName()+" is visited", v.visited());
+      }
+      String[] names = {"A", "B", "F", "C", "G", "E", "I", "H"};
+      for(int n = 0; n < order.size(); n ++)
+      {
+         Vertex v = (Vertex) order.get(n);
+         assertTrue("#"+n+" is "+names[n]+"("+v.getName()+")",
+            v.getName().equals(names[n]));
+      }
+   }
+
+   public void testCycleDection()
+   {
+      Graph g = new Graph();
+      Vertex v0 = new Vertex("V0");
+      Vertex v1 = new Vertex("V1");
+      Vertex v2 = new Vertex("V2");
+      g.addVertex(v0);
+      g.addVertex(v1);
+      g.addVertex(v2);
+
+      g.addEdge(v0, v1, 0);
+      g.addEdge(v1, v2, 0);
+      g.addEdge(v2, v0, 0);
+
+      Edge[] cycleEdges = g.findCycles();
+      assertTrue("There is a cycle", cycleEdges.length == 1);
+      for(int n = 0; n < cycleEdges.length; n ++)
+         System.out.println(cycleEdges[n]);
+
+      Edge e = cycleEdges[0];
+      Vertex vx = e.getFrom();
+      Vertex vy = e.getTo();
+      assertTrue("Cycle edge is V2->V0", vx.getName().equals("V2")
+         && vy.getName().equals("V0"));
+   }
+
+   /** Build the following digraph:
+    A : B, F
+    B : C, G
+    C : H
+    D : E, H
+    E : 
+    F : E, I
+    G : A
+    H : G, I
+    I : E, G
+    */ 
+   private Graph buildGraph1()
+   {
+      Graph graph = new Graph();
+      assertTrue("Added A", graph.addVertex(a));
+      assertTrue("Added B", graph.addVertex(b));
+      assertTrue("Added C", graph.addVertex(c));
+      assertTrue("Added D", graph.addVertex(d));
+      assertTrue("Added E", graph.addVertex(e));
+      assertTrue("Added F", graph.addVertex(f));
+      assertTrue("Added G", graph.addVertex(g));
+      assertTrue("Added H", graph.addVertex(h));
+      assertTrue("Added I", graph.addVertex(i));
+
+      // A : B, F
+      assertTrue("Added A -> B", graph.addEdge(a, b, 0));
+      assertTrue("Added A -> F", graph.addEdge(a, f, 0));
+      // B : C, G
+      assertTrue("Added B -> C", graph.addEdge(b, c, 0));
+      assertTrue("Added B -> G", graph.addEdge(b, g, 0));
+      // C : H
+      assertTrue("Added C -> H", graph.addEdge(c, h, 0));
+      // D : E, H
+      assertTrue("Added D -> E", graph.addEdge(d, e, 0));
+      assertTrue("Added D -> H", graph.addEdge(d, h, 0));
+      // F : E, I
+      assertTrue("Added F -> E", graph.addEdge(f, e, 0));
+      assertTrue("Added F -> I", graph.addEdge(f, i, 0));
+      // G : A
+      assertTrue("Added G -> A", graph.addEdge(g, a, 0));
+      // H : G, I
+      assertTrue("Added H -> G", graph.addEdge(h, g, 0));
+      assertTrue("Added H -> I", graph.addEdge(h, i, 0));
+      // I : E, G
+      assertTrue("Added I -> E", graph.addEdge(i, e, 0));
+      assertTrue("Added I -> G", graph.addEdge(i, g, 0));
+      assertTrue("Graph has 9 verticies", graph.size() == 9);
+      return graph;
+   }
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/test/GraphTestCase.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/test/VersionTest.java
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/test/VersionTest.java	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/test/VersionTest.java	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test;
+
+import junit.framework.TestCase;
+
+import org.jboss.ant.types.attributes.Version;
+
+/**
+ * A VersionTest.
+ * 
+ * @author <a href="ruel.loehr at jboss.com">Ruel Loehr</a>
+ * @version $Revision$
+ */
+public class VersionTest extends TestCase
+{
+
+   Version newversion1=new Version("1");
+   Version newversion2=new Version("1.1");
+   Version newversion3=new Version("1.1.2");
+   Version newversion4=new Version("ruel");
+   Version newversion5=new Version("ruel.1");
+   Version newversion6=new Version("ruel.1jboss");
+   Version newversion7=new Version("ruel.1jbossa");
+   Version newversion8=new Version("1.1.2");
+   
+  public void testComparison()
+  {
+   int test1=newversion1.compareTo(newversion2);
+   int test2=newversion1.compareTo(newversion3);
+   int test3=newversion2.compareTo(newversion3);
+   int test4=newversion1.compareTo(newversion4);
+   int test5=newversion4.compareTo(newversion5);
+   int test6=newversion5.compareTo(newversion6);
+   int test7=newversion6.compareTo(newversion7);
+   int test8=newversion3.compareTo(newversion8);
+   
+   assertTrue(test1 < 0);
+   assertTrue(test2 < 0);
+   assertTrue(test3 < 0);
+   assertTrue(test4 < 0);
+   assertTrue(test5 < 0);
+   assertTrue(test6 < 0);
+   assertTrue(test7 < 0);
+   assertTrue(test8 == 0);
+   
+   
+   
+   
+  }
+
+}


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/main/org/jboss/test/VersionTest.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/src/resources/tasks.xml
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/src/resources/tasks.xml	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/src/resources/tasks.xml	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,319 @@
+<?xml version="1.0"?>
+
+<!--
+ JBoss, the OpenSource J2EE webOS
+ 
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+-->
+<project name="jboss.ant.tasks"
+         default="help"
+>
+   <!-- PROPERTIES -->
+
+   <!-- JBoss Tasks Classpath -->
+   <property name="jboss.tasks.path" 
+             value="output/eclipse-classes/main"
+   />
+
+   <!-- TYPEDEFS -->
+
+   <!-- The build type -->
+   <typedef name="build"
+            classname="org.jboss.ant.types.build.Build" 
+            loaderRef="jboss.tasks.path"
+            classpath="${jboss.tasks.path}"
+   />
+
+   <!-- The artifact type definition type -->
+   <typedef name="artifacttype"
+            classname="org.jboss.ant.types.build.ArtifactType" 
+            loaderRef="jboss.tasks.path"
+            classpath="${jboss.tasks.path}"
+   />
+
+   <!-- The component definition type -->
+   <typedef name="componentdef"
+            classname="org.jboss.ant.types.component.ComponentDefinition" 
+            loaderRef="jboss.tasks.path"
+            classpath="${jboss.tasks.path}"
+   />
+
+   <!-- The includes type -->
+   <typedef name="includes"
+            classname="org.jboss.ant.types.Includes" 
+            loaderRef="jboss.tasks.path"
+            classpath="${jboss.tasks.path}"
+   />
+
+   <!-- The build targets type -->
+   <typedef name="targets"
+            classname="org.jboss.ant.types.target.TargetDefinitions" 
+            loaderRef="jboss.tasks.path"
+            classpath="${jboss.tasks.path}"
+   />
+
+   <!-- TASKDEFS -->
+
+   <!-- Update ide info for the main build -->
+   <taskdef name="idemain"
+            classname="org.jboss.ant.tasks.build.IDETask"
+            loaderRef="jboss.tasks.path"
+            classpath="${jboss.tasks.path}"
+   />
+
+   <!-- Update ide info for the component -->
+   <taskdef name="idecomponent"
+            classname="org.jboss.ant.tasks.component.IDETask"
+            loaderRef="jboss.tasks.path"
+            classpath="${jboss.tasks.path}"
+   />
+
+   <!-- DEFINITIONS -->
+
+   <!-- The artifact types -->
+   <artifacttype id="jar" outputtype="lib"/>
+   <artifacttype id="api" outputtype="api"/>
+
+   <!-- The default targets -->   
+   <targets id="targets">
+
+      <!-- Build All -->
+      <targetdef target="all" description="Build All">
+         <main depends="build, doc, test, archives" components="none"/>
+         <component depends="build, doc, test"/>
+      </targetdef>
+
+      <!-- Build -->
+      <targetdef target="build" description="Build">
+
+         <!-- Build the main release -->
+         <main>
+            <mkdir dir="@{releaseDir}"/>
+            <antCall target="release"/>
+         </main>
+
+         <!-- Build the component -->
+         <component>
+            <mkdir dir="@{output}"/>
+         </component>
+
+         <!-- Compile the source -->
+         <source>
+            <mkdir dir="@{output}"/>
+            <depend srcdir="@{sourcePath}" destdir="@{output}">
+               <classpath>
+                  <pathelements/>
+               </classpath>
+            </depend>
+            <javac srcdir="@{sourcePath}" destdir="@{output}">
+               <classpath>
+                  <pathelements/>
+               </classpath>
+            </javac>
+         </source>
+
+         <!-- Create a jar archive -->
+         <jar>
+            <mkdir dir="@{parentDir}"/>
+            <jar destfile="@{output}">
+               <filesets/>
+            </jar>
+         </jar>
+      </targetdef>
+
+      <!-- Build the release -->
+      <targetdef target="release">
+
+         <!-- Copy the artifact into the release -->
+         <artifact when="@{release}">
+            <mkdir dir="@{release}"/>
+            <copy todir="@{release}">
+               <output/>
+            </copy>
+         </artifact>
+      </targetdef>
+
+      <!-- Build the release archives -->
+      <targetdef target="archives">
+
+         <!-- Make the archives -->
+         <main>
+         
+            <!-- Create the zip file -->
+            <zip destfile="@{output}/@{releaseName}.zip"
+                 basedir="@{releaseDir}"
+            />
+         </main>
+      </targetdef>
+
+      <!-- Documentation -->
+      <targetdef target="doc" description="Documentation">
+
+         <!-- Generate the documentation -->
+         <component depends="api"/>
+      </targetdef>
+
+      <!-- Javadoc -->
+      <targetdef target="api" description="Javadoc">
+
+         <!-- Generate the javadoc -->
+         <component/>
+         <api>
+            <mkdir dir="@{output}"/>
+            <javadoc packagenames="*"
+                     destdir="@{output}"
+            >
+               <doctitle>
+                  <![CDATA[<h1>@{description} API Documentation</h1>]]>
+               </doctitle>
+               <bottom>
+                  <![CDATA[
+                     <i>
+                        <div align="center">
+                           <font size="-1">
+                              Copyright &#169; 2005 JBoss Inc. All Rights Reservered.
+                           </font>
+                        </div>
+                     </i>
+                  ]]>
+               </bottom>
+               <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
+               <sourcepath>
+                  <sourcepaths/>
+               </sourcepath>
+               <classpath>
+                  <sourcepathelements/>
+               </classpath>
+            </javadoc>
+         </api>
+      </targetdef>
+
+      <!-- Clean the output -->
+      <targetdef target="clean" description="Clean">
+         <common>
+            <delete dir="@{output}"/>
+         </common>
+      </targetdef>
+
+      <!-- Clobber everything -->
+      <targetdef target="clobber" description="Clobber">
+         <main depends="clean">
+            <delete dir="@{thirdparty}"/>
+         </main>
+      </targetdef>
+
+      <!-- Synchronize -->
+      <targetdef target="synchronize" description="Synchronize">
+         <main components="none">
+            <echo>FIXME cvsupdate ${basedir}</echo>
+            <execant target="synchronize.components"/>
+            <execant target="synchronize.main.after"/>
+         </main>
+         <component>
+            <echo>FIXME cvsupdate ${basedir}</echo>
+            <execant target="synchronize.component.after"/>
+         </component>
+         <artifact local="false">
+            <echo>FIXME download/cvscheckout</echo>
+            <mkdir dir="@{parentDir}"/>
+            <get src="@{location}" 
+                 dest="@{output}" 
+                 useTimestamp="true" 
+                 verbose="true"
+            />
+         </artifact>
+      </targetdef>
+
+      <!-- Commit -->
+      <targetdef target="commit" description="Commit">
+         <common>
+            <echo>FIXME cvscommit</echo>
+         </common>
+      </targetdef>
+      
+      <!-- Test -->
+      <targetdef target="test" description="Run the Tests">
+         <component depends="build, runtest"/>
+      </targetdef>
+      
+      <!-- Run the Test -->
+      <targetdef target="runtest">
+         <component/>
+         <source when="@{test}">
+            <mkdir dir="@{testDir}"/>
+            <junit fork="true"
+                   printSummary="true">
+               <formatter type="plain"/>
+               <classpath>
+                  <pathElements/>
+               </classpath>
+               <batchtest todir="@{testDir}">
+                  <fileset dir="@{sourceDir}" includes="@{test}"/>
+               </batchtest>
+            </junit>
+         </source>
+      </targetdef>
+   </targets>
+
+   <!-- MACROS -->
+
+   <!-- The execant macro -->
+   <macrodef name="execant">
+      <attribute name="dir"
+                 default="${basedir}"
+                 description="The directory"
+      />
+      <attribute name="target"
+                 description="The target"
+      />
+      <sequential>
+         <!-- Invoke using a new ant -->
+         <exec dir="@{dir}" 
+               executable="ant"
+         >
+            <arg line="@{target}"/>
+         </exec>
+      </sequential>
+   </macrodef>
+
+   <!-- The invoke macro -->
+   <macrodef name="invoke">
+      <attribute name="dir"
+                 default="${basedir}"
+                 description="The directory"
+      />
+      <attribute name="target"
+                 description="The target"
+      />
+      <sequential>
+         <!-- Invoke using a new ant -->
+         <ant dir="@{dir}" target="@{target}"/>
+      </sequential>
+   </macrodef>
+
+   <!-- TARGETS -->
+
+   <target name="rebuild" depends="synchronize" description="Synchronize then build">
+      <execant target="build"/>
+   </target>
+
+   <target name="rebuildall" depends="synchronize" description="Synchronize then build all">
+      <execant target="all"/>
+   </target>
+
+   <!-- After synchronization processing for the main build -->
+   <target name="synchronize.main.after">
+      <idemain/>
+   </target>
+
+   <!-- After synchronization processing for a component -->
+   <target name="synchronize.component.after">
+      <idecomponent/>
+   </target>
+
+   <target name="help">
+      <fail message="Do not execute this build fragment directly!"/>
+   </target>
+
+</project>


Property changes on: labs/jbossbuild/jbossbuild/trunk/src/resources/tasks.xml
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/ant.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/ant.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/apache-2.0.txt
===================================================================
--- labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/apache-2.0.txt	                        (rev 0)
+++ labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/apache-2.0.txt	2008-07-16 15:06:21 UTC (rev 21063)
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.


Property changes on: labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/apache-2.0.txt
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/junit.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossbuild/jbossbuild/trunk/thirdparty/ant/lib/junit.jar
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mime-type
   + application/octet-stream




More information about the jboss-svn-commits mailing list