donaldp 00/12/12 03:43:47
Modified: proposal/myrmidon/src/java/org/apache/ant Main.java
proposal/myrmidon/src/java/org/apache/ant/configuration
DefaultConfigurer.java
proposal/myrmidon/src/java/org/apache/ant/convert
ConverterEngine.java DefaultConverterEngine.java
proposal/myrmidon/src/java/org/apache/ant/project
DefaultProjectBuilder.java
DefaultProjectEngine.java DefaultTarget.java
Target.java
proposal/myrmidon/src/java/org/apache/ant/tasklet
AbstractTasklet.java DefaultTaskletContext.java
Tasklet.java TaskletContext.java
proposal/myrmidon/src/java/org/apache/ant/tasklet/engine
DefaultTaskletEngine.java DefaultTskDeployer.java
TaskletEngine.java TskDeployer.java
proposal/myrmidon/src/java/org/apache/ant/tasks/core
AntCall.java Property.java RegisterConverter.java
RegisterTasklet.java
proposal/myrmidon/src/make sample.xmk
proposal/myrmidon/src/manifest taskdefs.xml
Added: proposal/myrmidon/src/java/org/apache/ant/datatypes
Condition.java DataType.java DataTypeEngine.java
DefaultDataTypeEngine.java Pattern.java
proposal/myrmidon/src/java/org/apache/ant/project
LogTargetToListenerAdapter.java
proposal/myrmidon/src/java/org/apache/ant/tasklet/engine
TaskletDataTypeEngine.java
Removed: proposal/myrmidon/src/java/org/apache/ant/project
ProjectToListenerAdapter.java
Log:
Added in the ability to deploy datatypes in properties. Datatypes are
currently solely registered through taskdef.xml. Will in future be registered
through tasks aswell.
Made conditions (if/unless interpreted in a context)
Revision Changes Path
1.5 +4 -4
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/Main.java
Index: Main.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/Main.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Main.java 2000/12/06 06:11:22 1.4
+++ Main.java 2000/12/12 11:43:18 1.5
@@ -27,7 +27,7 @@
import org.apache.ant.project.ProjectBuilder;
import org.apache.ant.project.ProjectEngine;
import org.apache.ant.project.ProjectListener;
-import org.apache.ant.project.ProjectToListenerAdapter;
+import org.apache.ant.project.LogTargetToListenerAdapter;
import org.apache.ant.tasklet.JavaVersion;
import org.apache.ant.tasklet.TaskletContext;
import org.apache.ant.tasklet.engine.TaskletEngine;
@@ -232,7 +232,8 @@
new CLOptionDescriptor( "define",
CLOptionDescriptor.ARGUMENTS_REQUIRED_2,
DEFINE_OPT,
- "Define a variable (ie -Dfoo=var)" );
+ "Define a variable (ie -Dfoo=var)",
+ new int[ 0 ] );
return options;
}
@@ -481,7 +482,7 @@
protected void setupListener( final String listenerName )
{
m_listener = createListener( listenerName );
- m_logger.addLogTarget( new ProjectToListenerAdapter( m_listener ) );
+ m_logger.addLogTarget( new LogTargetToListenerAdapter( m_listener )
);
}
/**
@@ -566,7 +567,6 @@
defines.put( AntContextResources.LIB_DIR, m_libDir );
defines.put( AntContextResources.TASKLIB_DIR, m_taskLibDir );
//defines.put( AntContextResources.USER_DIR, m_userDir );
- defines.put( TaskletContext.LOGGER, m_logger );
defines.put( TaskletContext.JAVA_VERSION, getJavaVersion() );
final TaskletContext context = project.getContext();
1.2 +58 -15
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/configuration/DefaultConfigurer.java
Index: DefaultConfigurer.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/configuration/DefaultConfigurer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultConfigurer.java 2000/12/11 00:33:38 1.1
+++ DefaultConfigurer.java 2000/12/12 11:43:19 1.2
@@ -19,8 +19,10 @@
import org.apache.avalon.Composer;
import org.apache.avalon.ConfigurationException;
import org.apache.avalon.Context;
+import org.apache.avalon.Loggable;
import org.apache.avalon.util.PropertyException;
import org.apache.avalon.util.PropertyUtil;
+import org.apache.log.Logger;
/**
* Class used to configure tasks.
@@ -28,7 +30,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
*/
public class DefaultConfigurer
- implements Configurer, Composer
+ implements Configurer, Composer, Loggable
{
protected final static String RESERVED_ATTRIBUTES[] =
{
@@ -40,8 +42,15 @@
"content"
};
+ protected final static boolean DEBUG = false;
protected Converter m_converter;
+ protected Logger m_logger;
+ public void setLogger( final Logger logger )
+ {
+ m_logger = logger;
+ }
+
public void compose( final ComponentManager componentManager )
throws ComponentNotFoundException, ComponentNotAccessibleException
{
@@ -66,18 +75,39 @@
final Context context )
throws ConfigurationException
{
+ if( DEBUG )
+ {
+ m_logger.debug( "Configuring " + object );
+ }
+
if( object instanceof Configurable )
{
+ if( DEBUG )
+ {
+ m_logger.debug( "Configuring object via Configurable
interface" );
+ }
+
((Configurable)object).configure( configuration );
}
else
{
- final Iterator attributes = configuration.getAttributeNames();
+ if( DEBUG )
+ {
+ m_logger.debug( "Configuring object via Configurable
reflection" );
+ }
+ final Iterator attributes = configuration.getAttributeNames();
while( attributes.hasNext() )
{
final String name = (String)attributes.next();
final String value = configuration.getAttribute( name );
+
+ if( DEBUG )
+ {
+ m_logger.debug( "Configuring attribute name=" + name +
+ " value=" + value );
+ }
+
configureAttribute( object, name, value, context );
}
@@ -86,6 +116,12 @@
while( elements.hasNext() )
{
final Configuration element = (Configuration)elements.next();
+
+ if( DEBUG )
+ {
+ m_logger.debug( "Configuring subelement name=" +
element.getName() );
+ }
+
configureElement( object, element, context );
}
@@ -95,6 +131,11 @@
{
if( !content.trim().equals( "" ) )
{
+ if( DEBUG )
+ {
+ m_logger.debug( "Configuring content " + content );
+ }
+
configureContent( object, content, context );
}
}
@@ -206,22 +247,24 @@
parameterType = getComplexTypeFor( parameterType );
}
- if( !parameterType.isAssignableFrom( sourceClass ) )
+ try
{
- try
- {
- value = m_converter.convert( parameterType, object );
- }
- catch( final ConverterException ce )
- {
- return false;
- }
- catch( final Exception e )
+ value = m_converter.convert( parameterType, value );
+ }
+ catch( final ConverterException ce )
+ {
+ if( DEBUG )
{
- throw new ConfigurationException( "Error converting
attribute for " +
- method.getName(),
- e );
+ m_logger.debug( "Failed to find converter ", ce );
}
+
+ return false;
+ }
+ catch( final Exception e )
+ {
+ throw new ConfigurationException( "Error converting attribute
for " +
+ method.getName(),
+ e );
}
try
1.3 +2 -2
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/ConverterEngine.java
Index: ConverterEngine.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/ConverterEngine.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ConverterEngine.java 2000/12/11 00:33:39 1.2
+++ ConverterEngine.java 2000/12/12 11:43:21 1.3
@@ -15,6 +15,6 @@
public interface ConverterEngine
extends Component, Converter, Loggable
{
- LocatorRegistry getLocatorRegistry();
- ConverterRegistry getConverterRegistry();
+ LocatorRegistry getRegistry();
+ ConverterRegistry getInfoRegistry();
}
1.4 +29 -15
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/DefaultConverterEngine.java
Index: DefaultConverterEngine.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/DefaultConverterEngine.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultConverterEngine.java 2000/12/11 00:33:39 1.3
+++ DefaultConverterEngine.java 2000/12/12 11:43:21 1.4
@@ -19,9 +19,10 @@
public class DefaultConverterEngine
implements ConverterEngine, Initializable
{
+ protected final static boolean DEBUG = false;
protected DefaultFactory m_factory;
- protected LocatorRegistry m_locatorRegistry;
- protected ConverterRegistry m_converterRegistry;
+ protected LocatorRegistry m_registry;
+ protected ConverterRegistry m_infoRegistry;
protected Logger m_logger;
public void setLogger( final Logger logger )
@@ -29,30 +30,30 @@
m_logger = logger;
}
- public LocatorRegistry getLocatorRegistry()
+ public LocatorRegistry getRegistry()
{
- return m_locatorRegistry;
+ return m_registry;
}
- public ConverterRegistry getConverterRegistry()
+ public ConverterRegistry getInfoRegistry()
{
- return m_converterRegistry;
+ return m_infoRegistry;
}
public void init()
throws Exception
{
- m_converterRegistry = createConverterRegistry();
- m_locatorRegistry = createLocatorRegistry();
+ m_infoRegistry = createInfoRegistry();
+ m_registry = createRegistry();
m_factory = createFactory();
}
- protected ConverterRegistry createConverterRegistry()
+ protected ConverterRegistry createInfoRegistry()
{
return new DefaultConverterRegistry();
}
- protected LocatorRegistry createLocatorRegistry()
+ protected LocatorRegistry createRegistry()
{
return new DefaultLocatorRegistry();
}
@@ -65,18 +66,31 @@
public Object convert( Class destination, final Object original )
throws Exception
{
+ final Class originalClass = original.getClass();
+
+ if( destination.isAssignableFrom( originalClass ) )
+ {
+ return original;
+ }
+
+ if( DEBUG )
+ {
+ m_logger.debug( "Looking for converter from " +
originalClass.getName() +
+ " to " + destination.getName() );
+ }
+
final String name =
- m_converterRegistry.getConverterInfoName(
original.getClass().getName(),
- destination.getName()
);
+ m_infoRegistry.getConverterInfoName( originalClass.getName(),
+ destination.getName() );
if( null == name )
{
throw new ConverterException( "Unable to find converter for " +
- original.getClass() + " to " +
destination +
- " conversion" );
+ originalClass.getName() + " to " +
+ destination.getName() + "
conversion" );
}
- final Locator locator = m_locatorRegistry.getLocator( name );
+ final Locator locator = m_registry.getLocator( name );
final Converter converter = (Converter)m_factory.create( locator,
Converter.class );
return converter.convert( destination, original );
}
1.1
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/datatypes/Condition.java
Index: Condition.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.ant.datatypes;
import org.apache.ant.AntException;
import org.apache.avalon.Component;
import org.apache.avalon.Context;
import org.apache.avalon.util.PropertyException;
import org.apache.avalon.util.PropertyUtil;
/**
* Class representing a condition.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
*/
public class Condition
implements Component
{
protected String m_condition;
protected boolean m_isIfCondition;
public Condition( final boolean isIfCondition, final String condition )
{
m_isIfCondition = isIfCondition;
m_condition = condition;
}
public String getCondition()
{
return m_condition;
}
public boolean isIfCondition()
{
return m_isIfCondition;
}
public boolean evaluate( final Context context )
{
try
{
final Object resolved =
PropertyUtil.resolveProperty( m_condition, context, false );
boolean result = false;
if( null != resolved )
{
result = ( null != context.get( resolved ) );
}
if( !m_isIfCondition )
{
result = !result;
}
return result;
}
catch( final PropertyException pe )
{
throw new AntException( "Error resolving " + m_condition, pe );
}
}
}
1.1
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/datatypes/DataType.java
Index: DataType.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.ant.datatypes;
import org.apache.avalon.Component;
/**
* Base class for those classes that can appear inside the build file
* as stand alone data types.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
*/
public interface DataType
extends Component
{
}
1.1
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/datatypes/DataTypeEngine.java
Index: DataTypeEngine.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.ant.datatypes;
import org.apache.avalon.Component;
import org.apache.avalon.Loggable;
import org.apache.avalon.camelot.FactoryException;
import org.apache.avalon.camelot.LocatorRegistry;
import org.apache.avalon.camelot.RegistryException;
public interface DataTypeEngine
extends Component, Loggable
{
LocatorRegistry getRegistry();
DataType createDataType( String name )
throws RegistryException, FactoryException;
}
1.1
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/datatypes/DefaultDataTypeEngine.java
Index: DefaultDataTypeEngine.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.ant.datatypes;
import org.apache.ant.AntException;
import org.apache.avalon.Initializable;
import org.apache.avalon.Loggable;
import org.apache.avalon.camelot.DefaultFactory;
import org.apache.avalon.camelot.DefaultLocatorRegistry;
import org.apache.avalon.camelot.Locator;
import org.apache.avalon.camelot.LocatorRegistry;
import org.apache.avalon.camelot.RegistryException;
import org.apache.avalon.camelot.FactoryException;
import org.apache.log.Logger;
public class DefaultDataTypeEngine
implements DataTypeEngine, Initializable
{
protected DefaultFactory m_factory;
protected LocatorRegistry m_registry;
protected Logger m_logger;
public void setLogger( final Logger logger )
{
m_logger = logger;
}
public LocatorRegistry getRegistry()
{
return m_registry;
}
public void init()
throws Exception
{
m_registry = createRegistry();
setupComponent( m_registry );
m_factory = createFactory();
setupComponent( m_factory );
}
protected void setupComponent( final Object object )
throws Exception
{
if( object instanceof Loggable )
{
((Loggable)object).setLogger( m_logger );
}
}
protected LocatorRegistry createRegistry()
{
return new DefaultLocatorRegistry();
}
protected DefaultFactory createFactory()
{
return new DefaultFactory();
}
public DataType createDataType( final String name )
throws RegistryException, FactoryException
{
final Locator locator = m_registry.getLocator( name );
return (DataType)m_factory.create( locator, DataType.class );
}
}
1.1
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/datatypes/Pattern.java
Index: Pattern.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.ant.datatypes;
import org.apache.ant.AntException;
/**
* Basic data type for holding patterns.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
*/
public class Pattern
implements DataType
{
protected String m_name;
protected Condition m_condition;
public String getName()
{
return m_name;
}
public Condition getCondition()
{
return m_condition;
}
public void setName( final String name )
{
m_name = name;
}
public void setIf( final String condition )
throws AntException
{
verifyConditionNull();
m_condition = new Condition( true, condition );
}
public void setUnless( final String condition )
throws AntException
{
verifyConditionNull();
m_condition = new Condition( false, condition );
}
protected void verifyConditionNull()
throws AntException
{
if( null != m_condition )
{
throw new AntException( "Can only set one of if/else for pattern
data type" );
}
}
}
1.2 +7 -6
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/DefaultProjectBuilder.java
Index: DefaultProjectBuilder.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/DefaultProjectBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultProjectBuilder.java 2000/12/04 13:37:30 1.1
+++ DefaultProjectBuilder.java 2000/12/12 11:43:23 1.2
@@ -13,6 +13,7 @@
import org.apache.ant.AntException;
import org.apache.ant.configuration.Configuration;
import org.apache.ant.configuration.ConfigurationBuilder;
+import org.apache.ant.datatypes.Condition;
import org.apache.ant.tasklet.TaskletContext;
import org.apache.avalon.ConfigurationException;
import org.apache.log.Logger;
@@ -133,20 +134,20 @@
"unless condition at " +
configuration.getLocation() );
}
- final DefaultTarget target = new DefaultTarget();
-
+ Condition condition = null;
+
if( null != ifCondition )
{
m_logger.debug( "Target if condition: " + ifCondition );
- target.setIfCondition( true );
- target.setCondition( ifCondition );
+ condition = new Condition( true, ifCondition );
}
else if( null != unlessCondition )
{
m_logger.debug( "Target unless condition: " + unlessCondition );
- target.setIfCondition( false );
- target.setCondition( unlessCondition );
+ condition = new Condition( false, unlessCondition );
}
+
+ final DefaultTarget target = new DefaultTarget( condition );
if( null != depends )
{
1.5 +15 -6
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/DefaultProjectEngine.java
Index: DefaultProjectEngine.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/DefaultProjectEngine.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultProjectEngine.java 2000/12/06 06:11:25 1.4
+++ DefaultProjectEngine.java 2000/12/12 11:43:24 1.5
@@ -11,6 +11,7 @@
import java.util.Iterator;
import org.apache.ant.AntException;
import org.apache.ant.configuration.Configuration;
+import org.apache.ant.datatypes.Condition;
import org.apache.ant.tasklet.DefaultTaskletContext;
import org.apache.ant.tasklet.TaskletContext;
import org.apache.ant.tasklet.engine.DefaultTaskletEngine;
@@ -100,14 +101,10 @@
m_listenerSupport.projectStarted( projectName );
- executeTargetWork( "<init>", project.getImplicitTarget(), context );
-
//context = new DefaultTaskletContext( context );
-
- //placing logger lower (at targetlevel or at task level)
- //is possible if you want more fine grained control
- context.setProperty( TaskletContext.LOGGER, m_logger );
+ executeTargetWork( "<init>", project.getImplicitTarget(), context );
+
execute( project, target, context );
m_listenerSupport.projectFinished();
@@ -168,6 +165,18 @@
final Target target,
final TaskletContext context )
{
+ final Condition condition = target.getCondition();
+
+ if( null != condition )
+ {
+ if( false == condition.evaluate( context ) )
+ {
+ m_logger.debug( "Skipping target " + name +
+ " as it does not satisfy condition" );
+ return;
+ }
+ }
+
m_logger.debug( "Executing target " + name );
final Iterator tasks = target.getTasks();
1.2 +14 -19
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/DefaultTarget.java
Index: DefaultTarget.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/DefaultTarget.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultTarget.java 2000/12/04 13:37:30 1.1
+++ DefaultTarget.java 2000/12/12 11:43:25 1.2
@@ -10,43 +10,38 @@
import java.util.ArrayList;
import java.util.Iterator;
import org.apache.ant.configuration.Configuration;
+import org.apache.ant.datatypes.Condition;
public class DefaultTarget
implements Target
{
- protected ArrayList m_dependencies = new ArrayList();
- protected ArrayList m_tasks = new ArrayList();
- protected String m_condition;
- protected boolean m_isIfCondition;
+ protected final ArrayList m_dependencies = new ArrayList();
+ protected final ArrayList m_tasks = new ArrayList();
+ protected final Condition m_condition;
- public Iterator getDependencies()
+ public DefaultTarget( final Condition condition )
{
- return m_dependencies.iterator();
+ m_condition = condition;
}
- public Iterator getTasks()
+ public DefaultTarget()
{
- return m_tasks.iterator();
+ this( null );
}
- public String getCondition()
+ public Condition getCondition()
{
return m_condition;
- }
-
- public void setCondition( final String condition )
- {
- m_condition = condition;
}
-
- public boolean isIfCondition()
+
+ public Iterator getDependencies()
{
- return m_isIfCondition;
+ return m_dependencies.iterator();
}
- public void setIfCondition( final boolean isIfCondition )
+ public Iterator getTasks()
{
- m_isIfCondition = isIfCondition;
+ return m_tasks.iterator();
}
public void addDependency( final String dependency )
1.3 +2 -2
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/Target.java
Index: Target.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/Target.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Target.java 2000/12/05 09:21:49 1.2
+++ Target.java 2000/12/12 11:43:25 1.3
@@ -9,14 +9,14 @@
import java.util.Iterator;
import org.apache.avalon.Component;
+import org.apache.ant.datatypes.Condition;
public interface Target
extends Component
{
Iterator getDependencies();
Iterator getTasks();
- String getCondition();
- boolean isIfCondition();
+ Condition getCondition();
}
1.1
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/LogTargetToListenerAdapter.java
Index: LogTargetToListenerAdapter.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.ant.project;
import org.apache.log.LogEntry;
import org.apache.log.LogTarget;
public class LogTargetToListenerAdapter
implements LogTarget
{
protected final ProjectListener m_listener;
public LogTargetToListenerAdapter( final ProjectListener listener )
{
m_listener = listener;
}
/**
* Process a log entry.
*
* @param entry the entry
*/
public void processEntry( final LogEntry entry )
{
if( null == entry.getThrowable() )
{
m_listener.log( entry.getMessage() );
}
else
{
m_listener.log( entry.getMessage(), entry.getThrowable() );
}
}
}
1.3 +10 -1
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/AbstractTasklet.java
Index: AbstractTasklet.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/AbstractTasklet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractTasklet.java 2000/12/06 00:23:32 1.2
+++ AbstractTasklet.java 2000/12/12 11:43:31 1.3
@@ -27,6 +27,16 @@
private Logger m_logger;
/**
+ * Receive logger from container.
+ *
+ * @param logger the logger
+ */
+ public void setLogger( final Logger logger )
+ {
+ m_logger = logger;
+ }
+
+ /**
* Retrieve context from container.
*
* @param context the context
@@ -34,7 +44,6 @@
public void contextualize( final Context context )
{
m_context = (TaskletContext)context;
- m_logger = (Logger)m_context.getLogger();
}
/**
1.3 +1 -18
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/DefaultTaskletContext.java
Index: DefaultTaskletContext.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/DefaultTaskletContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultTaskletContext.java 2000/12/06 00:23:32 1.2
+++ DefaultTaskletContext.java 2000/12/12 11:43:33 1.3
@@ -13,7 +13,6 @@
import org.apache.avalon.util.PropertyException;
import org.apache.avalon.util.PropertyUtil;
import org.apache.avalon.util.io.FileUtil;
-import org.apache.log.Logger;
/**
* Default implementation of TaskletContext.
@@ -69,16 +68,6 @@
}
/**
- * Retrieve Logger associated with task.
- *
- * @return the logger
- */
- public Logger getLogger()
- {
- return (Logger)get( LOGGER );
- }
-
- /**
* Retrieve base directory.
*
* @return the base directory
@@ -209,13 +198,7 @@
protected void checkPropertyValid( final String name, final Object value
)
throws AntException
{
- if( LOGGER.equals( name ) && !( value instanceof Logger ) )
- {
- throw new AntException( "property " + LOGGER +
- " must have a value of type " +
- Logger.class.getName() );
- }
- else if( BASE_DIRECTORY.equals( name ) && !( value instanceof File )
)
+ if( BASE_DIRECTORY.equals( name ) && !( value instanceof File ) )
{
throw new AntException( "Property " + BASE_DIRECTORY +
" must have a value of type " +
1.3 +2 -1
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/Tasklet.java
Index: Tasklet.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/Tasklet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Tasklet.java 2000/12/06 00:23:32 1.2
+++ Tasklet.java 2000/12/12 11:43:33 1.3
@@ -9,6 +9,7 @@
import org.apache.avalon.Component;
import org.apache.avalon.Contextualizable;
+import org.apache.avalon.Loggable;
/**
* This represents the individual tasks.
@@ -23,6 +24,6 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
*/
public interface Tasklet
- extends Component, Contextualizable, Runnable
+ extends Component, Contextualizable, Runnable, Loggable
{
}
1.2 +0 -9
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/TaskletContext.java
Index: TaskletContext.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/TaskletContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TaskletContext.java 2000/12/04 13:37:31 1.1
+++ TaskletContext.java 2000/12/12 11:43:34 1.2
@@ -11,7 +11,6 @@
import org.apache.avalon.Context;
import org.apache.avalon.util.Enum;
import org.apache.avalon.util.ValuedEnum;
-import org.apache.log.Logger;
/**
* This represents the *Context* in which a task can be executed.
@@ -30,7 +29,6 @@
//these are the names of properties that every TaskContext must contain
String JAVA_VERSION = "ant.java.version";
String BASE_DIRECTORY = "ant.base.directory";
- String LOGGER = "ant.logger";
String NAME = "ant.task.name";
/**
@@ -46,13 +44,6 @@
* @return the name
*/
String getName();
-
- /**
- * Retrieve Logger associated with task.
- *
- * @return the logger
- */
- Logger getLogger();
/**
* Retrieve base directory.
1.7 +46 -18
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DefaultTaskletEngine.java
Index: DefaultTaskletEngine.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DefaultTaskletEngine.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DefaultTaskletEngine.java 2000/12/11 00:33:40 1.6
+++ DefaultTaskletEngine.java 2000/12/12 11:43:36 1.7
@@ -14,6 +14,7 @@
import org.apache.ant.configuration.Configurer;
import org.apache.ant.configuration.DefaultConfigurer;
import org.apache.ant.convert.ConverterEngine;
+import org.apache.ant.datatypes.DataTypeEngine;
import org.apache.ant.tasklet.Tasklet;
import org.apache.ant.tasklet.TaskletContext;
import org.apache.avalon.Component;
@@ -23,13 +24,13 @@
import org.apache.avalon.Contextualizable;
import org.apache.avalon.DefaultComponentManager;
import org.apache.avalon.Disposable;
-import org.apache.avalon.Loggable;
import org.apache.avalon.Initializable;
+import org.apache.avalon.Loggable;
import org.apache.avalon.camelot.DefaultFactory;
+import org.apache.avalon.camelot.DefaultLocatorRegistry;
import org.apache.avalon.camelot.FactoryException;
-import org.apache.avalon.camelot.LocatorRegistry;
import org.apache.avalon.camelot.Locator;
-import org.apache.avalon.camelot.DefaultLocatorRegistry;
+import org.apache.avalon.camelot.LocatorRegistry;
import org.apache.avalon.camelot.RegistryException;
import org.apache.log.Logger;
@@ -41,6 +42,7 @@
protected LocatorRegistry m_locatorRegistry;
protected Configurer m_configurer;
protected Logger m_logger;
+ protected DataTypeEngine m_dataTypeEngine;
protected ConverterEngine m_converterEngine;
public void setLogger( final Logger logger )
@@ -58,27 +60,41 @@
return m_converterEngine;
}
- public LocatorRegistry getLocatorRegistry()
+ public LocatorRegistry getRegistry()
{
return m_locatorRegistry;
}
+ /**
+ * Retrieve datatype engine.
+ *
+ * @return the DataTypeEngine
+ */
+ public DataTypeEngine getDataTypeEngine()
+ {
+ return m_dataTypeEngine;
+ }
+
public void init()
throws Exception
{
- m_locatorRegistry = createLocatorRegistry();
- m_factory = createFactory();
- setupSubComponent( m_factory );
-
+ //converter must be created before configurerer
+ //so that it gets placed in configurers componentManager
m_converterEngine = createConverterEngine();
- m_converterEngine.setLogger( m_logger );
setupSubComponent( m_converterEngine );
m_configurer = createConfigurer();
setupSubComponent( m_configurer );
+ m_locatorRegistry = createLocatorRegistry();
+ m_factory = createFactory();
+ setupSubComponent( m_factory );
+
+ m_dataTypeEngine = createDataTypeEngine();
+ setupSubComponent( m_dataTypeEngine );
+
+
m_tskDeployer = createTskDeployer();
- m_tskDeployer.setLogger( m_logger );
setupSubComponent( m_tskDeployer );
}
@@ -93,10 +109,10 @@
if( component instanceof Composer )
{
final DefaultComponentManager componentManager = new
DefaultComponentManager();
- componentManager.put( "org.apache.ant.convert.Converter",
+ componentManager.put( "org.apache.ant.convert.Converter",
getConverterEngine() );
- componentManager.put( "org.apache.ant.convert.ConverterEngine",
- getConverterEngine() );
+ componentManager.put( "org.apache.ant.configuration.Configurer",
+ m_configurer );
componentManager.put(
"org.apache.ant.tasklet.engine.TaskletEngine",
this );
@@ -108,6 +124,13 @@
((Initializable)component).init();
}
}
+
+ protected DataTypeEngine createDataTypeEngine()
+ {
+ final TaskletDataTypeEngine engine = new TaskletDataTypeEngine();
+ engine.setFactory( m_factory );
+ return engine;
+ }
protected TskDeployer createTskDeployer()
{
@@ -143,9 +166,9 @@
final ComponentManager componentManager )
throws AntException
{
-
m_logger.debug( "Creating" );
- final Tasklet tasklet = createTasklet( task );
+ final Tasklet tasklet = createTasklet( task.getName() );
+ tasklet.setLogger( m_logger );
m_logger.debug( "Contextualizing" );
doContextualize( tasklet, task, context );
@@ -185,9 +208,15 @@
final ComponentManager componentManager )
throws AntException
{
+
+ final DefaultComponentManager subComponentManager =
+ new DefaultComponentManager( componentManager );
+
+ subComponentManager.put( "org.apache.ant.configuration.Configurer",
m_configurer );
+
if( tasklet instanceof Composer )
{
- try { ((Composer)tasklet).compose( componentManager ); }
+ try { ((Composer)tasklet).compose( subComponentManager ); }
catch( final Throwable throwable )
{
throw new AntException( "Error composing task " +
task.getName() + " at " +
@@ -244,10 +273,9 @@
}
}
- protected Tasklet createTasklet( final Configuration configuration )
+ protected Tasklet createTasklet( final String name )
throws AntException
{
- final String name = configuration.getName();
try
{
final Locator locator = m_locatorRegistry.getLocator( name );
1.3 +39 -7
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DefaultTskDeployer.java
Index: DefaultTskDeployer.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DefaultTskDeployer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultTskDeployer.java 2000/12/11 00:33:41 1.2
+++ DefaultTskDeployer.java 2000/12/12 11:43:36 1.3
@@ -45,6 +45,7 @@
{
protected final static String TSKDEF_FILE =
"TASK-LIB/taskdefs.xml";
+ protected LocatorRegistry m_dataTypeRegistry;
protected LocatorRegistry m_taskletRegistry;
protected LocatorRegistry m_converterRegistry;
protected ConverterRegistry m_converterInfoRegistry;
@@ -69,16 +70,17 @@
public void compose( final ComponentManager componentManager )
throws ComponentNotFoundException, ComponentNotAccessibleException
{
- final ConverterEngine converterEngine =
(ConverterEngine)componentManager.
- lookup( "org.apache.ant.convert.ConverterEngine" );
-
- m_converterInfoRegistry = converterEngine.getConverterRegistry();
- m_converterRegistry = converterEngine.getLocatorRegistry();
-
final TaskletEngine taskletEngine = (TaskletEngine)componentManager.
lookup( "org.apache.ant.tasklet.engine.TaskletEngine" );
+
+ final ConverterEngine converterEngine =
taskletEngine.getConverterEngine();
- m_taskletRegistry = taskletEngine.getLocatorRegistry();
+ m_converterInfoRegistry = converterEngine.getInfoRegistry();
+ m_converterRegistry = converterEngine.getRegistry();
+
+ m_taskletRegistry = taskletEngine.getRegistry();
+
+ m_dataTypeRegistry = taskletEngine.getDataTypeEngine().getRegistry();
}
public void setLogger( final Logger logger )
@@ -106,6 +108,13 @@
final Configuration converter =
(Configuration)converters.next();
handleConverter( converter, url );
}
+
+ final Iterator datatypes = taskdefs.getChildren( "datatype" );
+ while( datatypes.hasNext() )
+ {
+ final Configuration datatype =
(Configuration)datatypes.next();
+ handleDataType( datatype, url );
+ }
}
catch( final ConfigurationException ce )
{
@@ -138,6 +147,11 @@
throw new DeploymentException( "Malformed taskdefs.xml", ce );
}
}
+
+ public void deployDataType( final String name, final String location,
final URL url )
+ throws DeploymentException
+ {
+ }
public void deployTasklet( final String name, final String location,
final URL url )
throws DeploymentException
@@ -212,5 +226,23 @@
}
m_logger.debug( "Registered tasklet " + name + " as " + classname );
+ }
+
+ protected void handleDataType( final Configuration datatype, final URL
url )
+ throws DeploymentException, ConfigurationException
+ {
+ final String name = datatype.getAttribute( "name" );
+ final String classname = datatype.getAttribute( "classname" );
+
+ final DefaultLocator info = new DefaultLocator( classname, url );
+
+ try { m_dataTypeRegistry.register( name, info ); }
+ catch( final RegistryException re )
+ {
+ throw new DeploymentException( "Error registering " + name + "
due to " + re,
+ re );
+ }
+
+ m_logger.debug( "Registered datatype " + name + " as " + classname );
}
}
1.6 +10 -2
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/TaskletEngine.java
Index: TaskletEngine.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/TaskletEngine.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TaskletEngine.java 2000/12/11 00:33:41 1.5
+++ TaskletEngine.java 2000/12/12 11:43:36 1.6
@@ -10,10 +10,11 @@
import org.apache.ant.AntException;
import org.apache.ant.configuration.Configuration;
import org.apache.ant.convert.ConverterEngine;
+import org.apache.ant.datatypes.DataTypeEngine;
import org.apache.ant.tasklet.TaskletContext;
import org.apache.avalon.Component;
-import org.apache.avalon.Loggable;
import org.apache.avalon.ComponentManager;
+import org.apache.avalon.Loggable;
import org.apache.avalon.camelot.LocatorRegistry;
import org.apache.log.Logger;
@@ -37,7 +38,7 @@
*
* @return the LocatorRegistry
*/
- LocatorRegistry getLocatorRegistry();
+ LocatorRegistry getRegistry();
/**
* Retrieve converter engine.
@@ -46,6 +47,13 @@
*/
ConverterEngine getConverterEngine();
+ /**
+ * Retrieve datatype engine.
+ *
+ * @return the DataTypeEngine
+ */
+ DataTypeEngine getDataTypeEngine();
+
/**
* execute a task.
*
1.5 +4 -1
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/TskDeployer.java
Index: TskDeployer.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/TskDeployer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TskDeployer.java 2000/12/11 00:33:41 1.4
+++ TskDeployer.java 2000/12/12 11:43:37 1.5
@@ -23,7 +23,10 @@
{
void deployConverter( String name, String location, URL url )
throws DeploymentException;
-
+
+ void deployDataType( String name, String location, URL url )
+ throws DeploymentException;
+
void deployTasklet( String name, String location, URL url )
throws DeploymentException;
}
1.1
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/TaskletDataTypeEngine.java
Index: TaskletDataTypeEngine.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.ant.tasklet.engine;
import org.apache.ant.datatypes.DefaultDataTypeEngine;
import org.apache.avalon.camelot.DefaultFactory;
public class TaskletDataTypeEngine
extends DefaultDataTypeEngine
{
/**
* Set the DataTypeFactory.
* Package access intended.
*/
void setFactory( final DefaultFactory factory )
{
m_factory = factory;
}
protected DefaultFactory createFactory()
{
return m_factory;
}
}
1.2 +15 -4
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/AntCall.java
Index: AntCall.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/AntCall.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AntCall.java 2000/12/05 09:21:56 1.1
+++ AntCall.java 2000/12/12 11:43:41 1.2
@@ -15,6 +15,7 @@
import org.apache.ant.tasklet.DefaultTaskletContext;
import org.apache.ant.tasklet.TaskletContext;
import org.apache.avalon.ComponentManager;
+import org.apache.avalon.Context;
import org.apache.avalon.ComponentNotAccessibleException;
import org.apache.avalon.ComponentNotFoundException;
import org.apache.avalon.Composer;
@@ -32,10 +33,19 @@
protected Project m_project;
protected String m_target;
protected ArrayList m_properties = new ArrayList();
+ protected TaskletContext m_childContext;
+ protected ComponentManager m_componentManager;
+ public void contextualize( final Context context )
+ {
+ super.contextualize( context );
+ m_childContext = new DefaultTaskletContext( getContext() );
+ }
+
public void compose( final ComponentManager componentManager )
throws ComponentNotFoundException, ComponentNotAccessibleException
{
+ m_componentManager = componentManager;
m_projectEngine = (ProjectEngine)componentManager.
lookup( "org.apache.ant.project.ProjectEngine" );
m_project = (Project)componentManager.lookup(
"org.apache.ant.project.Project" );
@@ -47,8 +57,12 @@
}
public Property createParam()
+ throws Exception
{
final Property property = new Property();
+ property.setLogger( getLogger() );
+ property.contextualize( m_childContext );
+ property.compose( m_componentManager );
m_properties.add( property );
return property;
}
@@ -61,17 +75,14 @@
throw new AntException( "Target attribute must be specified" );
}
- final TaskletContext context = new DefaultTaskletContext(
getContext() );
-
final int size = m_properties.size();
for( int i = 0; i < size; i++ )
{
final Property property = (Property)m_properties.get( i );
- property.contextualize( context );
property.run();
}
getLogger().info( "Calling target " + m_target );
- m_projectEngine.execute( m_project, m_target, context );
+ m_projectEngine.execute( m_project, m_target, m_childContext );
}
}
1.2 +117 -3
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/Property.java
Index: Property.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/Property.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Property.java 2000/12/04 13:37:32 1.1
+++ Property.java 2000/12/12 11:43:41 1.2
@@ -7,27 +7,130 @@
*/
package org.apache.ant.tasks.core;
+import java.util.Iterator;
import org.apache.ant.AntException;
+import org.apache.ant.configuration.Configurable;
+import org.apache.ant.configuration.Configuration;
+import org.apache.ant.configuration.Configurer;
+import org.apache.ant.convert.Converter;
+import org.apache.ant.datatypes.DataType;
+import org.apache.ant.datatypes.DataTypeEngine;
import org.apache.ant.tasklet.AbstractTasklet;
import org.apache.ant.tasklet.TaskletContext;
+import org.apache.ant.tasklet.engine.TaskletEngine;
+import org.apache.avalon.ComponentManager;
+import org.apache.avalon.ComponentNotAccessibleException;
+import org.apache.avalon.ComponentNotFoundException;
+import org.apache.avalon.Composer;
+import org.apache.avalon.ConfigurationException;
+import org.apache.avalon.Resolvable;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
*/
public class Property
extends AbstractTasklet
+ implements Configurable, Composer
{
protected String m_name;
- protected String m_value;
+ protected Object m_value;
protected boolean m_localScope = true;
+ protected DataTypeEngine m_engine;
+ protected Converter m_converter;
+ protected Configurer m_configurer;
+
+ public void compose( final ComponentManager componentManager )
+ throws ComponentNotFoundException, ComponentNotAccessibleException
+ {
+ m_configurer = (Configurer)componentManager.
+ lookup( "org.apache.ant.configuration.Configurer" );
+
+ final TaskletEngine taskletEngine = (TaskletEngine)componentManager.
+ lookup( "org.apache.ant.tasklet.engine.TaskletEngine" );
+
+ m_engine = taskletEngine.getDataTypeEngine();
+ m_converter = taskletEngine.getConverterEngine();
+ }
+
+ public void configure( final Configuration configuration )
+ throws ConfigurationException
+ {
+ final Iterator attributes = configuration.getAttributeNames();
+
+ while( attributes.hasNext() )
+ {
+ final String name = (String)attributes.next();
+ final String value = configuration.getAttribute( name );
+
+ final Object object = getContext().resolveValue( value );
+
+ if( null == object )
+ {
+ throw new AntException( "Value for attribute " + name +
"resolved to null" );
+ }
+
+ if( name.equals( "name" ) )
+ {
+ try { setName( (String)m_converter.convert( String.class,
object ) ); }
+ catch( final Exception e )
+ {
+ throw new ConfigurationException( "Error converting
value", e );
+ }
+ }
+ else if( name.equals( "value" ) )
+ {
+ setValue( object );
+ }
+ else if( name.equals( "local-scope" ) )
+ {
+ try
+ {
+ final Boolean localScope =
+ (Boolean)m_converter.convert( Boolean.class, object
);
+ setLocalScope( Boolean.TRUE == localScope );
+ }
+ catch( final Exception e )
+ {
+ throw new ConfigurationException( "Error converting
value", e );
+ }
+ }
+ else
+ {
+ throw new ConfigurationException( "Unknown attribute " +
name );
+ }
+ }
+
+ final Iterator children = configuration.getChildren();
+ while( children.hasNext() )
+ {
+ final Configuration child = (Configuration)children.next();
+ try
+ {
+ final DataType value = m_engine.createDataType(
child.getName() );
+ setValue( value );
+ m_configurer.configure( value, child, getContext() );
+ }
+ catch( final Exception e )
+ {
+ throw new ConfigurationException( "Unable to set datatype",
e );
+ }
+ }
+ }
+
public void setName( final String name )
{
m_name = name;
}
- public void setValue( final String value )
+ public void setValue( final Object value )
+ throws AntException
{
+ if( null != m_value )
+ {
+ throw new AntException( "Value can not be set multiple times" );
+ }
+
m_value = value;
}
@@ -50,7 +153,18 @@
}
final TaskletContext context = getContext();
- final Object value = context.resolveValue( m_value );
+
+ Object value = m_value;
+
+ if( value instanceof String )
+ {
+ value = context.resolveValue( (String)value );
+ }
+
+ while( null != value && value instanceof Resolvable )
+ {
+ value = ((Resolvable)value).resolve( context );
+ }
if( m_localScope )
{
1.3 +2 -4
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterConverter.java
Index: RegisterConverter.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterConverter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RegisterConverter.java 2000/12/11 00:33:43 1.2
+++ RegisterConverter.java 2000/12/12 11:43:42 1.3
@@ -112,10 +112,8 @@
try
{
- m_engine.getConverterEngine().
- getConverterRegistry().register( m_classname, info );
- m_engine.getConverterEngine().
- getLocatorRegistry().register( m_classname, locator );
+ m_engine.getConverterEngine().getInfoRegistry().register(
m_classname, info );
+ m_engine.getConverterEngine().getRegistry().register(
m_classname, locator );
}
catch( final RegistryException re )
{
1.5 +1 -1
jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterTasklet.java
Index: RegisterTasklet.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterTasklet.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RegisterTasklet.java 2000/12/11 00:33:43 1.4
+++ RegisterTasklet.java 2000/12/12 11:43:42 1.5
@@ -37,7 +37,7 @@
else
{
final DefaultLocator locator = new DefaultLocator( classname,
url );
- m_engine.getLocatorRegistry().register( name, locator );
+ m_engine.getRegistry().register( name, locator );
}
}
}
1.4 +14 -7 jakarta-ant/proposal/myrmidon/src/make/sample.xmk
Index: sample.xmk
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/make/sample.xmk,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- sample.xmk 2000/12/06 06:11:28 1.3
+++ sample.xmk 2000/12/12 11:43:44 1.4
@@ -20,12 +20,13 @@
<target name="main" depends="property-test" />
- <!--
- ===================================================================
- Help on usage
- ===================================================================
- -->
- <target name="option-test">
+ <target name="no-test-target" unless="do-tests">
+ <echo message="No tests done here"/>
+ </target>
+
+ <target name="test-target" depends="no-test-target" if="do-tests">
+
+ <echo message="Tests away"/>
<prim-test
integer="1"
@@ -54,7 +55,7 @@
</target>
- <target name="property-test">
+ <target name="property-test" depends="test-target">
<property name="blah" value="fred" />
<property name="${blah}" value="barney" />
@@ -76,6 +77,12 @@
<ant-call target="property-test2">
<param name="blah" value="blah-value" />
</ant-call>
+
+ <property name="foo">
+ <pattern name="*.java"/>
+ </property>
+
+ <echo message="foo=${foo}" />
</target>
1.2 +2 -0 jakarta-ant/proposal/myrmidon/src/manifest/taskdefs.xml
Index: taskdefs.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/manifest/taskdefs.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- taskdefs.xml 2000/12/11 00:33:45 1.1
+++ taskdefs.xml 2000/12/12 11:43:45 1.2
@@ -9,6 +9,8 @@
<task name="register-converter"
classname="org.apache.ant.tasks.core.RegisterConverter" />
<task name="ant-call" classname="org.apache.ant.tasks.core.AntCall" />
+ <datatype name="pattern" classname="org.apache.ant.datatypes.Pattern" />
+
<converter classname="org.apache.ant.convert.core.StringToLongConverter"
source="java.lang.String"
destination="java.lang.Long" />