avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject svn commit: rev 21614 - in avalon/trunk: . central/site central/site/src/xdocs/central/tools/magic central/site/src/xdocs/central/tools/magic/spells central/system central/system/setup central/system/themes runtime/main tools/magic tools/magic/etc/deliverables/properties tools/magic/src/main/org/apache/avalon/tools/model tools/magic/src/main/org/apache/avalon/tools/tasks
Date Wed, 23 Jun 2004 23:37:15 GMT
Author: mcconnell
Date: Wed Jun 23 16:37:14 2004
New Revision: 21614

Added:
   avalon/trunk/central/site/src/xdocs/central/tools/magic/installation.xml
      - copied, changed from rev 21591, avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/installation.xml
   avalon/trunk/tools/magic/etc/deliverables/properties/
   avalon/trunk/tools/magic/etc/deliverables/properties/magic.properties   (contents, props changed)
   avalon/trunk/tools/magic/setup.xml
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java
Removed:
   avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/installation.xml
   avalon/trunk/central/system/index.properties
   avalon/trunk/central/system/setup/
   avalon/trunk/central/system/themes/
   avalon/trunk/tools/magic/install.xml
Modified:
   avalon/trunk/build.properties
   avalon/trunk/build.xml
   avalon/trunk/central/site/build.xml
   avalon/trunk/central/site/src/xdocs/central/tools/magic/navigation.xml
   avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/index.xml
   avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/navigation.xml
   avalon/trunk/central/system/index.xml
   avalon/trunk/runtime/main/build.properties
   avalon/trunk/tools/magic/bootstrap.xml
   avalon/trunk/tools/magic/build.properties
   avalon/trunk/tools/magic/build.xml
   avalon/trunk/tools/magic/install.properties
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Repository.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/ContextualTask.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/HomeTask.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PrepareTask.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/XdocTask.java
Log:
multi-level commit - covers refactoring of magic to enable its operation ourtside of the avalon content, updated to the magic docs, and updates to the root avalon setup target

Modified: avalon/trunk/build.properties
==============================================================================
--- avalon/trunk/build.properties	(original)
+++ avalon/trunk/build.properties	Wed Jun 23 16:37:14 2004
@@ -1,4 +1,3 @@
-<<<<<<< .mine
 #=======================================================================
 #           __
 #          /  \    Apache
@@ -31,7 +30,7 @@
 #======================================================================
 
 
-# magic system home directory
+# local index home
 project.home = central/system
 
 # Cache directory into which build artifacts are registered.
@@ -44,5 +43,4 @@
 # A sequence of remote repositories used to resolve artifacts
 # requested as part of the build process.
 # project.hosts = ${dpml.net}/;${java.repo}/;${ibiblio.org}/maven/
-
 

Modified: avalon/trunk/build.xml
==============================================================================
--- avalon/trunk/build.xml	(original)
+++ avalon/trunk/build.xml	Wed Jun 23 16:37:14 2004
@@ -1,58 +1,42 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 
-<project name="runtime" default="default" basedir="." xmlns:x="antlib:org.apache.avalon.tools">
+<project name="runtime" default="install" basedir="." 
+  xmlns:x="antlib:org.apache.avalon.tools">
 
+  <available property="magic.available" classname="org.apache.avalon.tools.model.Home"/>
+
+  <property name="magic.dir" value="${basedir}/tools/magic"/>
   <property file="${basedir}/user.properties"/>
   <property file="${basedir}/build.properties"/>
-  <property name="system.dir" value="${basedir}/central/system"/>
-  <property name="reactor.path" value="${system.dir}/build/reactor.xml"/>
-
-  <target name="setup">
-    <ant dir="${system.dir}" antfile="setup/setup.xml"/>
-  </target>
-
-  <target name="verify">
-    <ant inheritall="false" dir="${system.dir}/setup" antfile="integrity.xml"/>
-  </target>
 
-  <target name="init" depends="verify">
-    <ant dir="." antfile="${reactor.path}" target="init"/>
-  </target>
+  <property name="reactor.xml" 
+    value="${magic.dir}/etc/deliverables/templates/reactor.xml"/>
 
-  <target name="clean" depends="verify">
-    <ant dir="." antfile="${reactor.path}" target="clean"/>
+  <target name="setup">
+    <ant dir="." antfile="${magic.dir}/setup.xml"/>
   </target>
 
   <target name="clean" depends="verify">
-    <ant dir="." antfile="${reactor.path}" target="clean"/>
-  </target>
-
-  <target name="prepare" depends="verify">
-    <ant dir="." antfile="${reactor.path}" target="prepare"/>
-  </target>
-
-  <target name="build" depends="verify">
-    <ant dir="." antfile="${reactor.path}" target="build"/>
-  </target>
-
-  <target name="package" depends="verify">
-    <ant dir="." antfile="${reactor.path}" target="package"/>
-  </target>
-
-  <target name="test" depends="verify">
-    <ant dir="." antfile="${reactor.path}" target="test"/>
-  </target>
-
-  <target name="site" depends="init">
-    <ant dir="." antfile="${reactor.path}" target="site"/>
+    <ant dir="." antfile="${reactor.xml}" target="clean"/>
   </target>
 
   <target name="install" depends="verify">
-    <ant dir="." antfile="${reactor.path}" target="install"/>
+    <ant dir="." antfile="${reactor.xml}" target="default"/>
   </target>
 
-  <target name="default" depends="verify">
-    <ant dir="." antfile="${reactor.path}" target="default"/>
+  <target name="verify" unless="magic.available">
+    <echo>
+#--------------------------------------------------------------------------------
+# Please invoke the bootstrap target in order to install prerequisite resources
+# and tools necessary to build avalon.
+#
+# $ ant setup
+#
+# Once the bootstrap resources have been build you can proceed with any of the 
+# classic build targets.
+#--------------------------------------------------------------------------------      
+    </echo>
+    <fail message="Bootstrap resources not present."/>
   </target>
 
 </project>

Modified: avalon/trunk/central/site/build.xml
==============================================================================
--- avalon/trunk/central/site/build.xml	(original)
+++ avalon/trunk/central/site/build.xml	Wed Jun 23 16:37:14 2004
@@ -4,6 +4,7 @@
     xmlns:x="antlib:org.apache.avalon.tools">
 
   <property file="build.properties"/>
