svn commit: rev 21539 - avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks

[email protected]
Newsgroups gmane.comp.jakarta.avalon.cvs
Message-ID <[email protected]>
Author: mcconnell
Date: Mon Jun 21 06:53:26 2004
New Revision: 21539

Modified:
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/DeclareTask.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PluginTask.java
Log:
Update the plugin descriptor to use the standard artifact uri format.

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/DeclareTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/DeclareTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/DeclareTask.java	Mon Jun 21 06:53:26 2004
@@ -200,8 +200,6 @@
         final String pad = "    ";
         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>" );
@@ -235,7 +233,7 @@
 
         writer.write( "\n" );
         writer.write( pad );
-        writer.write( "<" + type + ">" );
+        writer.write( "<artifact>" + type + ":" );
         writer.write( group );
         writer.write( "/" );
         writer.write( name );
@@ -245,7 +243,7 @@
             writer.write( "#" );
             writer.write( version );
         }
-        writer.write( "</" + type + ">" );
+        writer.write( "</artifact>" );
     }
 
     private void closeStream( final OutputStream output )

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PluginTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PluginTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PluginTask.java	Mon Jun 21 06:53:26 2004
@@ -240,13 +240,14 @@
             m_listeners = XMLDefinitionBuilder.getListenerDefs( listenerElement );
 
             Element classpathElement = ElementHelper.getChild( root, "classpath" );
-            Element[] children = ElementHelper.getChildren( classpathElement );
+            Element[] children = ElementHelper.getChildren( classpathElement, "artifact" );
             for( int i=0; i<children.length; i++ )
             {
                 Element child = children[i];
-                String type = child.getTagName();
                 String value = ElementHelper.getValue( child );
-                Info info = Info.create( type, value );
+                String type = getArtifactType( value );
+                String uri = getArtifactURI( value );
+                Info info = Info.create( type, uri );
                 Resource resource = new Resource( home, info );
                 File jar = resource.getArtifact( project );
                 m_path.createPathElement().setLocation( jar );
@@ -271,6 +272,20 @@
         public Path getPath()
         {
             return m_path;
+        }
+
+        private String getArtifactType( String value )
+        {
+            int i = value.indexOf( ":" );
+            if( i > 0 ) return value.substring( 0, i );
+            return "jar";
+        }
+
+        private String getArtifactURI( String value )
+        {
+            int i = value.indexOf( ":" );
+            if( i > 0 ) return value.substring( i+1 );
+            return value;
         }
     }
 }
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.