avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject svn commit: rev 21087 - in avalon/trunk: central/system runtime/merlin/impl tools/project/src/main/org/apache/avalon/tools/event tools/project/src/main/org/apache/avalon/tools/home tools/project/src/main/org/apache/avalon/tools/project tools/project/src/main/org/apache/avalon/tools/project/builder tools/project/src/main/org/apache/avalon/tools/tasks tools/project/src/test
Date Fri, 11 Jun 2004 11:27:40 GMT
Author: mcconnell
Date: Fri Jun 11 04:27:39 2004
New Revision: 21087

Removed:
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/PluginRef.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/ProjectRef.java
Modified:
   avalon/trunk/central/system/index.xml
   avalon/trunk/runtime/merlin/impl/build.properties
   avalon/trunk/runtime/merlin/impl/build.xml
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/event/StandardListener.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/home/Home.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/home/Repository.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Definition.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Plugin.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Resource.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/ResourceRef.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/builder/XMLDefinitionBuilder.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/ArtifactTask.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/DeclareTask.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/FilterTask.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JarTask.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JavacTask.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/PluginTask.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/PrepareTask.java
   avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/ReactorTask.java
   avalon/trunk/tools/project/src/test/index.xml
Log:
Refactoring of the project model to improve the handling of scoped runtime dependencies.

Modified: avalon/trunk/central/system/index.xml
==============================================================================
--- avalon/trunk/central/system/index.xml	(original)
+++ avalon/trunk/central/system/index.xml	Fri Jun 11 04:27:39 2004
@@ -106,12 +106,10 @@
         <version>2.0.0</version>
       </info>
       <dependencies>
-        <resources>
-          <resourceref key="log4j" runtime="false"/>
-          <resourceref key="servletapi" runtime="false"/>
-          <resourceref key="mailapi" runtime="false"/>
-          <resourceref key="jms" runtime="false"/>
-        </resources>
+        <include key="log4j" runtime="false"/>
+        <include key="servletapi" runtime="false"/>
+        <include key="mailapi" runtime="false"/>
+        <include key="jms" runtime="false"/>
       </dependencies>
     </project>
 
@@ -126,9 +124,7 @@
         <version>4.2.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-logkit" runtime="false" test="false"/>
-        </projects>
+        <include key="avalon-logkit" runtime="false" test="false"/>
       </dependencies>
     </project>
 
@@ -139,9 +135,7 @@
         <version>4.2.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-api"/>
-        </projects>
+        <include key="avalon-framework-api"/>
       </dependencies>
     </project>
 
@@ -160,13 +154,11 @@
       <info>
         <group>avalon/util</group>
         <name>avalon-util-configuration</name>
-        <version>1.0-dev</version>
+        <version>1.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-api"/>
-          <projectref key="avalon-framework-impl"/>
-        </projects>
+        <include key="avalon-framework-api"/>
+        <include key="avalon-framework-impl"/>
       </dependencies>
     </project>
 
@@ -185,9 +177,7 @@
         <version>1.2.1</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-util-env"/>
-        </projects>
+        <include key="avalon-util-env"/>
       </dependencies>
     </project>
 
@@ -230,9 +220,7 @@
         <version>1.2.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-util-extension-api"/>
-        </projects>
+        <include key="avalon-util-extension-api"/>
       </dependencies>
     </project>
 
@@ -243,9 +231,7 @@
         <version>1.1.1</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-api"/>
-        </projects>
+        <include key="avalon-framework-api"/>
       </dependencies>
     </project>
 
@@ -260,10 +246,8 @@
         <version>1.4.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-api"/>
-          <projectref key="avalon-framework-impl" compile="false" test="true"/>
-        </projects>
+        <include key="avalon-framework-api"/>
+        <include key="avalon-framework-impl" compile="false" test="true" runtime="false"/>
       </dependencies>
     </project>
 
@@ -274,9 +258,7 @@
         <version>1.4.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-meta-api"/>
-        </projects>
+        <include key="avalon-meta-api"/>
       </dependencies>
     </project>
 
@@ -287,11 +269,9 @@
         <version>1.4.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-meta-spi"/>
-          <projectref key="avalon-util-i18n"/>
-          <projectref key="avalon-util-configuration"/>
-        </projects>
+        <include key="avalon-meta-spi"/>
+        <include key="avalon-util-i18n"/>
+        <include key="avalon-util-configuration"/>
       </dependencies>
     </project>
 
@@ -302,12 +282,8 @@
         <version>1.4.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-meta-impl"/>
-        </projects>
-        <resources>
-          <resourceref key="qdox"/>
-        </resources>
+        <include key="avalon-meta-impl"/>
+        <include key="qdox"/>
       </dependencies>
       <tasks>
         <taskdef name="meta" class="org.apache.avalon.meta.info.ant.MetaTask"/>
@@ -324,13 +300,11 @@
         <name>avalon-test-dynamics</name>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-impl"/>
-        </projects>
-        <plugins>
-          <pluginref key="avalon-meta-tools"/>
-        </plugins>
+        <include key="avalon-framework-impl"/>
       </dependencies>
+      <plugins>
+        <include key="avalon-meta-tools"/>
+      </plugins>
     </project>
 
     <project basedir="../../runtime/test/playground">
@@ -339,14 +313,12 @@
         <name>avalon-test-playground</name>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-impl"/>
-          <projectref key="avalon-util-lifecycle"/>
-        </projects>
-        <plugins>
-          <pluginref key="avalon-meta-tools"/>
-        </plugins>
+        <include key="avalon-framework-impl"/>
+        <include key="avalon-util-lifecycle"/>
       </dependencies>
+      <plugins>
+        <include key="avalon-meta-tools"/>
+      </plugins>
     </project>
 
     <project basedir="../../runtime/test/testa">
@@ -355,14 +327,12 @@
         <name>avalon-test-testa</name>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-api"/>
-          <projectref key="avalon-util-configuration"/>
-        </projects>
-        <plugins>
-          <pluginref key="avalon-meta-tools"/>
-        </plugins>
+        <include key="avalon-framework-api"/>
+        <include key="avalon-util-configuration"/>
       </dependencies>
+      <plugins>
+        <include key="avalon-meta-tools"/>
+      </plugins>
     </project>
 
     <project basedir="../../runtime/test/testb">
@@ -371,13 +341,11 @@
         <name>avalon-test-testb</name>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-api"/>
-        </projects>
-        <plugins>
-          <pluginref key="avalon-meta-tools"/>
-        </plugins>
+        <include key="avalon-framework-api"/>
       </dependencies>
+      <plugins>
+        <include key="avalon-meta-tools"/>
+      </plugins>
     </project>
 
     <project basedir="../../runtime/test/testc">
@@ -386,13 +354,11 @@
         <name>avalon-test-testc</name>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-api"/>
-        </projects>
-        <plugins>
-          <pluginref key="avalon-meta-tools"/>
-        </plugins>
+        <include key="avalon-framework-api"/>
       </dependencies>
+      <plugins>
+        <include key="avalon-meta-tools"/>
+      </plugins>
     </project>
 
     <project basedir="../../runtime/test/testd">
@@ -401,13 +367,11 @@
         <name>avalon-test-testd</name>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-api"/>
-        </projects>
-        <plugins>
-          <pluginref key="avalon-meta-tools"/>
-        </plugins>
+        <include key="avalon-framework-api"/>
       </dependencies>
+      <plugins>
+        <include key="avalon-meta-tools"/>
+      </plugins>
     </project>
 
     <project basedir="../../runtime/test/teste">
@@ -416,13 +380,11 @@
         <name>avalon-test-teste</name>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-api"/>
-        </projects>
-        <plugins>
-          <pluginref key="avalon-meta-tools"/>
-        </plugins>
+        <include key="avalon-framework-api"/>
       </dependencies>
+      <plugins>
+        <include key="avalon-meta-tools"/>
+      </plugins>
     </project>
 
     <project basedir="../../runtime/test/includes">