+
   <import file="${project.home}/build/standard.xml"/>
 
   <target name="init" depends="standard.init">

Copied: avalon/trunk/central/site/src/xdocs/central/tools/magic/installation.xml (from rev 21591, avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/installation.xml)
==============================================================================
--- avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/installation.xml	(original)
+++ avalon/trunk/central/site/src/xdocs/central/tools/magic/installation.xml	Wed Jun 23 16:37:14 2004
@@ -13,8 +13,9 @@
 
         <p>
         Magic runs on top of Ant.  Before installing Magic
-        you need to build or <a href="http://ant.apache.org/bindownload.cgi">
-        download a binary installation of Ant</a> (version 1.6.1 or later).
+        you need to build or download a 
+        <a href="http://ant.apache.org/bindownload.cgi">
+        binary installation of Ant</a> (version 1.6.1 or later).
         </p>
 
       </subsection>
@@ -22,39 +23,36 @@
       <subsection name="Magic Setup">
 
         <p>
+        Using MAGIC_HOME ...
+        </p>
+
+        <p>
         Magic registers content in a common repository. If you want to 
-        share the repository with Merlin you should define the 
-        AVALON_HOME environment variable with a value pointing to a 
-        directory within which the repository will be created.  If 
-        undefined, the installation will create a private repository in 
-        central/system/.cache.
+        share the repository with Merlin or other repository enabled products
+        you should define the MAGIC_HOME environment variable with a value 
+        pointing to a directory within which the repository will be created.  If 
+        undefined, the installation will create the magic installation in 
+        ${user.home}/.magic.
         </p>
 
         <p>
-        From your the root avalon/truck checkout directory...
+        Download <a href="http://svn.apache.org/repos/asf/avalon/trunk/tools/magic/setup.xml">setup.xml</a> from Apache.
+        </p>
+
+        <p>
+        From within the directory that you downloaded setup.xml to ...
         </p>
 
 <source>
-$ ant setup
+$ ant -buildfile setup.xml
 </source>
 
         <p>
-        The above command invokes the ant file central/system/setup/setup.xml
+        The above command invokes the ant 
         which downloads the magic library and installs this under 
         ${user.home}/.ant/lib.  It also checks for the presence of Junit
         libraries and will download these if required.
         </p>
-
-      </subsection>
-
-      <subsection name="Building Avalon">
-
-        <p>
-        From your the root avalon/truck checkout directory...
-        </p>
-<source>
-$ ant
-</source>
 
       </subsection>
 

Modified: avalon/trunk/central/site/src/xdocs/central/tools/magic/navigation.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/central/tools/magic/navigation.xml	(original)
+++ avalon/trunk/central/site/src/xdocs/central/tools/magic/navigation.xml	Wed Jun 23 16:37:14 2004
@@ -23,6 +23,7 @@
 
  <body>
     <menu>
+      <item name="Installing" href="installation.html"/>
       <item name="Casting Spells" href="spells/index.html"/>
       <item name="System Model" href="model/index.html"/>
       <item name="Templates" href="templates/index.html"/>

Modified: avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/index.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/index.xml	(original)
+++ avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/index.xml	Wed Jun 23 16:37:14 2004
@@ -17,8 +17,8 @@
       <p>Using magic means faster and more reliable build processes.</p>
    
       <p>
-      This section contains information about <a href="installation.html">
-      installing magic</a>, setting up a project <a href="index-creation.html">
+      This section contains information setting up a project 
+      <a href="index-creation.html">
       index</a>, creating a build file, and <a href="my-first-spell.html">casting 
       your first spell</a>.  By the time you finish reading the material
       contained here you will be well on your way to passing your next

Modified: avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/navigation.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/navigation.xml	(original)
+++ avalon/trunk/central/site/src/xdocs/central/tools/magic/spells/navigation.xml	Wed Jun 23 16:37:14 2004
@@ -23,7 +23,6 @@
 
  <body>
     <menu>
-      <item name="Installing Magic" href="installation.html"/>
       <item name="Setting up an Index" href="index-creation.html"/>
       <item name="My First Spell" href="my-first-spell.html"/>
       <item name="Advanced Magic" href="advanced-magic.html"/>

Modified: avalon/trunk/central/system/index.xml
==============================================================================
--- avalon/trunk/central/system/index.xml	(original)
+++ avalon/trunk/central/system/index.xml	Wed Jun 23 16:37:14 2004
@@ -147,9 +147,9 @@
     </dependencies>
   </project>
 
-    <!--
-    Avalon Framework.
-    -->
+  <!--
+  Avalon Framework.
+  -->
 
   <project basedir="../../runtime/framework/api">
     <info>
@@ -183,9 +183,9 @@
     </dependencies>
   </project>
 
-    <!--
-    Avalon Utilities.
-    -->
+  <!--
+  Avalon Utilities.
+  -->
 
   <project basedir="../../runtime/util/configuration">
     <info>
@@ -272,9 +272,9 @@
     </dependencies>
   </project>
 
-    <!--
-    Avalon Meta.
-    -->
+  <!--
+  Avalon Meta.
+  -->
 
   <project basedir="../../runtime/meta/api">
     <info>
@@ -455,9 +455,9 @@
     </plugins>
   </project>
 
-    <!--
-    Avalon Repository.
-    -->
+  <!--
+  Avalon Repository.
+  -->
 
   <project basedir="../../runtime/repository/api">
     <info>
@@ -517,7 +517,7 @@
     </dependencies>
   </project>
 
-    <!-- TODO: update cli scripts to incorporate runtime classpath -->
+  <!-- TODO: update cli scripts to incorporate runtime classpath -->
   <project basedir="../../runtime/repository/cli">
     <info>
       <group>avalon/repository</group>
@@ -543,9 +543,9 @@
     </dependencies>
   </project>
 
-    <!--
-    Avalon Logging.
-    -->
+  <!--
+  Avalon Logging.
+  -->
 
   <project basedir="../../runtime/logging/api">
     <info>
@@ -672,9 +672,9 @@
     </dependencies>
   </project>
 
