svn commit: rev 21368 - in avalon/trunk: central/system runtime/merlin/cli/etc/test runtime/merlin/cli/src/test/org/apache/avalon/merlin/cli/test runtime/merlin/impl runtime/test/playground runtime/test/playground/etc runtime/test/playground/etc/deliverables runtime/test/playground/etc/deliverables/blocks runtime/test/playground/etc/main runtime/test/playground/etc/main/BLOCK-INF tools/magic/src/main/org/apache/avalon/tools/home tools/magic/src/main/org/apache/avalon/tools/tasks

[email protected]
Newsgroups gmane.comp.jakarta.avalon.cvs
Message-ID <[email protected]>
Author: mcconnell
Date: Wed Jun 16 17:14:00 2004
New Revision: 21368

Added:
   avalon/trunk/runtime/test/playground/etc/
   avalon/trunk/runtime/test/playground/etc/deliverables/
   avalon/trunk/runtime/test/playground/etc/deliverables/blocks/
   avalon/trunk/runtime/test/playground/etc/deliverables/blocks/avalon-test-playground.block   (contents, props changed)
   avalon/trunk/runtime/test/playground/etc/main/
   avalon/trunk/runtime/test/playground/etc/main/BLOCK-INF/
   avalon/trunk/runtime/test/playground/etc/main/BLOCK-INF/block.xml
Modified:
   avalon/trunk/central/system/index.xml
   avalon/trunk/runtime/merlin/cli/etc/test/merlin.properties
   avalon/trunk/runtime/merlin/cli/src/test/org/apache/avalon/merlin/cli/test/MerlinCLITestCase.java
   avalon/trunk/runtime/merlin/impl/build.xml
   avalon/trunk/runtime/test/playground/build.xml
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/home/Context.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JavadocTask.java
Log:
updates following tests with Alex

Modified: avalon/trunk/central/system/index.xml
==============================================================================
--- avalon/trunk/central/system/index.xml	(original)
+++ avalon/trunk/central/system/index.xml	Wed Jun 16 17:14:00 2004
@@ -140,8 +140,8 @@
         <version>4.2.1</version>
       </info>
       <dependencies>
-        <include key="avalon-framework-api"/>
-        <include key="avalon-framework-legacy" runtime="false" />
+        <include key="avalon-framework-api" tag="api"/>
+        <include key="avalon-framework-legacy" />
       </dependencies>
     </project>
 

Modified: avalon/trunk/runtime/merlin/cli/etc/test/merlin.properties
==============================================================================
--- avalon/trunk/runtime/merlin/cli/etc/test/merlin.properties	(original)
+++ avalon/trunk/runtime/merlin/cli/etc/test/merlin.properties	Wed Jun 16 17:14:00 2004
@@ -1,29 +1,12 @@
 
-#----------------------------------------------------------------------
-# static defaults for the merlin platform
-#----------------------------------------------------------------------
-
-#
-# The default avalon repository root directory. 
-#
-avalon.home = ${user.home}/.avalon
-
-#
-# merlin system implementation
-merlin.implementation = @MERLIN_IMPLEMENTATION@
-
-#
-# logging implementation
-merlin.logging.implementation = @LOGGING_IMPLEMENTATION@
-
-#
-# runtime implementation
-merlin.runtime.implementation = @STANDARD_RUNTIME@
-
 #
 # server mode
-merlin.server = true
-
+merlin.server = true
+
+#
+#
+merlin.deployment = artifact:block:avalon/test/avalon-test-playground
+
 #
 # EOF
 #