@@ -431,14 +393,12 @@
         <name>avalon-test-includes</name>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-test-playground" build="false" runtime="false"/>
-          <projectref key="avalon-test-testa" build="false" runtime="false"/>
-          <projectref key="avalon-test-testb" build="false" runtime="false"/>
-          <projectref key="avalon-test-testc" build="false" runtime="false"/>
-          <projectref key="avalon-test-testd" build="false" runtime="false"/>
-          <projectref key="avalon-test-teste" build="false" runtime="false"/>
-        </projects>
+        <include key="avalon-test-playground" build="false" runtime="false"/>
+        <include key="avalon-test-testa" build="false" runtime="false"/>
+        <include key="avalon-test-testb" build="false" runtime="false"/>
+        <include key="avalon-test-testc" build="false" runtime="false"/>
+        <include key="avalon-test-testd" build="false" runtime="false"/>
+        <include key="avalon-test-teste" build="false" runtime="false"/>
       </dependencies>
     </project>
 
@@ -448,13 +408,11 @@
         <name>avalon-test-components</name>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-framework-api"/>
-        </projects>
-        <plugins>
-          <pluginref key="avalon-meta-tools"/>
-        </plugins>
+        <include key="avalon-framework-api"/>
       </dependencies>
+      <plugins>
+        <include key="avalon-meta-tools"/>
+      </plugins>
     </project>
 
     <!--
@@ -476,9 +434,7 @@
         <version>2.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-repository-api"/>
-        </projects>
+        <include key="avalon-repository-api"/>
       </dependencies>
     </project>
 
@@ -489,9 +445,7 @@
         <version>2.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-repository-api"/>
-        </projects>
+        <include key="avalon-repository-api"/>
       </dependencies>
     </project>
 
@@ -502,9 +456,7 @@
         <version>2.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-repository-main" runtime="false"/>
-        </projects>
+        <include key="avalon-repository-main" runtime="false"/>
       </dependencies>
     </project>
 
@@ -515,15 +467,13 @@
         <version>2.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-repository-spi"/>
-          <projectref key="avalon-repository-util"/>
-          <projectref key="avalon-util-exception"/>
-          <projectref key="avalon-util-env"/>
-          <projectref key="avalon-util-i18n"/>
-          <projectref key="avalon-util-criteria"/>
-          <projectref key="avalon-util-defaults"/>
-        </projects>
+        <include key="avalon-repository-spi"/>
+        <include key="avalon-repository-util"/>
+        <include key="avalon-util-exception"/>
+        <include key="avalon-util-env"/>
+        <include key="avalon-util-i18n"/>
+        <include key="avalon-util-criteria"/>
+        <include key="avalon-util-defaults"/>
       </dependencies>
     </project>
 
@@ -535,12 +485,8 @@
         <version>2.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-repository-main"/>
-        </projects>
-        <resources>
-          <resourceref key="commons-cli"/>
-        </resources>
+        <include key="avalon-repository-main"/>
+        <include key="commons-cli"/>
       </dependencies>
     </project>
 
@@ -551,11 +497,9 @@
         <version>2.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-repository-impl" test="false"/>
-          <projectref key="avalon-repository-main"/>
-          <projectref key="avalon-framework-impl" test="true"/>
-        </projects>
+        <include key="avalon-repository-impl" test="false"/>
+        <include key="avalon-repository-main"/>
+        <include key="avalon-framework-impl" test="true"/>
       </dependencies>
     </project>
 
@@ -578,11 +522,9 @@
         <version>1.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-logging-api"/>
-          <projectref key="avalon-repository-spi"/>
-          <projectref key="avalon-framework-api"/>
-        </projects>
+        <include key="avalon-logging-api"/>
+        <include key="avalon-repository-spi"/>
+        <include key="avalon-framework-api"/>
       </dependencies>
     </project>
 
@@ -593,10 +535,8 @@
         <version>1.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-logging-spi"/>
-          <projectref key="avalon-repository-main" runtime="false"/>
-        </projects>
+        <include key="avalon-logging-spi"/>
+        <include key="avalon-repository-main" runtime="false"/>
       </dependencies>
     </project>
 
@@ -607,12 +547,8 @@
         <version>1.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-logging-impl" runtime="false"/>
-        </projects>
-        <resources>
-          <resourceref key="log4j"/>
-        </resources>
+        <include key="avalon-logging-impl" runtime="false"/>
+        <include key="log4j"/>
       </dependencies>
     </project>
 
@@ -623,10 +559,8 @@
         <version>1.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-logging-spi" runtime="false"/>
-          <projectref key="avalon-logkit"/>
-        </projects>
+        <include key="avalon-logging-spi" runtime="false"/>
+        <include key="avalon-logkit"/>
       </dependencies>
     </project>
 
@@ -637,11 +571,9 @@
         <version>1.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-logging-logkit-api"/>
-          <projectref key="avalon-logging-impl" runtime="false"/>
-          <projectref key="avalon-util-configuration"/>
-        </projects>
+        <include key="avalon-logging-logkit-api"/>
+        <include key="avalon-logging-impl" runtime="false"/>
+        <include key="avalon-util-configuration"/>
       </dependencies>
     </project>
 
@@ -652,10 +584,8 @@
         <version>1.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-logging-logkit-api" runtime="false"/>
-          <projectref key="avalon-repository-main" runtime="false"/>
-        </projects>
+        <include key="avalon-logging-logkit-api" runtime="false"/>
+        <include key="avalon-repository-main" runtime="false"/>
       </dependencies>
     </project>
 
@@ -666,10 +596,8 @@
         <version>1.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-logging-logkit-api" runtime="false"/>
-          <projectref key="avalon-repository-main" runtime="false"/>
-        </projects>
+        <include key="avalon-logging-logkit-api" runtime="false"/>
+        <include key="avalon-repository-main" runtime="false"/>
       </dependencies>
     </project>
 
@@ -680,10 +608,8 @@
         <version>1.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-logging-logkit-api" runtime="false"/>
-          <projectref key="avalon-repository-main" runtime="false"/>
-        </projects>
+        <include key="avalon-logging-logkit-api" runtime="false"/>
+        <include key="avalon-repository-main" runtime="false"/>
       </dependencies>
     </project>
 
@@ -694,17 +620,15 @@
         <version>1.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-logging-logkit-impl" test="false"/>
-          <projectref key="avalon-logging-log4j" test="false"/>
-          <projectref key="avalon-logging-logkit-syslog" test="false"/>
-          <projectref key="avalon-logging-logkit-socket" test="false"/>
-          <projectref key="avalon-logging-logkit-datagram" test="false"/>
-          <projectref key="avalon-repository-main"/>
-          <projectref key="avalon-logging-impl"/>
-          <projectref key="avalon-framework-impl"/>
-          <projectref key="avalon-repository-test" build="false" test="false" runtime="false"/>
-        </projects>
+        <include key="avalon-logging-logkit-impl" test="false"/>
+        <include key="avalon-logging-log4j" test="false"/>
+        <include key="avalon-logging-logkit-syslog" test="false"/>
+        <include key="avalon-logging-logkit-socket" test="false"/>
+        <include key="avalon-logging-logkit-datagram" test="false"/>
+        <include key="avalon-repository-main"/>
+        <include key="avalon-logging-impl"/>
+        <include key="avalon-framework-impl"/>
+        <include key="avalon-repository-test" build="false" test="false" runtime="false"/>
       </dependencies>
     </project>
 
@@ -719,12 +643,10 @@
         <version>2.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-util-extension-api"/>
-          <projectref key="avalon-repository-api"/>
-          <projectref key="avalon-logging-spi"/>
-          <projectref key="avalon-meta-api"/>
-        </projects>
+        <include key="avalon-util-extension-api"/>
+        <include key="avalon-repository-api"/>
+        <include key="avalon-logging-api"/>
+        <include key="avalon-meta-api"/>
       </dependencies>
     </project>
 
@@ -735,9 +657,8 @@
         <version>2.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-composition-api"/>
-        </projects>
+        <include key="avalon-composition-api"/>
+        <include key="avalon-logging-spi"/>
       </dependencies>
     </project>
 
