avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject svn commit: rev 46931 - avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks
Date Mon, 20 Sep 2004 12:00:08 GMT
Author: niclas
Date: Mon Sep 20 05:00:05 2004
New Revision: 46931

Modified:
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PropertyTask.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/ReplicateTask.java
Log:
Fried rotten egg sinks in water unless chewed on, and Steve/Peter has worked out some patch
for Magic's property handling.

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PropertyTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PropertyTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/PropertyTask.java	Mon
Sep 20 05:00:05 2004
@@ -36,6 +36,7 @@
     private String m_key;
     private String m_feature;
     private String m_property;
+    private boolean m_resolve = true;
 
     public void init()
     {
@@ -50,6 +51,11 @@
         m_key = key;
     }
 
+    public void setResolve( final boolean policy )
+    {
+        m_resolve = policy;
+    }
+
     public void setFeature( final String feature )
     {
         m_feature = feature;
@@ -82,7 +88,15 @@
             return;
         }
 
-        final String value = getFeature();
+        final ResourceRef ref = new ResourceRef( m_key );
+        final Resource resource = getHome().getResource( ref );
+        if( m_resolve )
+        {
+            resource.getArtifact( getProject() );
+        }
+
+        final String value = getFeature( resource );
+
         if( null != value )
         {
             final Property property = (Property) getProject().createTask( "property" );
@@ -98,10 +112,8 @@
         }
     }
 
-    private String getFeature()
+    private String getFeature( Resource resource )
     {
-        final ResourceRef ref = new ResourceRef( m_key );
-        final Resource resource = getHome().getResource( ref );
         if( m_feature.equals( "name" ) )
         {
             return resource.getInfo().getName();

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/ReplicateTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/ReplicateTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/ReplicateTask.java	Mon
Sep 20 05:00:05 2004
@@ -68,11 +68,27 @@
     }
 
    /**
+    * Set the path programatically.
+    * @param path a path object
+    */
+    public void setReplicationPath( Path path )
+    {
+        m_path = path;
+    }
+
+   /**
     * The id of a repository based path.
     */
     public void setRefid( String id )
         throws BuildException
     {
+        if( null != m_path )
+        {
+            final String error = 
+              "Path already set.";
+            throw new BuildException( error );
+        }
+
         Object ref = getProject().getReference( id );
         if( null == ref )
         {

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


Mime
View raw message