-    <!--
-    Avalon Composition.
-    -->
+  <!--
+  Avalon Composition.
+  -->
 
   <project basedir="../../runtime/composition/api">
     <info>
@@ -722,9 +722,9 @@
     </dependencies>
   </project>
 
-    <!--
-    Avalon Activation.
-    -->
+  <!--
+  Avalon Activation.
+  -->
 
   <project basedir="../../runtime/activation/api">
     <info>
@@ -758,9 +758,9 @@
     </dependencies>
   </project>
 
-    <!--
-    Avalon Merlin.
-    -->
+  <!--
+  Avalon Merlin.
+  -->
 
   <project basedir="../../runtime/merlin/api">
     <info>
@@ -866,6 +866,6 @@
       <name>avalon-tools-bootstrap</name>
     </info>
   </project>
-    -->
+  -->
 
 </system>

Modified: avalon/trunk/runtime/main/build.properties
==============================================================================
--- avalon/trunk/runtime/main/build.properties	(original)
+++ avalon/trunk/runtime/main/build.properties	Wed Jun 23 16:37:14 2004
@@ -1,3 +1,2 @@
 project.name = avalon-runtime
 project.home = ../../central/system
-project.javadoc.enabled = false
\ No newline at end of file

Modified: avalon/trunk/tools/magic/bootstrap.xml
==============================================================================
--- avalon/trunk/tools/magic/bootstrap.xml	(original)
+++ avalon/trunk/tools/magic/bootstrap.xml	Wed Jun 23 16:37:14 2004
@@ -1,6 +1,7 @@
 <project name="avalon-tools-magic" default="install" basedir="."> 
 
   <property file="build.properties"/>
+  <property name="project.name" value="avalon-tools-magic"/>
 
   <property name="src" value="src"/>
   <property name="src.main" value="main"/>

Modified: avalon/trunk/tools/magic/build.properties
==============================================================================
--- avalon/trunk/tools/magic/build.properties	(original)
+++ avalon/trunk/tools/magic/build.properties	Wed Jun 23 16:37:14 2004
@@ -1,3 +1,3 @@
-project.name = avalon-tools-magic
-project.home = ../../central/system
+#project.name = avalon-tools-magic
+#project.home = ../../central/system
 

Modified: avalon/trunk/tools/magic/build.xml
==============================================================================
--- avalon/trunk/tools/magic/build.xml	(original)
+++ avalon/trunk/tools/magic/build.xml	Wed Jun 23 16:37:14 2004
@@ -3,8 +3,9 @@
 <project name="avalon-tools-magic" default="install" basedir="." 
     xmlns:x="antlib:org.apache.avalon.tools">
 
-  <property file="build.properties"/>
-  <import file="${project.home}/build/standard.xml"/>
+  <x:home index="../../central/system"/>
+
+  <import file="${magic.templates}/standard.xml"/>
 
   <target name="package" depends="standard.package">
     <x:bar name="avalon-tools.bar"/>
@@ -20,6 +21,25 @@
     <mkdir dir="${user.home}/.ant/lib"/>
     <copy toDir="${user.home}/.ant/lib" 
        file="${basedir}/target/deliverables/jars/${project.name}.jar"/>
+  </target>
+
+  <target name="properties" depends="info">
+    <echo>
+magic properties
+----------------
+magic.system:    ${magic.home}
+magic.cache:     ${magic.cache}
+magic.docs:      ${magic.docs}
+magic.templates: ${magic.templates}
+
+project properties
+------------------
+project.key:     ${project.key}
+project.home:    ${project.home}
+project.index:   ${project.index}
+project.group:   ${project.group}
+project.name:    ${project.name}
+    </echo>
   </target>
 
 </project>

Added: avalon/trunk/tools/magic/etc/deliverables/properties/magic.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/etc/deliverables/properties/magic.properties	Wed Jun 23 16:37:14 2004
@@ -0,0 +1,21 @@
+
+#------------------------------------------------------------------
+# Proxy settings.
+#------------------------------------------------------------------
+# 
+# magic.proxy.host = 127.0.0.l
+# magic.proxy.port = 80
+# magic.proxy.user = username
+# magic.proxy.password = password
+
+
+#------------------------------------------------------------------
+# Remote hosts.
+#------------------------------------------------------------------
+
+dpml.net = http://www.dpml.net
+java.repo = http://www.apache.org/dist/java-repository
+ibiblio.org = http://www.ibiblio.org/maven
+magic.hosts = ${dpml.net};${java.repo};${ibiblio.org}
+
+

Modified: avalon/trunk/tools/magic/install.properties
==============================================================================
--- avalon/trunk/tools/magic/install.properties	(original)
+++ avalon/trunk/tools/magic/install.properties	Wed Jun 23 16:37:14 2004
@@ -1,10 +1,9 @@
 
-magic.install.host = http://www.dpml.net
-
-magic.bar = avalon-tools.bar
-magic.bar.dir = avalon/tools/bars
-magic.bar.path = ${magic.bar.dir}/${magic.bar}
-magic.bar.url = ${magic.install.host}/${magic.bar.path}
-
-junit.jar = junit-3.8.1.jar
-junit.jar.url = ${magic.install.host}/junit/jars/${junit.jar}
+# magic.install.host = http://www.dpml.net
+# magic.bar = avalon-tools.bar
+# magic.group = avalon/tools
+# magic.bar.dir = ${magic.group}/bars
+# magic.bar.path = ${magic.bar.dir}/${magic.bar}
+# magic.bar.url = ${magic.install.host}/${magic.bar.path}
+# magic.junit.jar = junit-3.8.1.jar
+# magic.junit.jar.url = ${magic.install.host}/junit/jars/${magic.junit.jar}