@@ -745,21 +666,19 @@
       <info>
         <group>avalon/composition</group>
         <name>avalon-composition-impl</name>
-        <version>2.0.1-dev</version>
+        <version>2.0.1</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-composition-spi"/>
-          <projectref key="avalon-repository-main"/>
-          <projectref key="avalon-meta-impl"/>
-          <projectref key="avalon-util-configuration"/>
-          <projectref key="avalon-util-extension-impl"/>
-          <projectref key="avalon-util-lifecycle"/>
-          <projectref key="avalon-logging-impl" build="false" test="true"/>
-          <projectref key="avalon-test-dynamics" build="false" test="true" runtime="false"/>
-          <projectref key="avalon-test-includes" build="false" test="true" runtime="false"/>
-          <projectref key="avalon-logging-test" build="false" test="false" runtime="false"/>
-        </projects>
+        <include key="avalon-composition-spi"/>
+        <include key="avalon-repository-main"/>
+        <include key="avalon-meta-impl"/>
+        <include key="avalon-util-configuration"/>
+        <include key="avalon-util-extension-impl"/>
+        <include key="avalon-util-lifecycle"/>
+        <include key="avalon-logging-impl" build="false" test="true"/>
+        <include key="avalon-test-dynamics" build="false" test="true" runtime="false"/>
+        <include key="avalon-test-includes" build="false" test="true" runtime="false"/>
+        <include key="avalon-logging-test" build="false" test="false" runtime="false"/>
       </dependencies>
     </project>
 
@@ -774,9 +693,7 @@
         <version>2.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-composition-api"/>
-        </projects>
+        <include key="avalon-composition-api"/>
       </dependencies>
     </project>
 
@@ -787,17 +704,15 @@
         <version>2.0.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-util-lifecycle"/>
-          <projectref key="avalon-util-i18n"/>
-          <projectref key="avalon-util-defaults"/>
-          <projectref key="avalon-repository-spi"/>
-          <projectref key="avalon-composition-spi"/>
-          <projectref key="avalon-composition-impl" build="false" test="true" runtime="false"/>
-          <projectref key="avalon-activation-api"/>
-          <projectref key="avalon-test-components" build="false" test="true" runtime="false"/>
-          <projectref key="avalon-test-playground" build="false" test="true" runtime="false"/>
-        </projects>
+        <include key="avalon-util-lifecycle"/>
+        <include key="avalon-util-i18n"/>
+        <include key="avalon-util-defaults"/>
+        <include key="avalon-repository-spi"/>
+        <include key="avalon-composition-spi"/>
+        <include key="avalon-composition-impl" build="false" test="true" runtime="false"/>
+        <include key="avalon-activation-api"/>
+        <include key="avalon-test-components" build="false" test="true" runtime="false"/>
+        <include key="avalon-test-playground" build="false" test="true" runtime="false"/>
       </dependencies>
     </project>
 
@@ -812,9 +727,7 @@
         <version>3.3.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-composition-api"/>
-        </projects>
+        <include key="avalon-composition-api"/>
       </dependencies>
     </project>
 
@@ -825,12 +738,18 @@
         <version>3.3.0</version>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="avalon-merlin-api"/>
-          <projectref key="avalon-composition-impl"/>
-          <projectref key="avalon-repository-main"/>
-          <projectref key="avalon-util-configuration"/>
-        </projects>
+        <include key="avalon-framework-api" tag="api"/>
+        <include key="avalon-util-extension-api" tag="api"/>
+        <include key="avalon-merlin-api" tag="api"/>
+        <include key="avalon-repository-api" tag="api"/>
+        <include key="avalon-util-lifecycle" tag="api"/>
+        <include key="avalon-meta-spi" tag="spi"/>
+        <include key="avalon-repository-spi" tag="spi"/>
+        <include key="avalon-logging-spi" tag="spi"/>
+        <include key="avalon-composition-spi" tag="spi"/>
+        <include key="avalon-composition-impl" tag="impl"/>
+        <include key="avalon-util-configuration" tag="impl"/>
+        <include key="avalon-repository-main" runtime="false"/>
       </dependencies>
     </project>
 

Modified: avalon/trunk/runtime/merlin/impl/build.properties
==============================================================================
--- avalon/trunk/runtime/merlin/impl/build.properties	(original)
+++ avalon/trunk/runtime/merlin/impl/build.properties	Fri Jun 11 04:27:39 2004
@@ -1,3 +1,6 @@
+
 project.name = avalon-merlin-impl
 project.src.main = java
 project.home = ../../../central/system
+
+avalon.artifact.factory = org.apache.avalon.merlin.impl.DefaultFactory

Modified: avalon/trunk/runtime/merlin/impl/build.xml
==============================================================================
--- avalon/trunk/runtime/merlin/impl/build.xml	(original)
+++ avalon/trunk/runtime/merlin/impl/build.xml	Fri Jun 11 04:27:39 2004
@@ -8,7 +8,11 @@
 
   <target name="init" depends="standard.init">
     <x:filter key="avalon-logging-logkit-impl" feature="uri" 
-       token="AVALON-LOGGING-LOGKIT-SPEC"/>
+       token="LOGGING_IMPLEMENTATION"/>
+    <x:filter key="avalon-merlin-impl" feature="uri" 
+       token="MERLIN_IMPLEMENTATION"/>
+    <x:filter key="avalon-activation-impl" feature="uri" 
+       token="STANDARD_RUNTIME"/>
   </target>
 
   <target name="package" depends="standard.package">

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/event/StandardListener.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/event/StandardListener.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/event/StandardListener.java	Fri Jun 11 04:27:39 2004
@@ -30,7 +30,7 @@
 
 import org.apache.avalon.tools.home.Home;
 import org.apache.avalon.tools.project.Definition;
-import org.apache.avalon.tools.project.PluginRef;
+import org.apache.avalon.tools.project.ResourceRef;
 import org.apache.avalon.tools.project.Plugin;
 
 /**
@@ -74,16 +74,6 @@
         project.log( "project: " + getDefinition() );
         project.log( "basedir: " + project.getBaseDir() );
         project.log( BANNER );
-
-        /*
-        PluginRef[] refs = getDefinition().getPluginRefs();
-        for( int i=0; i<refs.length; i++ )
-        {
-            PluginRef ref = refs[i];
-            Plugin plugin = getHome().getPlugin( ref );
-            project.log( "plugin ref: " + plugin );
-        }
-        */
     }
 
     private Task getTask()

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/home/Home.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/home/Home.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/home/Home.java	Fri Jun 11 04:27:39 2004
@@ -49,10 +49,8 @@
 
 import org.apache.avalon.tools.event.StandardListener;
 import org.apache.avalon.tools.project.Definition;
-import org.apache.avalon.tools.project.ProjectRef;
 import org.apache.avalon.tools.project.ResourceRef;
 import org.apache.avalon.tools.project.Resource;
-import org.apache.avalon.tools.project.PluginRef;
 import org.apache.avalon.tools.project.Plugin;
 import org.apache.avalon.tools.project.builder.XMLDefinitionBuilder;
 import org.apache.avalon.tools.util.ElementHelper;
@@ -138,6 +136,11 @@
         return m_system;
     }
 