Modified: avalon/trunk/runtime/merlin/cli/src/test/org/apache/avalon/merlin/cli/test/MerlinCLITestCase.java
==============================================================================
--- avalon/trunk/runtime/merlin/cli/src/test/org/apache/avalon/merlin/cli/test/MerlinCLITestCase.java	(original)
+++ avalon/trunk/runtime/merlin/cli/src/test/org/apache/avalon/merlin/cli/test/MerlinCLITestCase.java	Wed Jun 16 17:14:00 2004
@@ -61,8 +61,9 @@
             String[] args = 
               new String[]
               {
-                "-execute",
-                "hello.block",
+                "-execute",
+                "-repository",
+                system,
                 "-home",
                 basedir,
                 "-system",

Modified: avalon/trunk/runtime/merlin/impl/build.xml
==============================================================================
--- avalon/trunk/runtime/merlin/impl/build.xml	(original)
+++ avalon/trunk/runtime/merlin/impl/build.xml	Wed Jun 16 17:14:00 2004
@@ -17,7 +17,7 @@
 
   <target name="package" depends="standard.package">
     <x:artifact/>
-    <!--<x:javadoc/>-->
+    <x:javadoc/>
   </target>
 
 </project>

Modified: avalon/trunk/runtime/test/playground/build.xml
==============================================================================
--- avalon/trunk/runtime/test/playground/build.xml	(original)
+++ avalon/trunk/runtime/test/playground/build.xml	Wed Jun 16 17:14:00 2004
@@ -7,6 +7,13 @@
   <property file="build.properties"/>
   <import file="${project.home}/build/standard.xml"/>
 
+  <target name="init" depends="standard.init">
+    <x:filter key="avalon-framework-impl" feature="uri" 
+       token="FRAMEWORK-IMPL-SPEC"/>
+    <x:filter key="avalon-test-playground" feature="uri" 
+       token="PLAYGROUND-SPEC"/>
+  </target>
+
   <target name="build" depends="standard.build">
     <m:meta destDir="${basedir}/target/classes">
       <fileset dir="${basedir}/src/main">

Added: avalon/trunk/runtime/test/playground/etc/deliverables/blocks/avalon-test-playground.block
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/test/playground/etc/deliverables/blocks/avalon-test-playground.block	Wed Jun 16 17:14:00 2004
@@ -0,0 +1,59 @@
+
+<!--
+Example block deployment descriptor.
+-->
+
+<container name="playground">
+
+   <categories priority="INFO"/>
+
+   <classloader>
+     <classpath>
+       <artifact>@PLAYGROUND-SPEC@</artifact>
+       <artifact>@FRAMEWORK-IMPL-SPEC@</artifact>
+     </classpath>
+   </classloader>
+
+   <services>
+     <service type="org.apache.avalon.test.playground.basic.BasicService" version="1.1"/>
+   </services>
+
+   <container name="subsidiary">
+
+     <component name="complex"
+       class="org.apache.avalon.test.playground.ComplexComponent">
+       <categories priority="INFO"/>
+     </component>
+     
+     <container name="test">
+       <component name="simple" class="org.apache.avalon.test.playground.SimpleComponent"/>
+     </container>
+
+   </container>
+
+   <!--
+   Commenting the following out to validate demand-driven discovery in 
+   combination with automated assembly and export resolution.
+   -->
+   <!--
+   <component name="demo" 
+     class="org.apache.avalon.test.playground.DemoManager"/>
+   
+   <component name="exploitation" 
+     class="org.apache.avalon.test.playground.ExploitationManager"/>
+
+   <component name="basic"
+       class="org.apache.avalon.test.playground.basic.BasicComponent"
+       activation="startup">
+     <context class="org.apache.avalon.test.playground.basic.BasicContextImp">
+       <entry key="location">
+         <constructor>My Place</constructor>
+       </entry>
+       <entry key="home">
+         <import key="urn:avalon:home"/>
+       </entry>
+     </context>
+   </component>
+   -->
+
+</container>

Added: avalon/trunk/runtime/test/playground/etc/main/BLOCK-INF/block.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/test/playground/etc/main/BLOCK-INF/block.xml	Wed Jun 16 17:14:00 2004
@@ -0,0 +1,59 @@
+
+<!--
+Example block deployment descriptor.
+-->
+
+<container name="playground">
+
+   <categories priority="INFO"/>
+
+   <classloader>
+     <classpath>
+       <artifact>artifact:jar:avalon/test/avalon-test-playground</artifact>
+       <artifact>@FRAMEWORK-IMPL-SPEC@</artifact>
+     </classpath>
+   </classloader>
+
+   <services>
+     <service type="org.apache.avalon.test.playground.basic.BasicService" version="1.1"/>
+   </services>
+
+   <container name="subsidiary">
+
+     <component name="complex"
+       class="org.apache.avalon.test.playground.ComplexComponent">
+       <categories priority="INFO"/>
+     </component>
+     
+     <container name="test">
+       <component name="simple" class="org.apache.avalon.test.playground.SimpleComponent"/>
+     </container>
+
+   </container>
+
+   <!--
+   Commenting the following out to validate demand-driven discovery in 
+   combination with automated assembly and export resolution.
+   -->
+   <!--
+   <component name="demo" 
+     class="org.apache.avalon.test.playground.DemoManager"/>
+   
+   <component name="exploitation" 
+     class="org.apache.avalon.test.playground.ExploitationManager"/>
+
+   <component name="basic"
+       class="org.apache.avalon.test.playground.basic.BasicComponent"
+       activation="startup">
+     <context class="org.apache.avalon.test.playground.basic.BasicContextImp">
+       <entry key="location">
+         <constructor>My Place</constructor>
+       </entry>
+       <entry key="home">
+         <import key="urn:avalon:home"/>
+       </entry>
+     </context>
+   </component>
+   -->
+
+</container>

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/home/Context.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/home/Context.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/home/Context.java	Wed Jun 16 17:14:00 2004
@@ -18,6 +18,7 @@
 package org.apache.avalon.tools.home;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Hashtable;
 import java.util.Map;
 import java.text.SimpleDateFormat;
@@ -308,13 +309,26 @@
             throw new NullPointerException( "path" );
         }
         File file = new File( path );