Added: avalon/trunk/tools/magic/setup.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/setup.xml	Wed Jun 23 16:37:14 2004
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="setup" default="setup" basedir=".">
+
+  <property file="install.properties"/>
+
+  <property name="magic.install.host" value="http://www.dpml.net"/>
+  <property name="magic.bar" value="avalon-tools.bar"/>
+  <property name="magic.group" value="avalon/tools"/>
+  <property name="magic.bar.dir" value="${magic.group}/bars"/>
+  <property name="magic.bar.path" value="${magic.bar.dir}/${magic.bar}"/>
+  <property name="magic.bar.url" value="${magic.install.host}/${magic.bar.path}"/>
+
+  <property name="magic.junit.jar" value="junit-3.8.1.jar"/>
+  <property name="magic.junit.jar.url" 
+     value="${magic.install.host}/junit/jars/${magic.junit.jar}"/>
+
+  <property environment="ENV"/>
+
+  <condition property="magic.env.declared" value="false">
+    <isset property="ENV.MAGIC_HOME"/>
+  </condition>
+
+  <available property="magic.junit.available" 
+    classname="junit.framework.TestCase"/> 
+
+  <target name="setup" 
+      depends="check-magic-home,declare-magic-home,create-magic-home,setup-junit">
+    <echo message="Setup complete."/>
+  </target>
+
+  <target name="declare-magic-home" if="magic.env.declared">
+    <property name="magic.home" value="${ENV.MAGIC_HOME}"/>
+  </target>
+
+  <target name="check-magic-home" unless="magic.env.declared">
+    <property name="magic.home" value="${user.home}/.magic"/>
+  </target>
+
+  <target name="create-magic-home" 
+      depends="setup-proxy,setup-antlib">
+
+    <echo message="Preparing magic system using ${magic.home}"/>
+    <echo message="Using home directory: ${magic.home}"/>
+    <mkdir dir="${magic.home}"/>
+
+    <!-- Create the artifact cache. -->
+    <property name="magic.home.main" value="${magic.home}/main"/>
+    <mkdir dir="${magic.home.main}"/>
+
+    <!-- Create the docs cache. -->
+    <property name="magic.home.docs" value="${magic.home}/docs"/>
+    <mkdir dir="${magic.home.docs}"/>
+
+    <!-- Create the magic group cache dir. -->
+    <property name="magic.bar.destination" 
+      value="${magic.home.main}/${magic.group}"/>
+    <mkdir dir="${magic.bar.destination}/bars"/>
+
+    <!-- Pull down the latest version of magic. -->
+    <get src="${magic.bar.url}" usetimestamp="true"
+      dest="${magic.bar.destination}/bars/${magic.bar}"/>
+
+    <!-- Unpack magic in the artifact cache. -->
+    <property name="magic.bar.file" 
+      value="${magic.bar.destination}/bars/${magic.bar}"/>
+    <unzip src="${magic.bar.file}" dest="${magic.bar.destination}">
+      <patternset>
+        <include name="**/*"/>
+        <exclude name="META-INF/**"/>
+        <exclude name="**/bars/**"/>
+      </patternset>
+    </unzip>
+
+    <!-- copy default magic properties to magic home -->
+    <copy todir="${magic.home}" 
+      file="${magic.bar.destination}/properties/magic.properties"/>
+
+    <!-- add magic templates -->
+    <mkdir dir="${magic.home}/templates"/>
+    <copy todir="${magic.home}/templates">
+      <fileset dir="${magic.bar.destination}/templates"/>
+    </copy>
+
+    <!-- add magic themes -->
+    <mkdir dir="${magic.home}/themes"/>
+    <copy todir="${magic.home}/themes">
+      <fileset dir="${magic.bar.destination}/themes"/>
+    </copy>
+
+  </target>
+
+  <condition property="magic.proxy.declared" value="false">
+    <isset property="magic.proxy.host"/>
+  </condition>
+
+  <target name="setup-proxy" if="magic.proxy.declared">
+     <setproxy 
+         proxyhost="${magic.proxy.host}"
+         proxyport="${magic.proxy.port}"
+	   proxyuser="${magic.proxy.user}"
+	   proxypassword="${magic.proxy.password}"/>
+  </target>
+
+  <available property="magic.junit.available" 
+    classname="junit.framework.TestCase"/>
+
+  <target name="setup-junit" depends="setup-antlib" 
+      unless="magic.junit.available">
+    <echo message="Resolving junit..."/>
+    <get src="${magic.junit.jar.url}" usetimestamp="true"
+      dest="${ant.lib}/${magic.junit.jar}"/>
+  </target>
+
+  <target name="setup-antlib">
+    <property name="ant.lib" value="${user.home}/.ant/lib"/>
+    <mkdir dir="${ant.lib}"/>
+  </target>
+
+</project>

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java	Wed Jun 23 16:37:14 2004
@@ -38,6 +38,9 @@
  */
 public class Context extends Task
 {
+    public static final String KEY = "project.context";
+    public static final String PROJECT_KEY = "project.key";
+
     public static final String TARGET = "target";
     public static final String BUILD = "build";
     public static final String TEMP = "temp";
@@ -48,7 +51,6 @@
     private static final String USER_PROPERTIES = "user.properties";
     private static final String BUILD_PROPERTIES = "build.properties";
 
-    public static final String KEY = "project.context";
 
     public static final String SRC_KEY = "project.src";
     public static final String SRC_VALUE = "src";
@@ -114,6 +116,10 @@
         final Project project = getProject();
         setupProperties( project );
 
+        m_key = resolveKey();
+
+        project.setNewProperty( PROJECT_KEY, getKey() );
+
         project.setNewProperty( SRC_KEY, SRC_VALUE );
         project.setNewProperty( SRC_MAIN_KEY, SRC_MAIN );
         project.setNewProperty( SRC_CONFIG_KEY, SRC_CONFIG );
@@ -136,24 +142,38 @@
         m_docs = setBuildPath( DOCS );
 
         project.addReference( KEY, this );
+
     }
 
     public String getKey()
     {
+        return m_key;
+    }
+
+    public String resolveKey()
+    {
         if( null != m_key )
         {
             return m_key;
         }
         else
         {
-            final String name = getProject().getProperty( "project.name" );
-            if( null != name )
+            final String key = getProject().getProperty( "project.key" );
+            if( null != key )
             {
-                return name;            
+                return key;            
             }
             else
             {
-                return getProject().getName();
+                final String name = getProject().getProperty( "project.name" );
+                if( null != name )
+                {
+                    return name;            
+                }
+                else
+                {
+                    return getProject().getName();
+                }
             }
         }
     }
@@ -327,6 +347,17 @@
         }
     }
 