+    public long getIndexLastModified()
+    {
+        return getIndexFile().lastModified();
+    }
+
     public Repository getRepository()
     {
         return m_repository;
@@ -146,8 +149,13 @@
     public Resource[] getResources()
     {
         return (Resource[]) m_resources.values().toArray( new Resource[0] );
+    }
 
+    public boolean isaDefinition( ResourceRef ref )
+    {
+        return ( getResource( ref ) instanceof Definition );
     }
+
     public Definition[] getDefinitions()
       throws BuildException
     {
@@ -164,18 +172,6 @@
         return (Definition[]) list.toArray( new Definition[0] );
     }
 
-    public Plugin getPlugin( PluginRef ref )
-      throws BuildException
-    {
-        return (Plugin) getDefinition( ref );
-    }
-
-    public Definition getDefinition( ProjectRef ref )
-      throws BuildException
-    {
-        return getDefinition( ref.getKey() );
-    }
-
     public Resource getResource( ResourceRef ref )
       throws BuildException
     {
@@ -193,100 +189,46 @@
     public Definition getDefinition( String key )
       throws BuildException
     {
-        return getDefinition( key, true );
+        ResourceRef ref = new ResourceRef( key );
+        return getDefinition( ref );
     }
 
-    public Definition getDefinition( String key, boolean fail )
+    public Definition getDefinition( ResourceRef ref )
       throws BuildException
     {
-        Resource def = (Resource) m_resources.get( key );
-        if( null == def )
+        Resource resource = getResource( ref );
+        if( resource instanceof Definition )
         {
-            if( fail )
-            {
-                final String error = 
-                  "Unknown definition [" + key + "]";
-                throw new BuildException( error );
-            }
+            return (Definition) resource;
         }
         else
         {
-            if( def instanceof Definition )
-            {
-                return (Definition) def;
-            }
-            else
-            {
-                if( fail )
-                {
-                    final String error =
-                      "Key [" + key + "] is not project.";
-                    throw new BuildException( error );
-                }
-            }
+            final String error = 
+              "Reference [" + ref + "] does not refer to a projects.";
+            throw new BuildException( error );
         }
-        return null;
     }
 
-   /*
-    public void build( Definition definition )
-    {
-        Ant ant = (Ant) getProject().createTask( "ant" );
-        Property property = ant.createProperty();
-        property.setName( "urn:avalon.definition.key" );
-        property.setValue( definition.getKey() );
-        ant.setDir( definition.getBasedir() );
-        ant.setInheritRefs( true );
-        ant.init();
-        ant.execute();
-    }
-
-    public Definition[] getBuildSequence( Definition definition )
+    public Plugin getPlugin( ResourceRef ref )
+      throws BuildException
     {
-        ArrayList visited = new ArrayList();
-        ArrayList targets = new ArrayList();
-        ProjectRef[] refs = definition.getProjectRefs();
-        for( int i=0; i<refs.length; i++ )
+        Resource resource = getResource( ref );
+        if( resource instanceof Plugin )
         {
-            Definition def = getDefinition( refs[i] );
-            getBuildSequence( visited, targets, def );
+            return (Plugin) resource;
+        }
+        else
+        {
+            final String error = 
+              "Reference [" + ref + "] does not refer to a plugin.";
+            throw new BuildException( error );
         }
-        return (Definition[]) targets.toArray( new Definition[0] );
     }
-    */
 
     //-------------------------------------------------------------
     // internal
     //-------------------------------------------------------------
 
-    /*
-    private void getBuildSequence( List visited, List targets, Definition definition )
-    {
-        if( visited.contains( definition ) ) return;
-        visited.add( definition );
-
-        ProjectRef[] refs = definition.getProjectRefs();
-        for( int i=0; i<refs.length; i++ )
-        {
-            Definition def = getDefinition( refs[i] );
-            if( visited.contains( def ) )
-            {
-                final String error =
-                  "Recursive reference identified in project: " 
-                     + definition 
-                     + " in dependency " + def + ".";
-                throw new BuildException( error );
-            }
-            getBuildSequence( visited, targets, def );
-        }
-
-        if( !targets.contains( definition ) )
-        {
-            targets.add( definition );
-        }
-    }
-    */
-
     private void buildResourceList( Element resources )
     {
         if( null == resources ) return;
@@ -431,5 +373,59 @@
         props.execute();
     }
 
+   /*
+    public void build( Definition definition )
+    {
+        Ant ant = (Ant) getProject().createTask( "ant" );
+        Property property = ant.createProperty();
+        property.setName( "urn:avalon.definition.key" );
+        property.setValue( definition.getKey() );
+        ant.setDir( definition.getBasedir() );
+        ant.setInheritRefs( true );
+        ant.init();
+        ant.execute();
+    }
+
+    public Definition[] getBuildSequence( Definition definition )
+    {
+        ArrayList visited = new ArrayList();
+        ArrayList targets = new ArrayList();
+        ProjectRef[] refs = definition.getProjectRefs();
+        for( int i=0; i<refs.length; i++ )
+        {
+            Definition def = getDefinition( refs[i] );
+            getBuildSequence( visited, targets, def );
+        }
+        return (Definition[]) targets.toArray( new Definition[0] );
+    }
+    */
+
+    /*
+    private void getBuildSequence( List visited, List targets, Definition definition )
+    {
+        if( visited.contains( definition ) ) return;
+        visited.add( definition );
+
+        ProjectRef[] refs = definition.getProjectRefs();
+        for( int i=0; i<refs.length; i++ )
+        {
+            Definition def = getDefinition( refs[i] );
+            if( visited.contains( def ) )
+            {
+                final String error =
+                  "Recursive reference identified in project: " 
+                     + definition 
+                     + " in dependency " + def + ".";
+                throw new BuildException( error );
+            }
+            getBuildSequence( visited, targets, def );
+        }
+
+        if( !targets.contains( definition ) )
+        {
+            targets.add( definition );
+        }
+    }
+    */
 
 }

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/home/Repository.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/home/Repository.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/home/Repository.java	Fri Jun 11 04:27:39 2004
@@ -48,7 +48,6 @@
 import org.apache.avalon.tools.util.ElementHelper;
 import org.apache.avalon.tools.project.Definition;
 import org.apache.avalon.tools.project.ResourceRef;
-import org.apache.avalon.tools.project.ProjectRef;
 import org.apache.avalon.tools.project.Resource;
 import org.apache.avalon.tools.project.Policy;
 
@@ -93,6 +92,86 @@
         return m_hosts;
     }
 
+    private File getCanonicalFile( File file ) throws BuildException
+    {
+        try
+        {
+            return file.getCanonicalFile();
+        }
+        catch( IOException ioe )
+        {
+            throw new BuildException( ioe );
+        }
+    }
+
+    private String[] getHostsSequence( Element element )
+    {
+        if( null == element )
+        {
+            return new String[0];
+        }
+        
+        Element[] children = 
+          ElementHelper.getChildren( element, "host" );
+        String[] list = new String[ children.length ];
+        for( int i=0; i<children.length; i++ )
+        {
+            Element child = children[i];
+            list[i] = ElementHelper.getValue( child );
+        }
+        return list;
+    }
+
+    private String getCachePath( Element element )
+    {
+        if( null != element )
+        {
+            String path = element.getAttribute( "dir" );
+            if( null != path )
+            {
+                return path;
+            }
+        }
+
+        return ".cache";
+    }
+
+    /*
+    public ResourceRef[] getShortResourceRefs( Definition def, int mode, int category )
+    {
+        ArrayList list = new ArrayList();
+        getShortResourceRefs( def, list, mode, category );
+        return (ResourceRef[]) list.toArray( new ResourceRef[0] );
+    }
+
+    private void getShortResourceRefs( Definition def, List list, int mode, int category )
+    {
+        ResourceRef[] refs = def.getResourceRefs();
+System.out.println( "short: " + def + ", " + category + ", " + refs.length );
+        for( int i=0; i<refs.length; i++ )
+        {
+            ResourceRef ref = refs[i];
+            if( !list.contains( ref ) )
+            {
+                Policy policy = ref.getPolicy();
+                if( policy.matches( mode ) )
+                {
+System.out.println( "  candidate: " + ref + ", " + ref.matches( category ) );
+                    if( ref.matches( category ) )
+                    {
+                        list.add( ref );
+                        if( ref instanceof ProjectRef )
+                        {
+                            ProjectRef pr = (ProjectRef) ref;
+                            Definition d = m_home.getDefinition( pr );
+                            getShortResourceRefs( d, list, mode, ResourceRef.ANY );
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     public ResourceRef[] getResourceRefs( Definition def )
     {
         return getResourceRefs( def, Policy.ANY );
@@ -137,7 +216,9 @@
             }
         }
     }
+    */
 
