git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271703 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -8,6 +8,7 @@ | |||
| package org.apache.myrmidon.api; | |||
| import java.io.File; | |||
| import java.util.Map; | |||
| /** | |||
| * This interface represents the <em>Context</em> in which Task is executed. | |||
| @@ -19,7 +20,6 @@ import java.io.File; | |||
| * @version $Revision$ $Date$ | |||
| */ | |||
| public interface TaskContext | |||
| extends Context | |||
| { | |||
| //these are the names of properties that every TaskContext must contain | |||
| String BASE_DIRECTORY = "myrmidon.base.directory"; | |||
| @@ -32,6 +32,32 @@ public interface TaskContext | |||
| */ | |||
| String getName(); | |||
| /** | |||
| * Resolve a value according to the context. | |||
| * This involves evaluating the string and replacing | |||
| * ${} sequences with property values. | |||
| * | |||
| * @param value the value to resolve | |||
| * @return the resolved value | |||
| */ | |||
| Object resolveValue( String value ) | |||
| throws TaskException; | |||
| /** | |||
| * Retrieve property for name. | |||
| * | |||
| * @param name the name of property | |||
| * @return the value of property, or null if the property has no value. | |||
| */ | |||
| Object getProperty( String name ); | |||
| /** | |||
| * Retrieve a copy of all the properties accessible via context. | |||
| * | |||
| * @return the map of all property names to values | |||
| */ | |||
| Map getProperties(); | |||
| /** | |||
| * Retrieve a service that is offered by the runtime. | |||
| * The actual services registered and in place for the | |||
| @@ -22,7 +22,7 @@ import org.apache.avalon.framework.logger.LogEnabled; | |||
| import org.apache.avalon.framework.service.ServiceException; | |||
| import org.apache.avalon.framework.service.ServiceManager; | |||
| import org.apache.avalon.framework.service.Serviceable; | |||
| import org.apache.myrmidon.api.Context; | |||
| import org.apache.myrmidon.api.TaskContext; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.myrmidon.interfaces.configurer.Configurer; | |||
| @@ -66,7 +66,7 @@ public class ClassicConfigurer | |||
| */ | |||
| public void configure( final Object object, | |||
| final Configuration configuration, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| if( DEBUG ) | |||
| @@ -157,7 +157,7 @@ public class ClassicConfigurer | |||
| public void configure( final Object object, | |||
| final String name, | |||
| final String value, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| configureAttribute( object, name, value, context ); | |||
| @@ -173,7 +173,7 @@ public class ClassicConfigurer | |||
| */ | |||
| private void configureContent( final Object object, | |||
| final String content, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| setValue( object, "addContent", content, context ); | |||
| @@ -182,7 +182,7 @@ public class ClassicConfigurer | |||
| private void configureAttribute( final Object object, | |||
| final String name, | |||
| final String value, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| final String methodName = getMethodNameFor( name ); | |||
| @@ -192,7 +192,7 @@ public class ClassicConfigurer | |||
| private void setValue( final Object object, | |||
| final String methodName, | |||
| final String value, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| // OMFG the rest of this is soooooooooooooooooooooooooooooooo | |||
| @@ -212,7 +212,7 @@ public class ClassicConfigurer | |||
| private void setValue( final Object object, | |||
| final String value, | |||
| final Context context, | |||
| final TaskContext context, | |||
| final Method[] methods ) | |||
| throws ConfigurationException | |||
| { | |||
| @@ -232,7 +232,7 @@ public class ClassicConfigurer | |||
| private void setValue( final Object object, | |||
| Object value, | |||
| final Method[] methods, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| final Class sourceClass = value.getClass(); | |||
| @@ -254,7 +254,7 @@ public class ClassicConfigurer | |||
| private boolean setValue( final Object object, | |||
| final Object originalValue, | |||
| final Method method, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| Class parameterType = method.getParameterTypes()[ 0 ]; | |||
| @@ -433,7 +433,7 @@ public class ClassicConfigurer | |||
| private void configureElement( final Object object, | |||
| final Configuration configuration, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| final String name = configuration.getName(); | |||
| @@ -468,7 +468,7 @@ public class ClassicConfigurer | |||
| private void createElement( final Object object, | |||
| final Method method, | |||
| final Configuration configuration, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| try | |||
| @@ -490,7 +490,7 @@ public class ClassicConfigurer | |||
| private void addElement( final Object object, | |||
| final Method method, | |||
| final Configuration configuration, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| try | |||
| @@ -21,7 +21,7 @@ import org.apache.avalon.framework.logger.LogEnabled; | |||
| import org.apache.avalon.framework.service.ServiceException; | |||
| import org.apache.avalon.framework.service.ServiceManager; | |||
| import org.apache.avalon.framework.service.Serviceable; | |||
| import org.apache.myrmidon.api.Context; | |||
| import org.apache.myrmidon.api.TaskContext; | |||
| import org.apache.myrmidon.framework.DataType; | |||
| import org.apache.myrmidon.interfaces.configurer.Configurer; | |||
| import org.apache.myrmidon.interfaces.role.RoleInfo; | |||
| @@ -79,7 +79,7 @@ public class DefaultConfigurer | |||
| */ | |||
| public void configure( final Object object, | |||
| final Configuration configuration, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| try | |||
| @@ -110,7 +110,7 @@ public class DefaultConfigurer | |||
| */ | |||
| private void configureObject( final Object object, | |||
| final Configuration configuration, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws Exception | |||
| { | |||
| if( object instanceof Configurable ) | |||
| @@ -220,7 +220,7 @@ public class DefaultConfigurer | |||
| public void configure( final Object object, | |||
| final String name, | |||
| final String value, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws ConfigurationException | |||
| { | |||
| // Locate the configurer for this object | |||
| @@ -252,7 +252,7 @@ public class DefaultConfigurer | |||
| */ | |||
| private void setContent( final ConfigurationState state, | |||
| final String content, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws Exception | |||
| { | |||
| // Locate the content configurer | |||
| @@ -271,7 +271,7 @@ public class DefaultConfigurer | |||
| */ | |||
| private void configureElement( final ConfigurationState state, | |||
| final Configuration element, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws Exception | |||
| { | |||
| final String elementName = element.getName(); | |||
| @@ -292,7 +292,7 @@ public class DefaultConfigurer | |||
| */ | |||
| private void configureInline( final ConfigurationState state, | |||
| final Configuration element, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws Exception | |||
| { | |||
| final String name = element.getName(); | |||
| @@ -314,7 +314,7 @@ public class DefaultConfigurer | |||
| */ | |||
| private void configureReference( final ConfigurationState state, | |||
| final Configuration element, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws Exception | |||
| { | |||
| @@ -338,7 +338,7 @@ public class DefaultConfigurer | |||
| private void setReference( final ConfigurationState state, | |||
| final String refName, | |||
| final String unresolvedId, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws Exception | |||
| { | |||
| // Adjust the name | |||
| @@ -384,7 +384,7 @@ public class DefaultConfigurer | |||
| private void setAttribute( final ConfigurationState state, | |||
| final String name, | |||
| final String value, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws Exception | |||
| { | |||
| if( name.toLowerCase().endsWith( "-ref" ) ) | |||
| @@ -407,7 +407,7 @@ public class DefaultConfigurer | |||
| private void setValue( final PropertyConfigurer setter, | |||
| final ConfigurationState state, | |||
| final String value, | |||
| final Context context ) | |||
| final TaskContext context ) | |||
| throws Exception | |||
| { | |||
| // Resolve property references in the attribute value | |||
| @@ -445,7 +445,7 @@ public class DefaultConfigurer | |||
| */ | |||
| private Object setupChild( final ConfigurationState state, | |||
| final Configuration element, | |||
| final Context context, | |||
| final TaskContext context, | |||
| final PropertyConfigurer childConfigurer ) | |||
| throws Exception | |||
| { | |||
| @@ -9,7 +9,7 @@ package org.apache.myrmidon.components.workspace; | |||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | |||
| import org.apache.avalon.excalibur.i18n.Resources; | |||
| import org.apache.myrmidon.api.Context; | |||
| import org.apache.myrmidon.api.TaskContext; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| /** | |||
| @@ -38,7 +38,7 @@ public final class PropertyUtil | |||
| * @exception TaskException if an error occurs | |||
| */ | |||
| public static Object resolveProperty( final String property, | |||
| final Context context, | |||
| final TaskContext context, | |||
| final boolean ignoreUndefined ) | |||
| throws TaskException | |||
| { | |||
| @@ -99,7 +99,7 @@ public final class PropertyUtil | |||
| * @exception TaskException if an error occurs | |||
| */ | |||
| public static Object recursiveResolveProperty( final String property, | |||
| final Context context, | |||
| final TaskContext context, | |||
| final boolean ignoreUndefined ) | |||
| throws TaskException | |||
| { | |||
| @@ -219,7 +219,7 @@ public final class PropertyUtil | |||
| * @exception TaskException if an error occurs | |||
| */ | |||
| private static Object resolveValue( final String key, | |||
| final Context context, | |||
| final TaskContext context, | |||
| final boolean ignoreUndefined ) | |||
| throws TaskException | |||
| { | |||
| @@ -9,7 +9,7 @@ package org.apache.myrmidon.interfaces.configurer; | |||
| import org.apache.avalon.framework.configuration.Configuration; | |||
| import org.apache.avalon.framework.configuration.ConfigurationException; | |||
| import org.apache.myrmidon.api.Context; | |||
| import org.apache.myrmidon.api.TaskContext; | |||
| /** | |||
| * Class used to configure tasks. | |||
| @@ -32,7 +32,7 @@ public interface Configurer | |||
| * @param context the Context | |||
| * @exception ConfigurationException if an error occurs | |||
| */ | |||
| void configure( Object object, Configuration configuration, Context context ) | |||
| void configure( Object object, Configuration configuration, TaskContext context ) | |||
| throws ConfigurationException; | |||
| /** | |||
| @@ -46,6 +46,6 @@ public interface Configurer | |||
| * @param context the Context | |||
| * @exception ConfigurationException if an error occurs | |||
| */ | |||
| void configure( Object object, String name, String value, Context context ) | |||
| void configure( Object object, String name, String value, TaskContext context ) | |||
| throws ConfigurationException; | |||
| } | |||