+    public static String getCanonicalPath( final File file ) throws BuildException
+    {
+        try
+        {
+            return file.getCanonicalPath();
+        }
+        catch( IOException ioe )
+        {
+            throw new BuildException( ioe );
+        }
+    }
 
     public static String getSignature()
     {

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java	Wed Jun 23 16:37:14 2004
@@ -42,120 +42,61 @@
 
     public static final String KEY = "project.home";
     public static final String HOME_KEY = "project.home";
+    public static final String INDEX_KEY = "project.index";
+    public static final String MAGIC_HOME_KEY = "magic.home";
 
     public static final String HOSTS_KEY = "project.hosts";
-    public static final String MAIN_CACHE_KEY = "project.main.cache";
-    public static final String DOCS_CACHE_KEY = "project.docs.cache";
+    public static final String MAIN_CACHE_KEY = "magic.main.cache";
+    public static final String DOCS_CACHE_KEY = "magic.docs.cache";
+
 
     //-------------------------------------------------------------
-    // mutable state
+    // immutable state
     //-------------------------------------------------------------
 
-    private boolean m_init = false;
-
-    private Home m_home;
-    private Repository m_main;
-    private Repository m_docs;
-    private File m_system;
-    private File m_index;
-
+    private final File m_index;
     private final Hashtable m_resources = new Hashtable();
-    private BuildListener m_listener;
+    private final Magic m_system;
 
     //-------------------------------------------------------------
     // constructor
     //-------------------------------------------------------------
 
-    public Home( final Project project, final File system, final File index )
+    protected Home( final Project project, Magic system, File index )
     {
-        setProject( project );
         m_index = index;
-
         m_system = system;
-
-        try
-        {
-            final String path = getCachePath( project );
-            final String hostsPath = project.getProperty( HOSTS_KEY );
-            m_main = new Repository( project, m_system, path, hostsPath, this );
-
-            final String docs = getDocsCachePath( project );
-            m_docs = new Repository( project, m_system, docs, hostsPath, this );
-
-            //
-            // construct the repository, build the definition of the available 
-            // resources and projects used within the system and associate a build
-            // listener
-            //
-
-            buildList( m_index, false );
-        }
-        catch( Throwable e )
-        {
-            throw new BuildException( e );
-        }
-
-        log( "cache: " + m_main.getCacheDirectory(), Project.MSG_VERBOSE );
-        final String[] hosts = m_main.getHosts();
-        log( "Hosts: " + hosts.length, Project.MSG_VERBOSE );
-        for( int i=0; i<hosts.length; i++ )
-        {
-            log( "  host: " + hosts[i], Project.MSG_VERBOSE ); 
-        }
-    }
-
-    private String getCachePath( final Project project ) throws IOException
-    {
-        final String path = project.getProperty( MAIN_CACHE_KEY );
-        if( null != path ) return path;
-
-        final Property property = (Property) project.createTask( "property" );
-        property.setEnvironment( "env" );
-        property.init();
-        property.execute();
-
-        final String avalonHomePath = project.getProperty( "env.AVALON_HOME" );
-        if( null != avalonHomePath )
-        {
-            final File avalonHomeDirectory = new File( avalonHomePath );
-            final File cache = new File( avalonHomeDirectory, "repository" );
-            return cache.getCanonicalPath();
-        }
-        else
-        {
-            return ".cache";
-        }
-    }
-
-    private String getDocsCachePath( final Project project )
-    {
-        final String path = project.getProperty( DOCS_CACHE_KEY );
-        if( null != path ) return path;
-        return ".docs";
+        setProject( project );
+        buildList( index, false );
     }
 
     //-------------------------------------------------------------
     // implementation
     //-------------------------------------------------------------
 
-    public File getHomeDirectory()
+    public File getIndex()
     {
-        return m_system;
+        return m_index;
     }
 
     public long getIndexLastModified()
     {
-        return getIndexFile().lastModified();
+        return m_index.lastModified();
+    }
+
+    public boolean isaResourceKey( String key )
+    {
+        return ( null != m_resources.get( key ) );
     }
 
     public Repository getRepository()
     {
-        return m_main;
+        return m_system.getRepository();
     }
 
     public Repository getDocsRepository()
     {
-        return m_docs;
+        return m_system.getDocsRepository();
     }
 
     public Resource[] getResources()
@@ -256,7 +197,8 @@
         buildList( system, elements, remote );
     }
 
-    private void buildList( final File system, final Element[] children, final boolean remote )
+    private void buildList( 
+      final File system, final Element[] children, final boolean remote )
     {
         if( null == children ) return;
 
@@ -289,7 +231,8 @@
         }
     }
 
