notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r1702 - development/main/home/transit/tools/src/main/net/dpml/transit/tools
- From: mcconnell AT netcompartner.com
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r1702 - development/main/home/transit/tools/src/main/net/dpml/transit/tools
- Date: Wed, 02 Feb 2005 18:37:19 +0100
Author: mcconnell
Date: Wed Feb 2 18:37:18 2005
New Revision: 1702
Modified:
development/main/home/transit/tools/src/main/net/dpml/transit/tools/MainTask.java
development/main/home/transit/tools/src/main/net/dpml/transit/tools/TransitComponentHelper.java
Log:
Resolve an issue with initialization of magic in a project where magic was
already initializaed in a sub-project independently of the parent project.
Modified:
development/main/home/transit/tools/src/main/net/dpml/transit/tools/MainTask.java
==============================================================================
---
development/main/home/transit/tools/src/main/net/dpml/transit/tools/MainTask.java
(original)
+++
development/main/home/transit/tools/src/main/net/dpml/transit/tools/MainTask.java
Wed Feb 2 18:37:18 2005
@@ -44,8 +44,8 @@
*
* <pre>
<project name="example"
- xmlns:TRANSIT="antlib:net.dpml.magic">
- <TRANSIT:init/>
+ xmlns:transit="antlib:net.dpml.transit">
+ <transit:init/>
<echo message="Home: ${dpml.home}"/>
<echo message="Cache: ${dpml.cache}"/>
<echo message="Templates: ${dpml.templates}"/>
@@ -70,7 +70,7 @@
/**
* The one-time initialized state of the transit system.
*/
- private static boolean init = false;
+ private static boolean m_INIT = false;
//
------------------------------------------------------------------------
// state
@@ -114,17 +114,15 @@
{
Project project = getProject();
checkProperties( project );
- if( !init )
+ if( !m_INIT )
{
setupMonitors();
File home = Transit.DPML_HOME;
- log( "home: " + home.getAbsolutePath() );
- TransitComponentHelper helper = new TransitComponentHelper(
project );
- project.addBuildListener( helper );
- TransitComponentHelper.initialize( project );
- init = true;
+ log( "initialization in " + project.getName() );
+ m_INIT = true;
}
-
+ TransitComponentHelper.initialize( project );
+ ComponentHelper ch = ComponentHelper.getComponentHelper( project );
Map[] maps = (Map[]) m_mappings.toArray( new Map[0] );
TransitComponentHelper.register( maps );
}
Modified:
development/main/home/transit/tools/src/main/net/dpml/transit/tools/TransitComponentHelper.java
==============================================================================
---
development/main/home/transit/tools/src/main/net/dpml/transit/tools/TransitComponentHelper.java
(original)
+++
development/main/home/transit/tools/src/main/net/dpml/transit/tools/TransitComponentHelper.java
Wed Feb 2 18:37:18 2005
@@ -58,10 +58,11 @@
// static
//------------------------------------------------------------------------
- public static final String TRANSIT_ANLIB_URN = "antlib:net.dpml.transit";
- public static final String TRANSIT_INIT_URN = TRANSIT_ANLIB_URN +
":init";
- public static final String TRANSIT_PLUGIN_URN = TRANSIT_ANLIB_URN +
":plugin";
- public static final String TRANSIT_IMPORT_URN = TRANSIT_ANLIB_URN +
":import";
+ public static final String TRANSIT_ANTLIB_URN =
"antlib:net.dpml.transit";
+ public static final String TRANSIT_INIT_URN = TRANSIT_ANTLIB_URN +
":init";
+ public static final String TRANSIT_PLUGIN_URN = TRANSIT_ANTLIB_URN +
":plugin";
+ public static final String TRANSIT_IMPORT_URN = TRANSIT_ANTLIB_URN +
":import";
+ public static final String TRANSIT_GET_URN = TRANSIT_ANTLIB_URN + ":get";
public static final String PLUGIN_ARTIFACT_HEADER = "artifact:plugin:";
@@ -100,7 +101,9 @@
}
else
{
- project.log( "\nAssigning Transit component helper" );
+ project.log(
+ "\nAssigning Transit component helper to project: "
+ + project.getBaseDir() );
}
project.addReference( "ant.ComponentHelper", helper );
project.addBuildListener( helper );
@@ -167,9 +170,14 @@
parent.setNext( this );
}
- addTaskDefinition( TRANSIT_INIT_URN, MainTask.class );
- addTaskDefinition( TRANSIT_PLUGIN_URN, PluginTask.class );
- addTaskDefinition( TRANSIT_IMPORT_URN, ImportArtifactTask.class );
+ Hashtable map = getTaskDefinitions();
+ if( null == map.get( TRANSIT_INIT_URN ) )
+ {
+ addTaskDefinition( TRANSIT_INIT_URN, MainTask.class );
+ addTaskDefinition( TRANSIT_PLUGIN_URN, PluginTask.class );
+ addTaskDefinition( TRANSIT_IMPORT_URN, ImportArtifactTask.class );
+ addTaskDefinition( TRANSIT_GET_URN, GetTask.class );
+ }
}
//------------------------------------------------------------------------
@@ -230,11 +238,27 @@
if( null != uri )
{
installPlugin( uri, urn, task );
+ object = super.createComponent( name );
+ if( null != object )
+ {
+ return object;
+ }
+ else
+ {
+ final String error =
+ "Mapped urn returned a null object.";
+ throw new BuildException( error );
+ }
+ }
+ else
+ {
return super.createComponent( name );
}
}
-
- return super.createComponent( name );
+ else
+ {
+ return super.createComponent( name );
+ }
}
/**
@@ -273,7 +297,8 @@
*/
private void installPlugin( URI uri, String urn, String name )
{
- if( m_uris.contains( uri ) )
+ final String label = uri + ":" + name;
+ if( null != getTaskDefinitions().get( label ) )
{
return;
}
- svn commit: r1702 - development/main/home/transit/tools/src/main/net/dpml/transit/tools, mcconnell, 02/02/2005
Archive powered by MHonArc 2.6.24.