-        if( file.isAbsolute() ) return file;
+        if( file.isAbsolute() ) return getCanonicalFile( file );
         if( null == root )
         {
             throw new NullPointerException( "root" );
         }
-        return new File( root, path );
+        return getCanonicalFile( new File( root, path ) );
     }
+
+    public static File getCanonicalFile( File file ) throws BuildException
+    {
+        try
+        {
+            return file.getCanonicalFile();
+        }
+        catch( IOException ioe )
+        {
+            throw new BuildException( ioe );
+        }
+    }
+
 
     public static String getSignature()
     {

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JavadocTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JavadocTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JavadocTask.java	Wed Jun 16 17:14:00 2004
@@ -34,6 +34,7 @@
 import org.apache.avalon.tools.project.Definition;
 import org.apache.avalon.tools.project.ResourceRef;
 import org.apache.avalon.tools.project.Resource;
+import org.apache.avalon.tools.project.Policy;
 
 /**
  * Build the javadoc for a project. 
@@ -48,19 +49,41 @@
     public static final String SPI = "spi";
     public static final String IMPL = "impl";
 
+    private String m_root = "{docRoot}";
+
+    public void setRoot( String root )
+    {
+        if( root.endsWith( "/" ) )
+        { 
+            m_root = root.substring( 0, root.length() - 1 );
+        }
+        else
+        {
+            m_root = root;
+        }
+    }
+
     public void execute() throws BuildException 
     {
         Definition def = getHome().getDefinition( getKey() );
         File root = getJavadocRootDirectory( def );
+        Path classpath = def.getPath( getProject(), Policy.RUNTIME );
 
         ArrayList visited = new ArrayList();
-        execute( def, visited, ResourceRef.API, "api", root );
-        execute( def, visited, ResourceRef.SPI, "spi", root );
-        execute( def, visited, ResourceRef.IMPL, "impl", root );
+        File api = setup( 
+          def, classpath, visited, ResourceRef.API, 
+          "api", root, null, null, false );
+        File spi = setup( 
+          def, classpath, visited, ResourceRef.SPI, 
+          "spi", root, api, m_root + "/../api/", false );
+        setup( 
+          def, classpath, visited, ResourceRef.IMPL, 
+          "impl", root, spi, m_root + "/../spi/", true );
     }
 
-    private void execute( 
-      Definition def, List visited, int category, String branch, File root )
+    private File setup( 
+      Definition def, Path classpath, List visited, int category, String branch, 
+      File root, File parent, String href, boolean flag )
     {
         File base = new File( root, branch );
         ResourceRef[] refs = def.getQualifiedRefs( visited, category );
@@ -70,19 +93,22 @@
               "Javadoc preparation for category: " 
               + branch + ", " 
               + refs.length );
-            generate( def, refs, base );
+            generate( def, classpath, refs, base, parent, href, flag );
         }
+        return base;
     }
 
     private void generate( 
-       Definition definition, ResourceRef[] refs, File root )
+       Definition definition, Path classpath, ResourceRef[] refs, 
+       File root, File parent, String href, boolean flag )
     {
         Javadoc javadoc = (Javadoc) getProject().createTask( "javadoc" );
 
         javadoc.init();
         javadoc.setDestdir( root );
         Path source = javadoc.createSourcepath();
-        Path classpath = javadoc.createClasspath();
+        javadoc.createClasspath().add( classpath );
+        
         for( int i=0; i<refs.length; i++ )
         {
             ResourceRef ref = refs[i];
@@ -91,30 +117,41 @@
             {
                 Definition def = (Definition) resource;
                 File base = def.getBasedir();
-                File src = new File( base, "target/build/main" );
+                File src = Context.getFile( base, "target/build/main" );
                 if( src.exists() )
                 {
+                    log( "Adding src path: " + src );
                     source.createPathElement().setLocation( src );
                     DirSet packages = new DirSet();
                     packages.setDir( src );
                     packages.setIncludes( "**/**" );
                     javadoc.addPackageset( packages );
                 }
+                else
+                {
+                    log( "Ignoring src path: " + src );
+                }
             }
-            else
-            {
-                File artifact = resource.getArtifact( getProject() );
-                classpath.createPathElement().setLocation( artifact );
-            }
         }
 
-        File basedir = definition.getBasedir();
-        File local = new File( basedir, "target/build/main" );
-        if( local.exists() )
+        if( null != href )
+        {
+            Javadoc.LinkArgument link = javadoc.createLink();
+            link.setOffline( true );
+            link.setPackagelistLoc( parent );
+            link.setHref( href );
+        }
+
+        if( flag )
         {
-            source.createPathElement().setLocation( local );
-            javadoc.execute();
+            File basedir = definition.getBasedir();
+            File local = new File( basedir, "target/build/main" );
+            if( local.exists() )
+            {
+                source.createPathElement().setLocation( local );
+            }
         }
+        javadoc.execute();
     }
 
     private File getJavadocRootDirectory( Definition def )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.