-    private Resource createResource( final Element element, final File system, final boolean remote )
+    private Resource createResource( 
+      final Element element, final File system, final boolean remote )
     {
         if( remote )
         {
@@ -307,41 +250,6 @@
           "resource".equals( tag ) 
           || "project".equals( tag )
           || "plugin".equals( tag ) );
-    }
-
-    private File getIndexFile()
-    {
-        if( null != m_index ) return m_index;
-
-        final String path = project.getProperty( KEY );
-        if( null != path )
-        {
-            final File index = Context.getFile( project.getBaseDir(), path );
-            if( index.exists() )
-            {
-                if( index.isDirectory() )
-                {
-                    return new File( index, "index.xml" );
-                }
-                else
-                {
-                    return index;
-                }
-            }
-            else
-            {
-                final String error = 
-                  "Property value 'project.home' references a non-existant file: "
-                  + index;
-                throw new BuildException( error );
-            }
-        }
-        else
-        {
-            final String error = 
-              "Cannot continue due to missing index attribute.";
-            throw new BuildException( error );
-        }
     }
 
     /*

Added: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java	Wed Jun 23 16:37:14 2004
@@ -0,0 +1,308 @@
+/* 
+ * Copyright 2004 Apache Software Foundation
+ * 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.
+ */
+
+package org.apache.avalon.tools.model;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Property;
+import org.apache.tools.ant.taskdefs.optional.net.SetProxy;
+import org.apache.tools.ant.types.DataType;
+import org.w3c.dom.Element;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+/**
+ *
+ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class Magic extends DataType
+{
+    //-------------------------------------------------------------
+    // static
+    //-------------------------------------------------------------
+
+    public static final String KEY = "magic.home";
+
+    public static final String HOSTS_KEY = "magic.hosts";
+    public static final String MAIN_CACHE_KEY = "magic.cache";
+    public static final String DOCS_CACHE_KEY = "magic.docs";
+    public static final String TEMPLATES_KEY = "magic.templates";
+
+    public static final String PROXY_HOST_KEY = "project.proxy.host";
+    public static final String PROXY_PORT_KEY = "project.proxy.port";
+    public static final String PROXY_USERNAME_KEY = "project.proxy.username";
+    public static final String PROXY_PASSWORD_KEY = "project.proxy.password";
+
+    private static Magic SYSTEM;
+    private static Repository MAIN;
+    private static Repository DOCS;
+
+    public static Magic getSystem( Project project )
+    {
+        if( null == SYSTEM )
+        {
+            SYSTEM = new Magic( project );
+        }
+
+        project.setProperty( 
+          KEY, SYSTEM.getSystemDirectory().toString() );
+
+        File main = SYSTEM.getRepository().getCacheDirectory();
+        project.setProperty( 
+          MAIN_CACHE_KEY, Context.getCanonicalPath( main ) );
+
+        File docs = SYSTEM.getRepository().getCacheDirectory();
+        project.setProperty( 
+          DOCS_CACHE_KEY, Context.getCanonicalPath( docs ) );
+
+        project.setProperty( 
+          TEMPLATES_KEY, getTemplatePath( main ) );
+        project.addReference( KEY, SYSTEM );
+        return SYSTEM;
+    }
+
+    private static String getTemplatePath( File cache )
+    {
+        File templates = new File( cache, "avalon/tools/templates" );
+        return Context.getCanonicalPath( templates ); 
+    }
+
+    //-------------------------------------------------------------
+    // mutable state
+    //-------------------------------------------------------------
+
+    private File m_system;
+    private Repository m_main;
+    private Repository m_docs;
+    private Map m_homes = new Hashtable();
+
+    //-------------------------------------------------------------
+    // constructor
+    //-------------------------------------------------------------
+
+    private Magic( final Project project )
+    {
+        setProject( project );
+
+        m_system = getSystemDirectory( project );
+
+        File user = new File( m_system, "user.properties" );
+        loadProperties( project, user );
+
+        File properties = new File( m_system, "magic.properties" );
+        loadProperties( project, properties );
+
+        final String hostsPath = project.getProperty( HOSTS_KEY );
+        final String[] hosts = getHostsSequence( hostsPath );
+
+        final File main = new File( m_system, "main" );
+        m_main = new Repository( project, main, hosts );
+
+        final File docs = new File( m_system, "docs" );
+        m_docs = new Repository( project, docs, hosts );
+
+        setupProxy( project );
+
+        project.log( "Hosts: " + hosts.length, Project.MSG_VERBOSE );
+        for( int i=0; i<hosts.length; i++ )
+        {
+            project.log( "  host: " + hosts[i], Project.MSG_VERBOSE ); 
+        }
+        project.log( 
+          "artifact cache: " + m_main.getCacheDirectory(), 
+          Project.MSG_VERBOSE );
+        project.log( 
+          "docs cache: " + m_docs.getCacheDirectory(), 
+          Project.MSG_VERBOSE );
+    }
+
+    //-------------------------------------------------------------
+    // public
+    //-------------------------------------------------------------
+
+    public File getSystemDirectory()
+    {
+        return m_system;
+    }
+
+    public Repository getRepository()
+    {
+        return m_main;
+    }
+
+    public Repository getDocsRepository()
+    {
+        return m_docs;
+    }
+
+    public Home getHome( Project project, String value )
+    {
+        File index = getIndexFile( project, value );
+        String path = Context.getCanonicalFile( index ).toString();
+        Home home = (Home) m_homes.get( path );
+        if( null == home ) 
+        {
+            project.log( 
+              "Creating home in project: " 
+              + project.getName() 
+              + " using index ["
+              + index
+              + "].", Project.MSG_VERBOSE );
+
+            home = new Home( project, this, index );
+        }
+        m_homes.put( path, home );
+        return home;
+    }
+
+    private File getIndexFile( Project project, String value )
+    {
+        File basedir = project.getBaseDir();
+        if( null != value )
+        {
+            File index = Context.getFile( basedir, value );
+            return resolve( index );
+        }
+
+        final String path = project.getProperty( Home.KEY );
+        if( null != path )
+        {
+            final File index = Context.getFile( basedir, path ) ;
+            return resolve( index );
+        }
+        else
+        {
+            final String error = 
+              "Cannot continue due to missing index attribute.";
+            throw new BuildException( error );
+        }
+    }
+
+    private File resolve( final File index )
+    {
+        if( index.exists() )
+        {
+            if( index.isDirectory() )
+            {
+                return resolve( new File( index, "index.xml" ) );
+            }
+            else
+            {
+                return index;
+            }
+        }
+        else
+        {
+            final FileNotFoundException e =
+              new FileNotFoundException( index.toString() );
+            throw new BuildException( e );
+        }
+    }
+
+    //-------------------------------------------------------------
+    // implementation
+    //-------------------------------------------------------------
+
+    private String[] getHostsSequence( final String path )
+    {
+        if( null == path )
+        {
+            return new String[0];
+        }
+        
+        final StringTokenizer tokenizer = new StringTokenizer( path, ";" );
+        final ArrayList list = new ArrayList();
+        while( tokenizer.hasMoreTokens() )
+        {
+            final String host = tokenizer.nextToken();
+            if( host.endsWith( "/" ) )
+            {
+                list.add( host );
+            }
+            else
+            {
+                list.add( host + "/" );
+            }
+        }
+        return (String[]) list.toArray( new String[0] );
+    }
+
+    private void setupProxy( final Project project )
+    {
+        final String host = project.getProperty( PROXY_HOST_KEY );
+        if(( null == host ) || "".equals( host ) )
+        {
+            return;
+        }
+        else
+        {
+            final int port = Integer.decode(
+              project.getProperty( PROXY_PORT_KEY ) ).intValue();
+            final String username =
+              project.getProperty( PROXY_USERNAME_KEY );
+            final String password =
+              project.getProperty( PROXY_PASSWORD_KEY );
+            final SetProxy proxy =
+              (SetProxy) project.createTask( "setproxy" );
+            proxy.init();
+            proxy.setProxyHost( host );
+            proxy.setProxyPort( port );
+            proxy.setProxyUser( username );
+            proxy.setProxyPassword( password );
+            proxy.execute();
+        }
+    }
+
+    private File getSystemDirectory( final Project project )
+    {
+        final Property property = (Property) project.createTask( "property" );
+        property.setEnvironment( "env" );
+        property.init();
+        property.execute();
+
+        final String systemPath = project.getProperty( "env.MAGIC_HOME" );
+        if( null != systemPath )
+        {
+            File system = new File( systemPath );
+            return Context.getCanonicalFile( system );
+        }
+        else
+        {
+            File user = new File( System.getProperty( "user.home" ) );
+            File system = new File( user, ".merlin" );
+            return Context.getCanonicalFile( system );
+        }
+    }
+
+    protected void loadProperties( 
+      final Project project, final File file ) throws BuildException
+    {
+        final Property props = (Property) project.createTask( "property" );
+        props.init();
+        props.setFile( file );
+        props.execute();
+    }
+}

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Repository.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Repository.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Repository.java	Wed Jun 23 16:37:14 2004
@@ -19,7 +19,6 @@
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.optional.net.SetProxy;
 
 import java.io.File;
 import java.io.IOException;
@@ -33,37 +32,18 @@
  */
 public class Repository 
 {
-    public final String PROJECT_PROXY_HOST_KEY = "project.proxy.host";
-    public final String PROJECT_PROXY_PORT_KEY = "project.proxy.port";
-    public final String PROJECT_PROXY_USERNAME_KEY = "project.proxy.username";
-    public final String PROJECT_PROXY_PASSWORD_KEY = "project.proxy.password";
-
-    private final Home m_home;
-    private final File m_root;
     private final File m_cache;
     private final String[] m_hosts;
 
     public Repository( 
-      final Project project, final File system, final String path, final String hosts, final Home home )
+      final Project project, final File cache, final String[] hosts )
     {
-        if( null == system ) 
-        {
-            throw new NullPointerException( "system" );
-        }
-        if( null == path ) 
+        if( null == cache ) 
         {
-            throw new NullPointerException( "path" );
+            throw new NullPointerException( "cache" );
         }
-        if( null == home ) 
-        {
-            throw new NullPointerException( "home" );
-        }
-        m_home = home;
-        m_root = system;
-        m_cache = getCanonicalFile( Context.getFile( system, path ) );
-        m_hosts = getHostsSequence( hosts );
-
-        setupProxy( project );
+        m_cache = cache;
+        m_hosts = hosts;
     }
 
     public File getCacheDirectory()