+    /*
     public Path createPath( Project project, Definition def )
       throws BuildException
     {
@@ -176,7 +257,7 @@
                 Resource resource = m_home.getResource( ref );
                 try
                 {
-                    getResource( project, resource );
+                    resource.getArtifact( project );
                     FileList file = getResourceFileList( project, resource );
                     path.addFilelist( file );
                 }
@@ -187,6 +268,12 @@
                     buffer.append( ": " );
                     buffer.append( resource.getInfo() );
                 }
+                if( resource instanceof Definition )
+                {
+                    Defintion defintion = (Definition) resource;
+                    Path projectPath = createPath( project, defintion, false, policy );
+                    path.add( projectPath );
+                }
             }
         }
 
@@ -198,34 +285,6 @@
             throw new BuildException( error );
         }
 
-        //
-        // add each dependent project's path
-        //
-
-        ProjectRef[] projects = def.getProjectRefs();
-        for( int i=0; i<projects.length; i++ )
-        {
-            ProjectRef ref = projects[i];
-            if( ref.getPolicy().matches( policy ) )
-            {
-                Definition defintion = m_home.getDefinition( ref );
-                Path projectPath = createPath( project, defintion, true, policy );
-                File file = new File( getCacheDirectory(), defintion.getInfo().getPath() );
-                if( file.exists() )
-                {
-                    path.add( projectPath );
-                }
-                else
-                {
-                    final String error = 
-                      "Cannot construct a valid path for the project " 
-                      + def + " because the dependent project " 
-                      + defintion + " has not installed an artifact.";
-                    throw new BuildException( error );
-                }
-            }
-        }
-
         if( flag )
         {
             File file = new File( getCacheDirectory(), def.getInfo().getPath() );
@@ -257,6 +316,19 @@
         }
     }
 
+    private FileList getResourceFileList( Project project, Resource resource )
+      throws Exception
+    {
+        FileList list = new FileList();
+        list.setProject( project );
+        list.setDir( getCacheDirectory() );
+        String path = resource.getInfo().getPath();
+        list.setFiles( path );
+        return list;   
+    }
+    */
+
+   /*
     public File getResource( Project project, Resource resource )
       throws Exception
     {
@@ -303,59 +375,6 @@
 
         return target;
     }
+    */
 
-    private FileList getResourceFileList( Project project, Resource resource )
-      throws Exception
-    {
-        FileList list = new FileList();
-        list.setProject( project );
-        list.setDir( getCacheDirectory() );
-        String path = resource.getInfo().getPath();
-        list.setFiles( path );
-        return list;   
-    }
-
-    private File getCanonicalFile( File file ) throws BuildException
-    {
-        try
-        {
-            return file.getCanonicalFile();
-        }
-        catch( IOException ioe )
-        {
-            throw new BuildException( ioe );
-        }
-    }
-
-    private String[] getHostsSequence( Element element )
-    {
-        if( null == element )
-        {
-            return new String[0];
-        }
-        
-        Element[] children = 
-          ElementHelper.getChildren( element, "host" );
-        String[] list = new String[ children.length ];
-        for( int i=0; i<children.length; i++ )
-        {
-            Element child = children[i];
-            list[i] = ElementHelper.getValue( child );
-        }
-        return list;
-    }
-
-    private String getCachePath( Element element )
-    {
-        if( null != element )
-        {
-            String path = element.getAttribute( "dir" );
-            if( null != path )
-            {
-                return path;
-            }
-        }
-
-        return ".cache";
-    }
 }

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Definition.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Definition.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Definition.java	Fri Jun 11 04:27:39 2004
@@ -18,6 +18,14 @@
 package org.apache.avalon.tools.project;
 
 import java.io.File;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.FileSet;
+
+import org.apache.avalon.tools.home.Home;
 
 /**
  * Defintion of a project. 
@@ -27,19 +35,17 @@
  */
 public class Definition extends Resource
 {
-    private ProjectRef[] m_projects;
     private ResourceRef[] m_resources;
-    private PluginRef[] m_plugins;
+    private ResourceRef[] m_plugins;
     private File m_basedir;
 
     public Definition( 
-      String key, File basedir, Info info, 
-      ResourceRef[] resources, ProjectRef[] projects, PluginRef[] plugins )
+      Home home, String key, File basedir, Info info, 
+      ResourceRef[] resources, ResourceRef[] plugins )
     {
-        super( key, info );
+        super( home, key, info );
 
         m_basedir = basedir;
-        m_projects = projects;
         m_resources = resources;
         m_plugins = plugins;
     }
@@ -49,21 +55,67 @@
         return m_basedir;
     }
 
-    public ProjectRef[] getProjectRefs()
+    public ResourceRef[] getResourceRefs()
     {
-        return m_projects;
+        return m_resources;
     }
 
-    public ResourceRef[] getResourceRefs()
+    public ResourceRef[] getResourceRefs( int mode, int tag, boolean flag )
     {
-        return m_resources;
+        ArrayList list = new ArrayList();
+//System.out.println( "#THIS " + this + ", mode: " + mode + ", tag: " + tag );
+        getResourceRefs( list, mode, tag, flag );
+        return (ResourceRef[]) list.toArray( new ResourceRef[0] );
+    }
+
+    protected void getResourceRefs( List list, int mode, int tag, boolean flag )
+    {
+        ResourceRef[] refs = getResourceRefs();
+        for( int i=0; i<refs.length; i++ )
+        {
+            ResourceRef ref = refs[i];
+            if( !list.contains( ref ) )
+            {
+//System.out.println( "#REF: " + ref + ", " + ref.getPolicy().matches( mode ) + ", " + ref.matches( tag ) );
+                Policy policy = ref.getPolicy();
+                if( policy.matches( mode ) && ref.matches( tag ) )
+                {
+                    list.add( ref );
+                    if( flag && getHome().isaDefinition( ref ) )
+                    {
+                        Definition def = getHome().getDefinition( ref );
+                        def.getResourceRefs( list, mode, tag, flag );
+                    }
+                }
+            }
+        }
     }
 
-    public PluginRef[] getPluginRefs()
+    public ResourceRef[] getPluginRefs()
     {
         return m_plugins;
     }
 