@@ -74,67 +54,5 @@
     public String[] getHosts()
     {
         return m_hosts;
-    }
-
-    private File getCanonicalFile( final File file ) throws BuildException
-    {
-        try
-        {
-            return file.getCanonicalFile();
-        }
-        catch( IOException ioe )
-        {
-            throw new BuildException( ioe );
-        }
-    }
-
-    private String[] getHostsSequence( final String path )
-    {
-        if( null == path )
-        {
-            return new String[0];
-        }
-        
-        final StringTokenizer tokenizer = new StringTokenizer( path, ";" );
-        final ArrayList list = new ArrayList();
-        while( tokenizer.hasMoreTokens() )
-        {
-            final String host = tokenizer.nextToken();
-            if( host.endsWith( "/" ) )
-            {
-                list.add( host );
-            }
-            else
-            {
-                list.add( host + "/" );
-            }
-        }
-        return (String[]) list.toArray( new String[0] );
-    }
-
-    private void setupProxy( final Project project )
-    {
-        final String host = project.getProperty( PROJECT_PROXY_HOST_KEY );
-        if(( null == host ) || "".equals( host ) )
-        {
-            return;
-        }
-        else
-        {
-            final int port = Integer.decode(
-              project.getProperty( PROJECT_PROXY_PORT_KEY ) ).intValue();
-            final String username =
-              project.getProperty( PROJECT_PROXY_USERNAME_KEY );
-            final String password =
-              project.getProperty( PROJECT_PROXY_PASSWORD_KEY );
-            final SetProxy proxy =
-              (SetProxy) project.createTask( "setproxy" );
-            proxy.init();
-            proxy.setProxyHost( host );
-            proxy.setProxyPort( port );
-            proxy.setProxyUser( username );
-            proxy.setProxyPassword( password );
-            proxy.execute();
-        }
     }
 }

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/ContextualTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/ContextualTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/ContextualTask.java	Wed Jun 23 16:37:14 2004
@@ -35,18 +35,14 @@
 public abstract class ContextualTask extends Task
 {
     private static final String USER_PROPERTIES = "user.properties";
-    private static final String BUILD_PROPERTIES = "build.properties";
+    private static final String PROJECT_PROPERTIES = "project.properties";
 
     private boolean m_init = false;
-    private Context m_context;
 
     public void init() throws BuildException 
     {
         if( !isInitialized() )
         {
-            final Project project = getProject();
-            setupProperties( project, project.getBaseDir() );
-            m_context = Context.getContext( project );
             m_init = true;
         }
     }
@@ -63,11 +59,19 @@
 
     public Context getContext()
     {
-        if( null == m_context )
+        final Context context = (Context) 
+          getProject().getReference( Context.KEY );
+
+        if( null == context )
+        {
+            final Project project = getProject();
+            setupProperties( project, project.getBaseDir() );
+            return Context.getContext( project );
+        }
+        else
         {
-            throw new IllegalStateException( "context" );
+            return context;
         }
-        return m_context;
     }
 
     public void mkDir( final File dir )
@@ -92,11 +96,12 @@
 
     private void setupBuildProperties( final Project project, final File dir )
     {
-        final File build = Context.getFile( dir, BUILD_PROPERTIES );
+        final File build = Context.getFile( dir, PROJECT_PROPERTIES );
         loadProperties( project, build );
     }
 
-    protected void loadProperties( final Project project, final File file ) throws BuildException
+    protected void loadProperties( 
+      final Project project, final File file ) throws BuildException
     {
         final Property props = (Property) project.createTask( "property" );
         props.init();

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/HomeTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/HomeTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/HomeTask.java	Wed Jun 23 16:37:14 2004
@@ -18,7 +18,10 @@
 package org.apache.avalon.tools.tasks;
 
 import org.apache.avalon.tools.model.Context;
+import org.apache.avalon.tools.model.Definition;
+import org.apache.avalon.tools.model.Info;
 import org.apache.avalon.tools.model.Home;
+import org.apache.avalon.tools.model.Magic;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 
@@ -33,123 +36,49 @@
  */
 public class HomeTask extends ContextualTask
 {
-    public static final String SYSTEM_KEY = "project.system";
-
-    private static final String CACHE_DIR_KEY = "project.home.cache.dir";
-    private static final String INDEX_PROPERTIES = "index.properties";
-
-    private static Home HOME;
-
     private String m_path;
 
-    private boolean m_executed = false;
-
     public void setIndex( final String path )
     {
-        if( null != HOME )
-        {
-            log( 
-              "Ignoring path - home is already initialized.", 
-              Project.MSG_VERBOSE );
-        }
-        else
-        {
-            m_path = path;
-        }
+        m_path = path;
     }
 
     public void execute()
     {
-        if( !m_executed )
-        {
-            final Project project = getProject();
-            final File index = getIndexFile();
-            final File system = getSystemHome( project, index );
-            setupProperties( project, system );
-            if( null == HOME )
-            {
-                log( "Building system definition." );
-                setupSystemProperties( project, system );
-                HOME = new Home( project, system, index );
-            }
-            project.addReference( Home.KEY, HOME );
-            
-            getProject().setNewProperty( 
-              CACHE_DIR_KEY, 
-              HOME.getRepository().getCacheDirectory().toString() );
+        final Project project = getProject();
 
-            m_executed = true;
-        }
-    }
+        if( null != getProject().getReference( Home.KEY ) ) return;
 
-    private File getSystemHome( final Project project, final File index )
-    {
-        final String system = project.getProperty( SYSTEM_KEY );
-        if(( null == system ) || "".equals( system ))
-        {
-            final File systemHome = index.getParentFile();
-            return systemHome;
-        }
-        else
-        {
-            final File anchor = project.getBaseDir();
-            return Context.getFile( anchor, system );
+        Magic system = Magic.getSystem( project );
+        Home home = system.getHome( project, m_path );
+        project.setProperty( Home.HOME_KEY, getHomePath( home ) );
+        project.setProperty( Home.INDEX_KEY, getIndexPath( home ) );
+        project.addReference( Home.KEY, home );
+
+        final String key = getKey();
+        if( home.isaResourceKey( key ) )
+        {
+            final Definition def = home.getDefinition( getKey() );
+            final Info info = def.getInfo();
+            final String name = info.getName();
+            project.setProperty( "project.name", name );
+            final String group = info.getGroup();
+            project.setProperty( "project.group", group );
+            final String version = info.getVersion();
+            if( null != version )
+            {
+                project.setProperty( "project.version", version );
+            }
         }
     }
 
-    private void setupSystemProperties( final Project project, final File dir )
-    {
-        final File build = Context.getFile( dir, INDEX_PROPERTIES );
-        loadProperties( project, build );
-    }
-
-    private File getIndexFile()
+    private String getHomePath( Home home )
     {
-        if( null != m_path )
-        {
-            final File index = Context.getFile( project.getBaseDir(), m_path );
-            return resolve( index );
-        }
-        else
-        {
-
-            //
-            // try to resolve using ${project.home}
-            //
-
-            final String path = getProject().getProperty( Home.KEY );
-            if( null != path )
-            {
-                final File root = Context.getFile( project.getBaseDir(), path );
-                return resolve( root );
-            }
-            else
-            {
-                final String error = 
-                  "Property value 'project.home' is not defined.";
-                throw new BuildException( error );
-            }
-        }
+        return home.getIndex().getParentFile().toString();
     }
 
-    private File resolve( final File index )
+    private String getIndexPath( Home home )
     {
-        if( index.exists() )
-        {
-            if( index.isDirectory() )
-            {
-                return resolve( new File( index, "index.xml" ) );
-            }
-            else
-            {
-                return index;
-            }
-        }
-        else
-        {
-            final FileNotFoundException e =
-              new FileNotFoundException( index.toString() );
-            throw new BuildException( e );
-        }
+        return home.getIndex().toString();
     }
 }

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PrepareTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PrepareTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PrepareTask.java	Wed Jun 23 16:37:14 2004
@@ -77,6 +77,7 @@
             log( "creating target directory" );
             mkDir( target );
         }
+
         final File src = getContext().getSrcDirectory();
         final File etc = getContext().getEtcDirectory();
         final File build = getContext().getBuildDirectory();
@@ -84,7 +85,6 @@
 
         if( src.exists() )
         {
-
             final String main = getSrcMain();
             final String config = getSrcConfig();
             final String test = getSrcTest();
@@ -154,8 +154,9 @@
         return Context.SRC_TEST;
     }
 
-
-    private void prepareMain( final File projectSrc, final File targetMain, final String source, final String path )
+    private void prepareMain( 
+       final File projectSrc, final File targetMain, final String source, 
+       final String path )
     {
         if( null == projectSrc ) throw new NullPointerException( "projectSrc" );
         if( null == targetMain ) throw new NullPointerException( "targetMain" );
@@ -172,7 +173,8 @@
 
             final File dest = new File( targetMain, path );
             mkDir( dest );
-            final String filters = getProject().getProperty( SRC_FILTERED_INCLUDES_KEY );
+            final String filters = 
+              getProject().getProperty( SRC_FILTERED_INCLUDES_KEY );
             copy( src, dest, true, filters, "" );
             copy( src, dest, false, "**/*.*", filters );
         }

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/XdocTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/XdocTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/XdocTask.java	Wed Jun 23 16:37:14 2004
@@ -108,8 +108,8 @@
 
     private File getThemesDirectory()
     {
-        final File home = getHome().getHomeDirectory();
-        return new File( home, "themes" );
+        final File cache = getHome().getRepository().getCacheDirectory();
+        return new File( cache, "avalon/tools/themes" );
     }
     
     private String getOutputFormat()

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


Mime
View raw message