+    public Path getPath( Project project, int mode )
+    {
+        if( null == project )
+        {
+            throw new NullPointerException( "project" );
+        }
+
+        Path path = new Path( project );
+        ResourceRef[] refs = getResourceRefs( mode, ResourceRef.ANY, true );
+        for( int i=0; i<refs.length; i++ )
+        {
+            ResourceRef ref = refs[i];
+            Resource resource = getHome().getResource( ref );
+            File file = resource.getArtifact( project );
+            path.createPathElement().setLocation( file );
+        }
+        
+        return path;
+    }
+
     public String toString()
     {
         return "[" + getInfo().getGroup() + "/" + getInfo().getName() + "]";
@@ -74,21 +126,15 @@
         if( super.equals( other ) && ( other instanceof Definition ))
         {
             Definition def = (Definition) other;
-            ProjectRef[] refs = getProjectRefs();
-            ProjectRef[] refs2 = def.getProjectRefs();
+            ResourceRef[] refs = getResourceRefs();
+            ResourceRef[] references = def.getResourceRefs();
             for( int i=0; i<refs.length; i++ )
             {
-                if( !refs[i].equals( refs2[i] ) ) return false;
+                if( !refs[i].equals( references[i] ) ) return false;
             }
 
-            ResourceRef[] resources = getResourceRefs();
-            ResourceRef[] resources2 = def.getResourceRefs();
-            for( int i=0; i<resources.length; i++ )
-            {
-                if( !resources[i].equals( resources2[i] ) ) return false;
-            }
-            PluginRef[] plugins = getPluginRefs();
-            PluginRef[] plugins2 = def.getPluginRefs();
+            ResourceRef[] plugins = getPluginRefs();
+            ResourceRef[] plugins2 = def.getPluginRefs();
             for( int i=0; i<plugins.length; i++ )
             {
                 if( !plugins[i].equals( plugins2[i] ) ) return false;

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Plugin.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Plugin.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Plugin.java	Fri Jun 11 04:27:39 2004
@@ -19,6 +19,8 @@
 
 import java.io.File;
 
+import org.apache.avalon.tools.home.Home;
+
 /**
  * Defintion of a project. 
  *
@@ -30,11 +32,11 @@
     private final TaskDef[] m_tasks;
 
     public Plugin(
-      String key, File basedir, Info info, 
-      ResourceRef[] resources, ProjectRef[] projects, PluginRef[] plugins, 
+      Home home, String key, File basedir, Info info, 
+      ResourceRef[] resources, ResourceRef[] plugins, 
       TaskDef[] tasks )
     {
-        super( key, basedir, info, resources, projects, plugins );
+        super( home, key, basedir, info, resources, plugins );
         m_tasks = tasks;
     }
 

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Resource.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Resource.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/Resource.java	Fri Jun 11 04:27:39 2004
@@ -18,9 +18,17 @@
 package org.apache.avalon.tools.project;
 
 import java.io.File;
+import java.io.FileNotFoundException;
+import java.net.URL;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Get;
+
+import org.apache.avalon.tools.home.Home;
 
 /**
- * Defintion of a project. 
+ * Defintion of a resource. 
  *
  * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
  * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
@@ -29,16 +37,18 @@
 {
     private String m_key;
     private Info m_info;
+    private Home m_home;
 
-    public Resource( Info info )
+    public Resource( Home home, Info info )
     {
-        this( null, info );
+        this( home, null, info );
     }
 
-    public Resource( String key, Info info )
+    public Resource( Home home, String key, Info info )
     {
         m_key = key;
         m_info = info;
+        m_home = home;
     }
 
     public String getKey()
@@ -49,6 +59,61 @@
     public Info getInfo()
     {
         return m_info;
+    }
+
+    protected Home getHome()
+    {
+        return m_home;
+    }
+
+    public File getArtifact( Project project )
+    {
+        //
+        // TODO: add support for snapshot semantics
+        // based on a resource feature
+        //
+
+        String path = getInfo().getPath();
+        File cache = getHome().getRepository().getCacheDirectory();
+        File target = new File( cache, path );
+        if( target.exists() ) 
+        {
+            return target;
+        }
+        else
+        {
+            return get( project, target, path );
+        }
+    }
+
+    private File get( Project project, File target, String path )
+    {
+        target.getParentFile().mkdirs();
+        String[] hosts = getHome().getRepository().getHosts();
+        for( int i=0; i<hosts.length; i++ )
+        {
+            String host = hosts[i];
+            try
+            {
+                URL url = new URL( host );
+                URL source = new URL( url, path );
+
+                Get get = (Get) project.createTask( "get" );
+                get.setSrc( source );
+                get.setDest( target );
+                get.setIgnoreErrors( false );
+                get.setUseTimestamp( true );
+                get.setVerbose( false );
+                get.execute();
+
+                return target;
+            }
+            catch( Throwable e )
+            {
+                // ignore
+            }
+        }
+        throw new BuildException( new FileNotFoundException( path ) );
     }
 
     public String toString()

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/ResourceRef.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/ResourceRef.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/ResourceRef.java	Fri Jun 11 04:27:39 2004
@@ -25,39 +25,53 @@
  */
 public class ResourceRef 
 {
+    public static final int ANY = -1;
+    public static final int API = 0;
+    public static final int SPI = 1;
+    public static final int IMPL = 2;
+
     private String m_key;
     private Policy m_policy;
-    private String m_tag;
+    private int m_tag;
 
-    public ResourceRef( String key )
+    public static int getCategory( String category )
     {
-        this( key, new Policy(), null );
-    }
-
-    public ResourceRef( String key, Policy policy, String tag )
-    {
-        m_key = key;
-        m_policy = policy;
-        if( null == tag )
+        if( "api".equals( category ) )
         {
-            m_tag = "impl";
+            return API;
         }
-        else if( "".equals( tag ) )
+        else if( "spi".equals( category ) )
         {
-            m_tag = "impl";
+            return SPI;
+        }
+        else if( "impl".equals( category ) )
+        {
+            return IMPL;
         }
         else
         {
-            m_tag = tag;
+            return ANY;
         }
     }
 
+    public ResourceRef( String key )
+    {
+        this( key, new Policy(), ANY );
+    }
+
+    public ResourceRef( String key, Policy policy, int tag )
+    {
+        m_key = key;
+        m_policy = policy;
+        m_tag = tag;
+    }
+
     public String getKey()
     {
         return m_key;
     }
 
-    public String getTag()
+    public int getTag()
     {
         return m_tag;
     }
@@ -65,6 +79,18 @@
     public Policy getPolicy()
     {
         return m_policy;
+    }
+
+    public boolean matches( int category )
+    {
+        if(( ANY == category ) || ( ANY == m_tag ))
+        {
+            return true;
+        }
+        else
+        {
+            return ( m_tag == category );
+        }
     }
 
     public boolean equals( Object other )

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/builder/XMLDefinitionBuilder.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/builder/XMLDefinitionBuilder.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/project/builder/XMLDefinitionBuilder.java	Fri Jun 11 04:27:39 2004
@@ -29,10 +29,10 @@
 import org.apache.avalon.tools.util.ElementHelper;
 import org.apache.avalon.tools.project.Info;
 import org.apache.avalon.tools.project.Definition;
-import org.apache.avalon.tools.project.ProjectRef;
+//import org.apache.avalon.tools.project.ProjectRef;
 import org.apache.avalon.tools.project.ResourceRef;
 import org.apache.avalon.tools.project.Resource;
-import org.apache.avalon.tools.project.PluginRef;
+//import org.apache.avalon.tools.project.PluginRef;
 import org.apache.avalon.tools.project.Plugin;
 import org.apache.avalon.tools.project.Plugin.TaskDef;
 import org.apache.avalon.tools.project.Policy;
@@ -53,7 +53,7 @@
         Info info = 
           createInfo( ElementHelper.getChild( element, "info" ) );
         String key = getDefinitionKey( element, info );
-        return new Resource( key, info );
+        return new Resource( home, key, info );
     }
 
     public static Definition createDefinition( Home home, Element element, File anchor )
@@ -65,30 +65,26 @@
 
         File basedir = getBasedir( anchor, element );
        
-        Element deps = ElementHelper.getChild( element, "dependencies" );
-
         ResourceRef[] resources = 
           createResourceRefs( 
-            ElementHelper.getChild( deps, "resources" ) );
+            ElementHelper.getChild( element, "dependencies" ) );
         
-        ProjectRef[] projects = 
-          createProjectRefs( 
-            ElementHelper.getChild( deps, "projects" ) );
-
-        PluginRef[] plugins = 
+        ResourceRef[] plugins = 
           createPluginRefs( 
-            ElementHelper.getChild( deps, "plugins" ) );
+            ElementHelper.getChild( element, "plugins" ) );
 
         final String tag = element.getTagName();
         if( tag.equals( "project" ) )
         {
-            return new Definition( key, basedir, info, resources, projects, plugins );
+            return new Definition( 
+              home, key, basedir, info, resources, plugins );
         }
         else if( tag.equals( "plugin" ) )
         {
             TaskDef[] tasks = 
               getTaskDefs( ElementHelper.getChild( element, "tasks" ) );
-            return new Plugin( key, basedir, info, resources, projects, plugins, tasks );
+            return new Plugin( 
+              home, key, basedir, info, resources, plugins, tasks );
         }
         else
         {
@@ -173,48 +169,31 @@
     private static ResourceRef[] createResourceRefs( Element element )
       throws BuildException
     {
-        Element[] children = ElementHelper.getChildren( element, "resourceref" );
+        Element[] children = ElementHelper.getChildren( element, "include" );
         ResourceRef[] refs = new ResourceRef[ children.length ];
-
         for( int i=0; i<children.length; i++ )
         {
             Element child = children[i];
             String key = child.getAttribute( "key" );
-            String tag = child.getAttribute( "tag" );
+            int tag = ResourceRef.getCategory( child.getAttribute( "tag" ) );
             Policy policy = createPolicy( child );
             refs[i] = new ResourceRef( key, policy, tag );
         }
         return refs;
     }
 
-    private static ProjectRef[] createProjectRefs( Element element )
-      throws BuildException
-    {
-        Element[] children = ElementHelper.getChildren( element, "projectref" );
-        ProjectRef[] refs = new ProjectRef[ children.length ];
-        for( int i=0; i<children.length; i++ )
-        {
-            Element child = children[i];
-            String key = child.getAttribute( "key" );
-            String tag = child.getAttribute( "tag" );
-            Policy policy = createPolicy( child );
-            refs[i] = new ProjectRef( key, policy, tag );
-        }
-        return refs;
-    }
-
-    private static PluginRef[] createPluginRefs( Element element )
+    private static ResourceRef[] createPluginRefs( Element element )
       throws BuildException
     {
-        Element[] children = ElementHelper.getChildren( element, "pluginref" );
-        PluginRef[] refs = new PluginRef[ children.length ];
+        Element[] children = ElementHelper.getChildren( element, "include" );
+        ResourceRef[] refs = new ResourceRef[ children.length ];
         for( int i=0; i<children.length; i++ )
         {
             Element child = children[i];
             String key = child.getAttribute( "key" );
-            String tag = child.getAttribute( "tag" );
+            int tag = ResourceRef.getCategory( child.getAttribute( "tag" ) );
             Policy policy = createPolicy( child, false, false, false );
-            refs[i] = new PluginRef( key, policy, tag );
+            refs[i] = new ResourceRef( key, policy, tag );
         }
         return refs;
     }

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/ArtifactTask.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/ArtifactTask.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/ArtifactTask.java	Fri Jun 11 04:27:39 2004
@@ -28,6 +28,7 @@
 import java.util.Date;
 import java.util.SimpleTimeZone;
 import java.util.TimeZone;
+import java.util.List;
 
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.Project;
@@ -60,7 +61,8 @@
     public void execute() throws BuildException 
     {
         String key = getContext().getKey();
-        Definition def = getHome().getDefinition( key );
+        ResourceRef ref = new ResourceRef( key );
+        Definition def = getHome().getDefinition( ref );
         File artifact = getArtifactFile( def );
 
         m_factory = getProject().getProperty( FACTORY_KEY );
@@ -80,20 +82,24 @@
 
         if( file.exists() )
         {
+            //
+            // TODO : check if the index.xml was modified
+            //
+
             if( file.lastModified() > artifact.lastModified() )
             {
-                return;
+                if( getHome().getIndexLastModified() < file.lastModified() )
+                {
+                    return;
+                }
             }
         }
 
         try
         {
-
             log( "Creating meta directive" );
-
             file.createNewFile();
             final OutputStream output = new FileOutputStream( file );
-
             try
             {
                 writeMetaDescriptor( output, def, artifact );
@@ -206,8 +212,8 @@
     private void writeClasspath( final Writer writer, final Definition def )
         throws IOException
     {
-        ResourceRef[] refs = getRuntimeRefs( def );
-        ResourceRef[] apis = getRefs( refs, "api" );
+        ArrayList visited = new ArrayList();
+        ResourceRef[] apis = getQualifiedRefs( def, visited, ResourceRef.API );
         if( apis.length > 0 )
         {
             writer.write( "\n" );
@@ -217,7 +223,7 @@
             String lead = "avalon.artifact.dependency.api";
             writeRefs( writer, apis, lead );
         }
-        ResourceRef[] spis = getRefs( refs, "spi" );
+        ResourceRef[] spis = getQualifiedRefs( def, visited, ResourceRef.SPI );
         if( spis.length > 0 )
         {
             writer.write( "\n" );
@@ -228,7 +234,7 @@
             writeRefs( writer, spis, lead );
         }
 
-        ResourceRef[] impl = getRefs( refs, "impl" );
+        ResourceRef[] impl = getQualifiedRefs( def, visited, ResourceRef.IMPL );
         if( impl.length > 0 )
         {
             writer.write( "\n" );
@@ -240,33 +246,17 @@
         }
     }
 
-    private ResourceRef[] getRuntimeRefs( final Definition def )
-    {
-        ArrayList list = new ArrayList();
-        ResourceRef[] resources = 
-          getHome().getRepository().getResourceRefs( def, Policy.RUNTIME );
-        for( int i=0; i<resources.length; i++ )
-        {
-            ResourceRef ref = resources[i];
-            Policy policy = ref.getPolicy();
-            if( policy.isRuntimeEnabled() )
-            {
-                list.add( ref );
-            }
-        }
-        return (ResourceRef[]) list.toArray( new ResourceRef[0] );
-    }
-
-    private ResourceRef[] getRefs( final ResourceRef[] refs, String category )
+    private ResourceRef[] getQualifiedRefs( final Definition def, final List visited, int category )
     {
         ArrayList list = new ArrayList();
+        ResourceRef[] refs = def.getResourceRefs( Policy.RUNTIME, category, true );
         for( int i=0; i<refs.length; i++ )
         {
             ResourceRef ref = refs[i];
-            String tag = ref.getTag();
-            if( category.equals( tag ) )
+            if( !visited.contains(  ref ) )
             {
                 list.add( ref );
+                visited.add( ref );
             }
         }
         return (ResourceRef[]) list.toArray( new ResourceRef[0] );

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/DeclareTask.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/DeclareTask.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/DeclareTask.java	Fri Jun 11 04:27:39 2004
@@ -179,7 +179,10 @@
     {
         writer.write( "\n  <classpath>" );
         final String pad = "    ";
-        ResourceRef[] resources = getHome().getRepository().getResourceRefs( def );
+        ResourceRef[] resources = 
+          def.getResourceRefs( Policy.RUNTIME, ResourceRef.ANY, true );
+
+        //  getHome().getRepository().getResourceRefs( def );
         writeResourceRefs( writer, pad, resources );
         writeResource( writer, pad, def );
         writer.write( "\n  </classpath>" );

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/FilterTask.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/FilterTask.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/FilterTask.java	Fri Jun 11 04:27:39 2004
@@ -35,8 +35,6 @@
 import org.apache.avalon.tools.project.Resource;
 import org.apache.avalon.tools.project.Definition;
 import org.apache.avalon.tools.project.ResourceRef;
-import org.apache.avalon.tools.project.ProjectRef;
-import org.apache.avalon.tools.project.PluginRef;
 
 /**
  * Build a set of projects taking into account dependencies within the 

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java	Fri Jun 11 04:27:39 2004
@@ -110,8 +110,10 @@
             File classes = new File( m_test, "classes" );
             mkDir( classes );
             Definition definition = getHome().getDefinition( getKey() );
-            Path classpath = 
-              getHome().getRepository().createPath( project, definition, Policy.TEST );
+            Path classpath = definition.getPath( project, Policy.TEST );
+
+            //Path classpath = 
+            //  getHome().getRepository().createPath( project, definition, Policy.TEST );
 
             //
             // add the project jar to the classpath for the compilation

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JarTask.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JarTask.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JarTask.java	Fri Jun 11 04:27:39 2004
@@ -35,6 +35,7 @@
 import org.apache.avalon.tools.home.Context;
 import org.apache.avalon.tools.home.Home;
 import org.apache.avalon.tools.project.Definition;
+import org.apache.avalon.tools.project.ResourceRef;
 
 /**
  * Load a goal. 

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JavacTask.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JavacTask.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/JavacTask.java	Fri Jun 11 04:27:39 2004
@@ -33,6 +33,7 @@
 import org.apache.avalon.tools.home.Home;
 import org.apache.avalon.tools.project.Definition;
 import org.apache.avalon.tools.project.Policy;
+import org.apache.avalon.tools.project.ResourceRef;
 
 /**
  * Compile sources.
@@ -77,9 +78,10 @@
             File classes = getContext().getBuildPath( BUILD_CLASSES_KEY );
             mkDir( classes );
 
-            Path classpath = 
-              getHome().getRepository().createPath( 
-                getProject(), getHome().getDefinition( getKey() ), Policy.BUILD );
+            ResourceRef ref = new ResourceRef( getKey() );
+            Definition definition = getHome().getDefinition( ref );
+            Path classpath = definition.getPath( project, Policy.BUILD );
+
             compile( main, classes, classpath );
 
             Copy copy = (Copy) getProject().createTask( "copy" );

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/PluginTask.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/PluginTask.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/PluginTask.java	Fri Jun 11 04:27:39 2004
@@ -84,14 +84,16 @@
 
             Info info = Info.create( id );
             Project project = getProject();
-            Resource resource = new Resource( info );
-            File file = getHome().getRepository().getResource( project, resource );
+            Resource resource = new Resource( getHome(), info );
+            File file = resource.getArtifact( project );
+
+            //File file = getHome().getRepository().getResource( project, resource );
 
             //
             // create a utility data object from the defintion
             //
 
-            AntLibData data = new AntLibData( getProject(), file );
+            AntLibData data = new AntLibData( getHome(), getProject(), file );
 
             AntClassLoader classloader = project.createClassLoader( data.getPath() );
             String spec = data.getInfo().getSpec();
@@ -126,7 +128,7 @@
         private final Path m_path = new Path( project );
         private final TaskDef[] m_tasks;
 
-        public AntLibData( Project project, File file ) throws Exception
+        public AntLibData( Home home, Project project, File file ) throws Exception
         {
             Element root = ElementHelper.getRootElement( file );
             Element infoElement = ElementHelper.getChild( root, "info" );
@@ -142,9 +144,10 @@
                 String type = child.getTagName();
                 String value = ElementHelper.getValue( child );
                 Info info = Info.create( type, value );
-                Resource resource = new Resource( info );
-                File jar = 
-                  getHome().getRepository().getResource( project, resource );
+                Resource resource = new Resource( home, info );
+                File jar = resource.getArtifact( project );
+                //File jar = 
+                //  getHome().getRepository().getResource( project, resource );
                 m_path.createPathElement().setLocation( jar );
             }
         }

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/PrepareTask.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/PrepareTask.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/PrepareTask.java	Fri Jun 11 04:27:39 2004
@@ -32,7 +32,7 @@
 
 import org.apache.avalon.tools.home.Context;
 import org.apache.avalon.tools.project.Definition;
-import org.apache.avalon.tools.project.PluginRef;
+import org.apache.avalon.tools.project.ResourceRef;
 import org.apache.avalon.tools.project.Plugin;
 
 /**
@@ -77,10 +77,10 @@
 
         String key = getContext().getKey();
         Definition def = getHome().getDefinition( key );
-        PluginRef[] refs = def.getPluginRefs();
+        ResourceRef[] refs = def.getPluginRefs();
         for( int i=0; i<refs.length; i++ )
         {
-            PluginRef ref = refs[i];
+            ResourceRef ref = refs[i];
             Plugin plugin = getHome().getPlugin( ref );
             String path = "plugin:" + plugin.getInfo().getSpec();
             PluginTask task = new PluginTask();

Modified: avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/ReactorTask.java
==============================================================================
--- avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/ReactorTask.java	(original)
+++ avalon/trunk/tools/project/src/main/org/apache/avalon/tools/tasks/ReactorTask.java	Fri Jun 11 04:27:39 2004
@@ -42,9 +42,9 @@
 
 import org.apache.avalon.tools.home.Context;
 import org.apache.avalon.tools.home.Home;
+import org.apache.avalon.tools.project.Plugin;
 import org.apache.avalon.tools.project.Definition;
-import org.apache.avalon.tools.project.ProjectRef;
-import org.apache.avalon.tools.project.PluginRef;
+import org.apache.avalon.tools.project.ResourceRef;
 
 /**
  * Build a set of projects taking into account dependencies within the 
@@ -98,16 +98,9 @@
     public void execute() throws BuildException 
     {
         final Project project = getProject();
-        log( "Finding project defintions." );
-        long now = System.currentTimeMillis();
+        log( "Preparing build sequence." );
         m_defs = getDefinitions();
-        long discovery = System.currentTimeMillis() - now;
-
-        log( "Discovery took: (" + discovery + " msecs.)" );
-        log( "Build sequence for projects." );
         final Definition[] defs = walkGraph();
-        long graph = System.currentTimeMillis() - discovery - now;
-        log( "Sequence established: (" + graph + " msecs.)" );
         project.log( BANNER );
         for( int i=0; i<defs.length; i++ )
         {
@@ -190,24 +183,34 @@
     private Definition[] getProviders( final Definition def )
     {
         final ArrayList list = new ArrayList();
-        final ProjectRef[] refs = def.getProjectRefs();
+        final ResourceRef[] refs = def.getResourceRefs();
         for( int i=0; i<refs.length; i++ )
         {
-            final Definition d = getHome().getDefinition( refs[i] );
-            if( m_defs.contains( d ) )
+            ResourceRef ref = refs[i];
+            if( getHome().isaDefinition( ref ) )
             {
-                list.add( d );
+                final Definition d = getHome().getDefinition( ref );
+                if( m_defs.contains( d ) )
+                {
+                    list.add( d );
+                }
             }
         }
-        final PluginRef[] prefs = def.getPluginRefs();
-        for( int i=0; i<prefs.length; i++ )
+
+        final ResourceRef[] plugins = def.getPluginRefs();
+        for( int i=0; i<plugins.length; i++ )
         {
-            final Definition d = getHome().getPlugin( prefs[i] );
-            if( m_defs.contains( d ) )
+            ResourceRef ref = plugins[i];
+            if( getHome().isaDefinition( ref ) )
             {
-                list.add( d );
+                final Definition plugin = getHome().getPlugin( ref );
+                if( m_defs.contains( plugin ) )
+                {
+                    list.add( plugin );
+                }
             }
         }
+
         return (Definition[]) list.toArray( new Definition[0] );
     }
 
@@ -265,7 +268,8 @@
                 final String key = getProjectName( dir );
                 if( null != key )
                 {
-                    list.add( getHome().getDefinition( key ) );
+                    ResourceRef ref = new ResourceRef( key );
+                    list.add( getHome().getDefinition( ref ) );
                 }
                 else
                 {

Modified: avalon/trunk/tools/project/src/test/index.xml
==============================================================================
--- avalon/trunk/tools/project/src/test/index.xml	(original)
+++ avalon/trunk/tools/project/src/test/index.xml	Fri Jun 11 04:27:39 2004
@@ -63,10 +63,10 @@
         <type>jar</type>
       </info>
       <dependencies>
-        <plugins>
-          <pluginref key="demo"/>
-        </plugins>
       </dependencies>
+      <plugins>
+        <include key="demo"/>
+      </plugins>
     </project>
 
     <plugin basedir="projects/demo">
@@ -80,13 +80,9 @@
         <taskdef name="hello" class="org.apache.avalon.demo.StandardDemo"/>
       </tasks>
       <dependencies>
-        <resources>
-          <resourceref key="avalon-framework-api"/>
-        </resources>
-        <projects>
-          <projectref key="widget"/>
-          <projectref key="gizmo"/>
-        </projects>
+        <include key="avalon-framework-api" tag="api"/>
+        <include key="avalon-framework-impl"/>
+        <include key="widget" tag="spi"/>
       </dependencies>
     </plugin>
 
@@ -98,9 +94,7 @@
         <type>jar</type>
       </info>
       <dependencies>
-        <projects>
-          <projectref key="gizmo"/>
-        </projects>
+        <include key="gizmo"/>
       </dependencies>
     </project>
 
@@ -112,9 +106,7 @@
         <type>jar</type>
       </info>
       <dependencies>
-        <resources>
-          <resourceref key="avalon-util-i18n"/>
-        </resources>
+        <include key="avalon-util-i18n"/>
       </dependencies>
     </project>
 

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message