git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270299 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -9,14 +9,14 @@ package org.apache.myrmidon; | |||||
| /** | /** | ||||
| * Abstract interface to hold constants. | * Abstract interface to hold constants. | ||||
| * | |||||
| * | |||||
| * @author <a href="mailto:peter@apache.org">Peter Donald</a> | * @author <a href="mailto:peter@apache.org">Peter Donald</a> | ||||
| */ | */ | ||||
| public interface Constants | public interface Constants | ||||
| { | { | ||||
| //Constants to indicate the build of Myrmidon | //Constants to indicate the build of Myrmidon | ||||
| String BUILD_DATE = "@@DATE@@"; | |||||
| String BUILD_VERSION = "@@VERSION@@"; | |||||
| String BUILD_DATE = "@@DATE@@"; | |||||
| String BUILD_VERSION = "@@VERSION@@"; | |||||
| String BUILD_DESCRIPTION = "Myrmidon " + BUILD_VERSION + " compiled on " + BUILD_DATE; | |||||
| String BUILD_DESCRIPTION = "Myrmidon " + BUILD_VERSION + " compiled on " + BUILD_DATE; | |||||
| } | } | ||||
| @@ -119,8 +119,8 @@ public abstract class AbstractTask | |||||
| } | } | ||||
| protected final void setProperty( final String name, | protected final void setProperty( final String name, | ||||
| final Object value, | |||||
| final TaskContext.ScopeEnum scope ) | |||||
| final Object value, | |||||
| final TaskContext.ScopeEnum scope ) | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| getContext().setProperty( name, value, scope ); | getContext().setProperty( name, value, scope ); | ||||
| @@ -18,10 +18,10 @@ public final class JavaVersion | |||||
| extends ValuedEnum | extends ValuedEnum | ||||
| { | { | ||||
| //standard enums for version of JVM | //standard enums for version of JVM | ||||
| public final static JavaVersion JAVA1_0 = new JavaVersion( "Java 1.0", 100 ); | |||||
| public final static JavaVersion JAVA1_1 = new JavaVersion( "Java 1.1", 110 ); | |||||
| public final static JavaVersion JAVA1_2 = new JavaVersion( "Java 1.2", 120 ); | |||||
| public final static JavaVersion JAVA1_3 = new JavaVersion( "Java 1.3", 130 ); | |||||
| public final static JavaVersion JAVA1_0 = new JavaVersion( "Java 1.0", 100 ); | |||||
| public final static JavaVersion JAVA1_1 = new JavaVersion( "Java 1.1", 110 ); | |||||
| public final static JavaVersion JAVA1_2 = new JavaVersion( "Java 1.2", 120 ); | |||||
| public final static JavaVersion JAVA1_3 = new JavaVersion( "Java 1.3", 130 ); | |||||
| /** | /** | ||||
| * Private constructor so no instance except here can be defined. | * Private constructor so no instance except here can be defined. | ||||
| @@ -9,8 +9,8 @@ package org.apache.myrmidon.api; | |||||
| /** | /** | ||||
| * This is the interface that tasks implement to be executed in Myrmidon runtime. | * This is the interface that tasks implement to be executed in Myrmidon runtime. | ||||
| * | |||||
| * Instances can also implement the Avalon lifecycle methods | |||||
| * | |||||
| * Instances can also implement the Avalon lifecycle methods | |||||
| * LogEnabled, Contextualizable, Composable, Initializable and Disposable. | * LogEnabled, Contextualizable, Composable, Initializable and Disposable. | ||||
| * Each of these lifecycle stages will be executed at appropriate time. | * Each of these lifecycle stages will be executed at appropriate time. | ||||
| * | * | ||||
| @@ -28,7 +28,7 @@ public interface Task | |||||
| String ROLE = "org.apache.myrmidon.api.Task"; | String ROLE = "org.apache.myrmidon.api.Task"; | ||||
| /** | /** | ||||
| * Execute task. | |||||
| * Execute task. | |||||
| * This method is called to perform actual work associated with task. | * This method is called to perform actual work associated with task. | ||||
| * It is called after Task has been Configured and Initialized and before | * It is called after Task has been Configured and Initialized and before | ||||
| * being Disposed (If task implements appropriate interfaces). | * being Disposed (If task implements appropriate interfaces). | ||||
| @@ -8,8 +8,8 @@ | |||||
| package org.apache.myrmidon.aspects; | package org.apache.myrmidon.aspects; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.parameters.Parameters; | |||||
| import org.apache.avalon.framework.logger.Logger; | import org.apache.avalon.framework.logger.Logger; | ||||
| import org.apache.avalon.framework.parameters.Parameters; | |||||
| import org.apache.myrmidon.api.Task; | import org.apache.myrmidon.api.Task; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| @@ -22,12 +22,12 @@ import org.apache.myrmidon.api.TaskException; | |||||
| public abstract class AbstractAspectHandler | public abstract class AbstractAspectHandler | ||||
| implements AspectHandler | implements AspectHandler | ||||
| { | { | ||||
| private Parameters m_aspectParameters; | |||||
| private Configuration[] m_aspectElements; | |||||
| private Parameters m_aspectParameters; | |||||
| private Configuration[] m_aspectElements; | |||||
| private Task m_task; | |||||
| private Logger m_logger; | |||||
| private Configuration m_taskModel; | |||||
| private Task m_task; | |||||
| private Logger m_logger; | |||||
| private Configuration m_taskModel; | |||||
| public Configuration preCreate( final Configuration taskModel ) | public Configuration preCreate( final Configuration taskModel ) | ||||
| throws TaskException | throws TaskException | ||||
| @@ -8,8 +8,8 @@ | |||||
| package org.apache.myrmidon.aspects; | package org.apache.myrmidon.aspects; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.parameters.Parameters; | |||||
| import org.apache.avalon.framework.logger.Logger; | import org.apache.avalon.framework.logger.Logger; | ||||
| import org.apache.avalon.framework.parameters.Parameters; | |||||
| import org.apache.myrmidon.api.Task; | import org.apache.myrmidon.api.Task; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| @@ -13,13 +13,8 @@ import java.util.Properties; | |||||
| import javax.xml.parsers.SAXParser; | import javax.xml.parsers.SAXParser; | ||||
| import javax.xml.parsers.SAXParserFactory; | import javax.xml.parsers.SAXParserFactory; | ||||
| import javax.xml.transform.Transformer; | import javax.xml.transform.Transformer; | ||||
| import javax.xml.transform.TransformerConfigurationException; | |||||
| import javax.xml.transform.TransformerFactory; | import javax.xml.transform.TransformerFactory; | ||||
| import javax.xml.transform.sax.SAXResult; | import javax.xml.transform.sax.SAXResult; | ||||
| import javax.xml.transform.sax.SAXSource; | |||||
| import javax.xml.transform.sax.SAXTransformerFactory; | |||||
| import javax.xml.transform.sax.TransformerHandler; | |||||
| import javax.xml.transform.stream.StreamResult; | |||||
| import javax.xml.transform.stream.StreamSource; | import javax.xml.transform.stream.StreamSource; | ||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| @@ -41,8 +36,8 @@ public class ATIProjectBuilder | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( ATIProjectBuilder.class ); | ResourceManager.getPackageResources( ATIProjectBuilder.class ); | ||||
| private Parameters m_parameters; | |||||
| private URL m_systemID; | |||||
| private Parameters m_parameters; | |||||
| private URL m_systemID; | |||||
| public void parameterize( final Parameters parameters ) | public void parameterize( final Parameters parameters ) | ||||
| { | { | ||||
| @@ -62,7 +57,10 @@ public class ATIProjectBuilder | |||||
| final ReactorPIHandler reactorHandler = new ReactorPIHandler(); | final ReactorPIHandler reactorHandler = new ReactorPIHandler(); | ||||
| reader.setContentHandler( reactorHandler ); | reader.setContentHandler( reactorHandler ); | ||||
| try { reader.parse( sourceID.toString() ); } | |||||
| try | |||||
| { | |||||
| reader.parse( sourceID.toString() ); | |||||
| } | |||||
| catch( final StopParsingException spe ) | catch( final StopParsingException spe ) | ||||
| { | { | ||||
| //Ignore me | //Ignore me | ||||
| @@ -76,8 +74,10 @@ public class ATIProjectBuilder | |||||
| final String target = reactorHandler.getTarget( i ); | final String target = reactorHandler.getTarget( i ); | ||||
| final String data = reactorHandler.getData( i ); | final String data = reactorHandler.getData( i ); | ||||
| if( target.equals( "xsl-param" ) ) handleParameter( data ); | |||||
| else if( target.equals( "xsl-params" ) ) handleParameters( data, sourceID ); | |||||
| if( target.equals( "xsl-param" ) ) | |||||
| handleParameter( data ); | |||||
| else if( target.equals( "xsl-params" ) ) | |||||
| handleParameters( data, sourceID ); | |||||
| else if( target.equals( "xsl-stylesheet" ) ) | else if( target.equals( "xsl-stylesheet" ) ) | ||||
| { | { | ||||
| if( null != transformer ) | if( null != transformer ) | ||||
| @@ -180,7 +180,10 @@ public class ATIProjectBuilder | |||||
| throw new SAXException( message ); | throw new SAXException( message ); | ||||
| } | } | ||||
| try { return new URL( baseSource, stylesheet[ 1 ] ).toString(); } | |||||
| try | |||||
| { | |||||
| return new URL( baseSource, stylesheet[ 1 ] ).toString(); | |||||
| } | |||||
| catch( final Exception e ) | catch( final Exception e ) | ||||
| { | { | ||||
| final String message = | final String message = | ||||
| @@ -8,7 +8,6 @@ | |||||
| package org.apache.myrmidon.components.builder; | package org.apache.myrmidon.components.builder; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| @@ -16,22 +15,16 @@ import javax.xml.parsers.SAXParser; | |||||
| import javax.xml.parsers.SAXParserFactory; | import javax.xml.parsers.SAXParserFactory; | ||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.excalibur.util.StringUtil; | |||||
| import org.apache.avalon.framework.ExceptionUtil; | import org.apache.avalon.framework.ExceptionUtil; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.configuration.ConfigurationException; | |||||
| import org.apache.avalon.framework.configuration.SAXConfigurationHandler; | import org.apache.avalon.framework.configuration.SAXConfigurationHandler; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | import org.apache.avalon.framework.logger.AbstractLogEnabled; | ||||
| import org.apache.avalon.framework.parameters.Parameters; | |||||
| import org.apache.log.Logger; | |||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.myrmidon.components.model.DefaultProject; | import org.apache.myrmidon.components.model.DefaultProject; | ||||
| import org.apache.myrmidon.framework.Condition; | import org.apache.myrmidon.framework.Condition; | ||||
| import org.apache.myrmidon.interfaces.builder.ProjectBuilder; | import org.apache.myrmidon.interfaces.builder.ProjectBuilder; | ||||
| import org.apache.myrmidon.interfaces.model.Project; | import org.apache.myrmidon.interfaces.model.Project; | ||||
| import org.apache.myrmidon.interfaces.model.Target; | import org.apache.myrmidon.interfaces.model.Target; | ||||
| import org.apache.myrmidon.interfaces.model.TypeLib; | import org.apache.myrmidon.interfaces.model.TypeLib; | ||||
| import org.xml.sax.SAXException; | |||||
| import org.xml.sax.XMLReader; | import org.xml.sax.XMLReader; | ||||
| /** | /** | ||||
| @@ -46,10 +39,10 @@ public class DefaultProjectBuilder | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( DefaultProjectBuilder.class ); | ResourceManager.getPackageResources( DefaultProjectBuilder.class ); | ||||
| private final static int PROJECT_REFERENCES = 0; | |||||
| private final static int LIBRARY_IMPORTS = 1; | |||||
| private final static int IMPLICIT_TASKS = 2; | |||||
| private final static int TARGETS = 3; | |||||
| private final static int PROJECT_REFERENCES = 0; | |||||
| private final static int LIBRARY_IMPORTS = 1; | |||||
| private final static int IMPLICIT_TASKS = 2; | |||||
| private final static int TARGETS = 3; | |||||
| /** | /** | ||||
| * build a project from file. | * build a project from file. | ||||
| @@ -135,7 +128,7 @@ public class DefaultProjectBuilder | |||||
| //determine base directory for project | //determine base directory for project | ||||
| final File baseDirectory = | final File baseDirectory = | ||||
| (new File( file.getParentFile(), baseDirectoryName )).getAbsoluteFile(); | |||||
| ( new File( file.getParentFile(), baseDirectoryName ) ).getAbsoluteFile(); | |||||
| if( getLogger().isDebugEnabled() ) | if( getLogger().isDebugEnabled() ) | ||||
| { | { | ||||
| @@ -214,7 +207,8 @@ public class DefaultProjectBuilder | |||||
| } | } | ||||
| } | } | ||||
| if( name.equals( "target" ) ) buildTarget( project, element ); | |||||
| if( name.equals( "target" ) ) | |||||
| buildTarget( project, element ); | |||||
| else | else | ||||
| { | { | ||||
| final String message = | final String message = | ||||
| @@ -406,7 +400,9 @@ public class DefaultProjectBuilder | |||||
| protected boolean validName( final String name ) | protected boolean validName( final String name ) | ||||
| { | { | ||||
| if( -1 != name.indexOf( "->" ) ) return false; | |||||
| else return true; | |||||
| if( -1 != name.indexOf( "->" ) ) | |||||
| return false; | |||||
| else | |||||
| return true; | |||||
| } | } | ||||
| } | } | ||||
| @@ -22,8 +22,8 @@ import org.xml.sax.helpers.DefaultHandler; | |||||
| public class ReactorPIHandler | public class ReactorPIHandler | ||||
| extends DefaultHandler | extends DefaultHandler | ||||
| { | { | ||||
| private ArrayList m_targets = new ArrayList(); | |||||
| private ArrayList m_data = new ArrayList(); | |||||
| private ArrayList m_targets = new ArrayList(); | |||||
| private ArrayList m_data = new ArrayList(); | |||||
| public int getPICount() | public int getPICount() | ||||
| { | { | ||||
| @@ -46,7 +46,7 @@ public class ReactorPIHandler | |||||
| m_targets.add( target ); | m_targets.add( target ); | ||||
| m_data.add( data ); | m_data.add( data ); | ||||
| } | } | ||||
| public void startElement( final String uri, | public void startElement( final String uri, | ||||
| final String localName, | final String localName, | ||||
| final String qName, | final String qName, | ||||
| @@ -92,7 +92,7 @@ public class DefaultConfigurer | |||||
| getLogger().debug( "Configuring object via Configurable interface" ); | getLogger().debug( "Configuring object via Configurable interface" ); | ||||
| } | } | ||||
| ((Configurable)object).configure( configuration ); | |||||
| ( (Configurable)object ).configure( configuration ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -317,14 +317,22 @@ public class DefaultConfigurer | |||||
| private Class getComplexTypeFor( final Class clazz ) | private Class getComplexTypeFor( final Class clazz ) | ||||
| { | { | ||||
| if( String.class == clazz ) return String.class; | |||||
| else if( Integer.TYPE.equals( clazz ) ) return Integer.class; | |||||
| else if( Long.TYPE.equals( clazz ) ) return Long.class; | |||||
| else if( Short.TYPE.equals( clazz ) ) return Short.class; | |||||
| else if( Byte.TYPE.equals( clazz ) ) return Byte.class; | |||||
| else if( Boolean.TYPE.equals( clazz ) ) return Boolean.class; | |||||
| else if( Float.TYPE.equals( clazz ) ) return Float.class; | |||||
| else if( Double.TYPE.equals( clazz ) ) return Double.class; | |||||
| if( String.class == clazz ) | |||||
| return String.class; | |||||
| else if( Integer.TYPE.equals( clazz ) ) | |||||
| return Integer.class; | |||||
| else if( Long.TYPE.equals( clazz ) ) | |||||
| return Long.class; | |||||
| else if( Short.TYPE.equals( clazz ) ) | |||||
| return Short.class; | |||||
| else if( Byte.TYPE.equals( clazz ) ) | |||||
| return Byte.class; | |||||
| else if( Boolean.TYPE.equals( clazz ) ) | |||||
| return Boolean.class; | |||||
| else if( Float.TYPE.equals( clazz ) ) | |||||
| return Float.class; | |||||
| else if( Double.TYPE.equals( clazz ) ) | |||||
| return Double.class; | |||||
| else | else | ||||
| { | { | ||||
| final String message = REZ.getString( "no-complex-type.error", clazz.getName() ); | final String message = REZ.getString( "no-complex-type.error", clazz.getName() ); | ||||
| @@ -341,7 +349,7 @@ public class DefaultConfigurer | |||||
| { | { | ||||
| final Method method = methods[ i ]; | final Method method = methods[ i ]; | ||||
| if( methodName.equals( method.getName() ) && | if( methodName.equals( method.getName() ) && | ||||
| Method.PUBLIC == (method.getModifiers() & Method.PUBLIC) ) | |||||
| Method.PUBLIC == ( method.getModifiers() & Method.PUBLIC ) ) | |||||
| { | { | ||||
| if( method.getReturnType().equals( Void.TYPE ) ) | if( method.getReturnType().equals( Void.TYPE ) ) | ||||
| { | { | ||||
| @@ -366,7 +374,7 @@ public class DefaultConfigurer | |||||
| { | { | ||||
| final Method method = methods[ i ]; | final Method method = methods[ i ]; | ||||
| if( methodName.equals( method.getName() ) && | if( methodName.equals( method.getName() ) && | ||||
| Method.PUBLIC == (method.getModifiers() & Method.PUBLIC) ) | |||||
| Method.PUBLIC == ( method.getModifiers() & Method.PUBLIC ) ) | |||||
| { | { | ||||
| final Class returnType = method.getReturnType(); | final Class returnType = method.getReturnType(); | ||||
| if( !returnType.equals( Void.TYPE ) && | if( !returnType.equals( Void.TYPE ) && | ||||
| @@ -18,7 +18,7 @@ import org.apache.myrmidon.interfaces.converter.ConverterRegistry; | |||||
| public class DefaultConverterRegistry | public class DefaultConverterRegistry | ||||
| implements ConverterRegistry | implements ConverterRegistry | ||||
| { | { | ||||
| private final HashMap m_mapping = new HashMap(); | |||||
| private final HashMap m_mapping = new HashMap(); | |||||
| public String getConverterName( final String source, final String destination ) | public String getConverterName( final String source, final String destination ) | ||||
| { | { | ||||
| @@ -27,8 +27,8 @@ public class DefaultConverterRegistry | |||||
| return (String)map.get( destination ); | return (String)map.get( destination ); | ||||
| } | } | ||||
| public void registerConverter( final String className, | |||||
| final String source, | |||||
| public void registerConverter( final String className, | |||||
| final String source, | |||||
| final String destination ) | final String destination ) | ||||
| { | { | ||||
| HashMap map = (HashMap)m_mapping.get( source ); | HashMap map = (HashMap)m_mapping.get( source ); | ||||
| @@ -7,20 +7,20 @@ | |||||
| */ | */ | ||||
| package org.apache.myrmidon.components.converter; | package org.apache.myrmidon.components.converter; | ||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
| import org.apache.avalon.excalibur.i18n.Resources; | |||||
| import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
| import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
| import org.apache.avalon.framework.component.Composable; | import org.apache.avalon.framework.component.Composable; | ||||
| import org.apache.avalon.framework.context.Context; | import org.apache.avalon.framework.context.Context; | ||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
| import org.apache.avalon.excalibur.i18n.Resources; | |||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | import org.apache.avalon.framework.logger.AbstractLogEnabled; | ||||
| import org.apache.myrmidon.interfaces.converter.MasterConverter; | |||||
| import org.apache.myrmidon.converter.Converter; | |||||
| import org.apache.myrmidon.converter.ConverterException; | |||||
| import org.apache.myrmidon.interfaces.converter.ConverterRegistry; | import org.apache.myrmidon.interfaces.converter.ConverterRegistry; | ||||
| import org.apache.myrmidon.interfaces.converter.MasterConverter; | |||||
| import org.apache.myrmidon.interfaces.type.TypeException; | import org.apache.myrmidon.interfaces.type.TypeException; | ||||
| import org.apache.myrmidon.interfaces.type.TypeFactory; | import org.apache.myrmidon.interfaces.type.TypeFactory; | ||||
| import org.apache.myrmidon.interfaces.type.TypeManager; | import org.apache.myrmidon.interfaces.type.TypeManager; | ||||
| import org.apache.myrmidon.converter.Converter; | |||||
| import org.apache.myrmidon.converter.ConverterException; | |||||
| /** | /** | ||||
| * Converter engine to handle converting between types. | * Converter engine to handle converting between types. | ||||
| @@ -34,10 +34,10 @@ public class DefaultMasterConverter | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( DefaultMasterConverter.class ); | ResourceManager.getPackageResources( DefaultMasterConverter.class ); | ||||
| private final static boolean DEBUG = false; | |||||
| private final static boolean DEBUG = false; | |||||
| private ConverterRegistry m_registry; | |||||
| private TypeFactory m_factory; | |||||
| private ConverterRegistry m_registry; | |||||
| private TypeFactory m_factory; | |||||
| /** | /** | ||||
| * Retrieve relevent services needed to deploy. | * Retrieve relevent services needed to deploy. | ||||
| @@ -51,7 +51,10 @@ public class DefaultMasterConverter | |||||
| m_registry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.ROLE ); | m_registry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.ROLE ); | ||||
| final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE ); | final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE ); | ||||
| try { m_factory = typeManager.getFactory( Converter.ROLE ); } | |||||
| try | |||||
| { | |||||
| m_factory = typeManager.getFactory( Converter.ROLE ); | |||||
| } | |||||
| catch( final TypeException te ) | catch( final TypeException te ) | ||||
| { | { | ||||
| final String message = REZ.getString( "no-converter-factory.error" ); | final String message = REZ.getString( "no-converter-factory.error" ); | ||||
| @@ -80,9 +83,9 @@ public class DefaultMasterConverter | |||||
| if( DEBUG ) | if( DEBUG ) | ||||
| { | { | ||||
| final String message = | |||||
| REZ.getString( "converter-lookup.notice", | |||||
| originalClass.getName(), | |||||
| final String message = | |||||
| REZ.getString( "converter-lookup.notice", | |||||
| originalClass.getName(), | |||||
| destination.getName() ); | destination.getName() ); | ||||
| getLogger().debug( message ); | getLogger().debug( message ); | ||||
| } | } | ||||
| @@ -93,9 +96,9 @@ public class DefaultMasterConverter | |||||
| if( null == name ) | if( null == name ) | ||||
| { | { | ||||
| final String message = | |||||
| REZ.getString( "no-converter.notice", | |||||
| originalClass.getName(), | |||||
| final String message = | |||||
| REZ.getString( "no-converter.notice", | |||||
| originalClass.getName(), | |||||
| destination.getName() ); | destination.getName() ); | ||||
| throw new ConverterException( message ); | throw new ConverterException( message ); | ||||
| } | } | ||||
| @@ -8,31 +8,30 @@ | |||||
| package org.apache.myrmidon.components.deployer; | package org.apache.myrmidon.components.deployer; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.net.URL; | |||||
| import java.net.JarURLConnection; | |||||
| import java.net.MalformedURLException; | import java.net.MalformedURLException; | ||||
| import java.net.URL; | |||||
| import java.net.URLClassLoader; | import java.net.URLClassLoader; | ||||
| import java.net.JarURLConnection; | |||||
| import java.util.Arrays; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Arrays; | |||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.jar.Manifest; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.jar.Manifest; | |||||
| import javax.xml.parsers.SAXParser; | import javax.xml.parsers.SAXParser; | ||||
| import javax.xml.parsers.SAXParserFactory; | import javax.xml.parsers.SAXParserFactory; | ||||
| import org.apache.avalon.excalibur.extension.PackageManager; | |||||
| import org.apache.avalon.excalibur.extension.OptionalPackage; | |||||
| import org.apache.avalon.excalibur.extension.Extension; | import org.apache.avalon.excalibur.extension.Extension; | ||||
| import org.apache.avalon.excalibur.extension.OptionalPackage; | |||||
| import org.apache.avalon.excalibur.extension.PackageManager; | |||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.framework.activity.Initializable; | import org.apache.avalon.framework.activity.Initializable; | ||||
| import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
| import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
| import org.apache.avalon.framework.component.Composable; | import org.apache.avalon.framework.component.Composable; | ||||
| import org.apache.avalon.framework.configuration.SAXConfigurationHandler; | |||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.configuration.ConfigurationException; | import org.apache.avalon.framework.configuration.ConfigurationException; | ||||
| import org.apache.avalon.framework.configuration.SAXConfigurationHandler; | |||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | import org.apache.avalon.framework.logger.AbstractLogEnabled; | ||||
| import org.apache.myrmidon.api.Task; | |||||
| import org.apache.myrmidon.converter.Converter; | import org.apache.myrmidon.converter.Converter; | ||||
| import org.apache.myrmidon.interfaces.converter.ConverterRegistry; | import org.apache.myrmidon.interfaces.converter.ConverterRegistry; | ||||
| import org.apache.myrmidon.interfaces.deployer.Deployer; | import org.apache.myrmidon.interfaces.deployer.Deployer; | ||||
| @@ -41,7 +40,6 @@ import org.apache.myrmidon.interfaces.extensions.ExtensionManager; | |||||
| import org.apache.myrmidon.interfaces.role.RoleManager; | import org.apache.myrmidon.interfaces.role.RoleManager; | ||||
| import org.apache.myrmidon.interfaces.type.DefaultTypeFactory; | import org.apache.myrmidon.interfaces.type.DefaultTypeFactory; | ||||
| import org.apache.myrmidon.interfaces.type.TypeManager; | import org.apache.myrmidon.interfaces.type.TypeManager; | ||||
| import org.xml.sax.SAXException; | |||||
| import org.xml.sax.XMLReader; | import org.xml.sax.XMLReader; | ||||
| /** | /** | ||||
| @@ -58,10 +56,10 @@ public class DefaultDeployer | |||||
| private final static String TYPE_DESCRIPTOR = "META-INF/ant-types.xml"; | private final static String TYPE_DESCRIPTOR = "META-INF/ant-types.xml"; | ||||
| private ConverterRegistry m_converterRegistry; | |||||
| private TypeManager m_typeManager; | |||||
| private RoleManager m_roleManager; | |||||
| private PackageManager m_packageManager; | |||||
| private ConverterRegistry m_converterRegistry; | |||||
| private TypeManager m_typeManager; | |||||
| private RoleManager m_roleManager; | |||||
| private PackageManager m_packageManager; | |||||
| /** | /** | ||||
| * Retrieve relevent services needed to deploy. | * Retrieve relevent services needed to deploy. | ||||
| @@ -126,7 +124,7 @@ public class DefaultDeployer | |||||
| final URL[] urls = buildClasspath( file, extensions ); | final URL[] urls = buildClasspath( file, extensions ); | ||||
| final Deployment deployment = new Deployment( file ); | final Deployment deployment = new Deployment( file ); | ||||
| final Configuration descriptor = deployment.getDescriptor(); | final Configuration descriptor = deployment.getDescriptor(); | ||||
| final URLClassLoader classLoader = | final URLClassLoader classLoader = | ||||
| new URLClassLoader( urls, Thread.currentThread().getContextClassLoader() ); | new URLClassLoader( urls, Thread.currentThread().getContextClassLoader() ); | ||||
| @@ -218,7 +216,7 @@ public class DefaultDeployer | |||||
| throws MalformedURLException | throws MalformedURLException | ||||
| { | { | ||||
| final URL[] urls = new URL[ dependencies.length + 1 ]; | final URL[] urls = new URL[ dependencies.length + 1 ]; | ||||
| for( int i = 0; i < dependencies.length; i++ ) | for( int i = 0; i < dependencies.length; i++ ) | ||||
| { | { | ||||
| urls[ i ] = dependencies[ i ].toURL(); | urls[ i ] = dependencies[ i ].toURL(); | ||||
| @@ -247,10 +245,10 @@ public class DefaultDeployer | |||||
| if( getLogger().isDebugEnabled() ) | if( getLogger().isDebugEnabled() ) | ||||
| { | { | ||||
| final String message1 = | |||||
| final String message1 = | |||||
| REZ.getString( "available-extensions", Arrays.asList( available ) ); | REZ.getString( "available-extensions", Arrays.asList( available ) ); | ||||
| getLogger().debug( message1 ); | getLogger().debug( message1 ); | ||||
| final String message2 = | |||||
| final String message2 = | |||||
| REZ.getString( "required-extensions", Arrays.asList( required ) ); | REZ.getString( "required-extensions", Arrays.asList( required ) ); | ||||
| getLogger().debug( message2 ); | getLogger().debug( message2 ); | ||||
| } | } | ||||
| @@ -271,12 +269,12 @@ public class DefaultDeployer | |||||
| final Extension extension = (Extension)unsatisfied.get( i ); | final Extension extension = (Extension)unsatisfied.get( i ); | ||||
| final Object[] params = new Object[] | final Object[] params = new Object[] | ||||
| { | { | ||||
| extension.getExtensionName(), | |||||
| extension.getSpecificationVendor(), | |||||
| extension.getExtensionName(), | |||||
| extension.getSpecificationVendor(), | |||||
| extension.getSpecificationVersion(), | extension.getSpecificationVersion(), | ||||
| extension.getImplementationVendor(), | |||||
| extension.getImplementationVendor(), | |||||
| extension.getImplementationVendorId(), | extension.getImplementationVendorId(), | ||||
| extension.getImplementationVersion(), | |||||
| extension.getImplementationVersion(), | |||||
| extension.getImplementationURL() | extension.getImplementationURL() | ||||
| }; | }; | ||||
| final String message = REZ.format( "missing.extension", params ); | final String message = REZ.format( "missing.extension", params ); | ||||
| @@ -9,7 +9,6 @@ package org.apache.myrmidon.components.deployer; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.net.MalformedURLException; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import javax.xml.parsers.ParserConfigurationException; | import javax.xml.parsers.ParserConfigurationException; | ||||
| import javax.xml.parsers.SAXParser; | import javax.xml.parsers.SAXParser; | ||||
| @@ -17,11 +16,10 @@ import javax.xml.parsers.SAXParserFactory; | |||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.configuration.ConfigurationException; | |||||
| import org.apache.avalon.framework.configuration.SAXConfigurationHandler; | import org.apache.avalon.framework.configuration.SAXConfigurationHandler; | ||||
| import org.apache.myrmidon.interfaces.deployer.DeploymentException; | |||||
| import org.xml.sax.SAXException; | import org.xml.sax.SAXException; | ||||
| import org.xml.sax.XMLReader; | import org.xml.sax.XMLReader; | ||||
| import org.apache.myrmidon.interfaces.deployer.DeploymentException; | |||||
| /** | /** | ||||
| * This class deploys a .tsk file into a registry. | * This class deploys a .tsk file into a registry. | ||||
| @@ -33,17 +31,17 @@ public class Deployment | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( Deployment.class ); | ResourceManager.getPackageResources( Deployment.class ); | ||||
| public final static String DESCRIPTOR_NAME = "META-INF/ant-descriptor.xml"; | |||||
| public final static String DESCRIPTOR_NAME = "META-INF/ant-descriptor.xml"; | |||||
| private File m_file; | |||||
| private File m_file; | |||||
| private Configuration m_descriptor; | |||||
| private Configuration m_descriptor; | |||||
| public Deployment( final File file ) | public Deployment( final File file ) | ||||
| { | { | ||||
| m_file = file; | m_file = file; | ||||
| } | } | ||||
| public Configuration getDescriptor() | public Configuration getDescriptor() | ||||
| throws DeploymentException | throws DeploymentException | ||||
| { | { | ||||
| @@ -58,7 +56,10 @@ public class Deployment | |||||
| public URL getURL() | public URL getURL() | ||||
| throws DeploymentException | throws DeploymentException | ||||
| { | { | ||||
| try { return m_file.getCanonicalFile().toURL(); } | |||||
| try | |||||
| { | |||||
| return m_file.getCanonicalFile().toURL(); | |||||
| } | |||||
| catch( final IOException ioe ) | catch( final IOException ioe ) | ||||
| { | { | ||||
| final String message = REZ.getString( "bad-url.error", m_file ); | final String message = REZ.getString( "bad-url.error", m_file ); | ||||
| @@ -9,7 +9,6 @@ package org.apache.myrmidon.components.embeddor; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.FilenameFilter; | import java.io.FilenameFilter; | ||||
| import java.util.Map; | |||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.excalibur.io.ExtensionFileFilter; | import org.apache.avalon.excalibur.io.ExtensionFileFilter; | ||||
| @@ -29,9 +28,9 @@ import org.apache.myrmidon.interfaces.converter.ConverterRegistry; | |||||
| import org.apache.myrmidon.interfaces.converter.MasterConverter; | import org.apache.myrmidon.interfaces.converter.MasterConverter; | ||||
| import org.apache.myrmidon.interfaces.deployer.Deployer; | import org.apache.myrmidon.interfaces.deployer.Deployer; | ||||
| import org.apache.myrmidon.interfaces.deployer.DeploymentException; | import org.apache.myrmidon.interfaces.deployer.DeploymentException; | ||||
| import org.apache.myrmidon.interfaces.embeddor.Embeddor; | |||||
| import org.apache.myrmidon.interfaces.executor.Executor; | import org.apache.myrmidon.interfaces.executor.Executor; | ||||
| import org.apache.myrmidon.interfaces.extensions.ExtensionManager; | import org.apache.myrmidon.interfaces.extensions.ExtensionManager; | ||||
| import org.apache.myrmidon.interfaces.embeddor.Embeddor; | |||||
| import org.apache.myrmidon.interfaces.model.Project; | import org.apache.myrmidon.interfaces.model.Project; | ||||
| import org.apache.myrmidon.interfaces.role.RoleManager; | import org.apache.myrmidon.interfaces.role.RoleManager; | ||||
| import org.apache.myrmidon.interfaces.type.TypeFactory; | import org.apache.myrmidon.interfaces.type.TypeFactory; | ||||
| @@ -51,26 +50,26 @@ public class DefaultEmbeddor | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( DefaultEmbeddor.class ); | ResourceManager.getPackageResources( DefaultEmbeddor.class ); | ||||
| private Deployer m_deployer; | |||||
| private RoleManager m_roleManager; | |||||
| private Deployer m_deployer; | |||||
| private RoleManager m_roleManager; | |||||
| private AspectManager m_aspectManager; | |||||
| private TypeManager m_typeManager; | |||||
| private MasterConverter m_converter; | |||||
| private ConverterRegistry m_converterRegistry; | |||||
| private ExtensionManager m_extensionManager; | |||||
| private AspectManager m_aspectManager; | |||||
| private TypeManager m_typeManager; | |||||
| private MasterConverter m_converter; | |||||
| private ConverterRegistry m_converterRegistry; | |||||
| private ExtensionManager m_extensionManager; | |||||
| private Executor m_executor; | |||||
| private Configurer m_configurer; | |||||
| private Executor m_executor; | |||||
| private Configurer m_configurer; | |||||
| private DefaultComponentManager m_componentManager; | |||||
| private Parameters m_parameters; | |||||
| private Parameters m_defaults; | |||||
| private DefaultComponentManager m_componentManager; | |||||
| private Parameters m_parameters; | |||||
| private Parameters m_defaults; | |||||
| private File m_homeDir; | |||||
| private File m_binDir; | |||||
| private File m_libDir; | |||||
| private File m_taskLibDir; | |||||
| private File m_homeDir; | |||||
| private File m_binDir; | |||||
| private File m_libDir; | |||||
| private File m_taskLibDir; | |||||
| /** | /** | ||||
| * Setup basic properties of engine. | * Setup basic properties of engine. | ||||
| @@ -114,17 +113,17 @@ public class DefaultEmbeddor | |||||
| if( builder instanceof Composable ) | if( builder instanceof Composable ) | ||||
| { | { | ||||
| ((Composable)builder).compose( m_componentManager ); | |||||
| ( (Composable)builder ).compose( m_componentManager ); | |||||
| } | } | ||||
| if( builder instanceof Parameterizable ) | if( builder instanceof Parameterizable ) | ||||
| { | { | ||||
| ((Parameterizable)builder).parameterize( parameters ); | |||||
| ( (Parameterizable)builder ).parameterize( parameters ); | |||||
| } | } | ||||
| if( builder instanceof Initializable ) | if( builder instanceof Initializable ) | ||||
| { | { | ||||
| ((Initializable)builder).initialize(); | |||||
| ( (Initializable)builder ).initialize(); | |||||
| } | } | ||||
| return builder; | return builder; | ||||
| @@ -139,20 +138,19 @@ public class DefaultEmbeddor | |||||
| setupLogger( workspace ); | setupLogger( workspace ); | ||||
| if( workspace instanceof Composable ) | if( workspace instanceof Composable ) | ||||
| { | { | ||||
| ((Composable)workspace).compose( m_componentManager ); | |||||
| ( (Composable)workspace ).compose( m_componentManager ); | |||||
| } | } | ||||
| if( workspace instanceof Parameterizable ) | if( workspace instanceof Parameterizable ) | ||||
| { | { | ||||
| ((Parameterizable)workspace).parameterize( parameters ); | |||||
| ( (Parameterizable)workspace ).parameterize( parameters ); | |||||
| } | } | ||||
| if( workspace instanceof Initializable ) | if( workspace instanceof Initializable ) | ||||
| { | { | ||||
| ((Initializable)workspace).initialize(); | |||||
| ( (Initializable)workspace ).initialize(); | |||||
| } | } | ||||
| return workspace; | return workspace; | ||||
| @@ -350,17 +348,17 @@ public class DefaultEmbeddor | |||||
| if( component instanceof Composable ) | if( component instanceof Composable ) | ||||
| { | { | ||||
| ((Composable)component).compose( m_componentManager ); | |||||
| ( (Composable)component ).compose( m_componentManager ); | |||||
| } | } | ||||
| if( component instanceof Parameterizable ) | if( component instanceof Parameterizable ) | ||||
| { | { | ||||
| ((Parameterizable)component).parameterize( m_parameters ); | |||||
| ( (Parameterizable)component ).parameterize( m_parameters ); | |||||
| } | } | ||||
| if( component instanceof Initializable ) | if( component instanceof Initializable ) | ||||
| { | { | ||||
| ((Initializable)component).initialize(); | |||||
| ( (Initializable)component ).initialize(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -373,7 +371,7 @@ public class DefaultEmbeddor | |||||
| String filepath = null; | String filepath = null; | ||||
| filepath = getParameter( "myrmidon.home" ); | filepath = getParameter( "myrmidon.home" ); | ||||
| m_homeDir = (new File( filepath )).getAbsoluteFile(); | |||||
| m_homeDir = ( new File( filepath ) ).getAbsoluteFile(); | |||||
| checkDirectory( m_homeDir, "home" ); | checkDirectory( m_homeDir, "home" ); | ||||
| filepath = getParameter( "myrmidon.bin.path" ); | filepath = getParameter( "myrmidon.bin.path" ); | ||||
| @@ -457,7 +455,9 @@ public class DefaultEmbeddor | |||||
| Class.forName( "java.lang.StrictMath" ); | Class.forName( "java.lang.StrictMath" ); | ||||
| version = JavaVersion.JAVA1_3; | version = JavaVersion.JAVA1_3; | ||||
| } | } | ||||
| catch( final ClassNotFoundException cnfe ) {} | |||||
| catch( final ClassNotFoundException cnfe ) | |||||
| { | |||||
| } | |||||
| return version; | return version; | ||||
| } | } | ||||
| @@ -14,15 +14,12 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||||
| import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
| import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.configuration.DefaultConfiguration; | |||||
| import org.apache.avalon.framework.configuration.DefaultConfigurationSerializer; | |||||
| import org.apache.avalon.framework.configuration.ConfigurationException; | import org.apache.avalon.framework.configuration.ConfigurationException; | ||||
| import org.apache.avalon.framework.parameters.Parameters; | |||||
| import org.apache.avalon.framework.configuration.DefaultConfiguration; | |||||
| import org.apache.avalon.framework.logger.Logger; | import org.apache.avalon.framework.logger.Logger; | ||||
| import org.apache.avalon.framework.parameters.Parameters; | |||||
| import org.apache.myrmidon.api.Task; | import org.apache.myrmidon.api.Task; | ||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.aspects.AspectHandler; | |||||
| import org.apache.myrmidon.interfaces.aspect.AspectManager; | import org.apache.myrmidon.interfaces.aspect.AspectManager; | ||||
| import org.apache.myrmidon.interfaces.executor.ExecutionFrame; | import org.apache.myrmidon.interfaces.executor.ExecutionFrame; | ||||
| @@ -32,8 +29,8 @@ public class AspectAwareExecutor | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( AspectAwareExecutor.class ); | ResourceManager.getPackageResources( AspectAwareExecutor.class ); | ||||
| private final static Parameters EMPTY_PARAMETERS; | |||||
| private final static Configuration[] EMPTY_ELEMENTS = new Configuration[ 0 ]; | |||||
| private final static Parameters EMPTY_PARAMETERS; | |||||
| private final static Configuration[] EMPTY_ELEMENTS = new Configuration[ 0 ]; | |||||
| static | static | ||||
| { | { | ||||
| @@ -41,7 +38,7 @@ public class AspectAwareExecutor | |||||
| EMPTY_PARAMETERS.makeReadOnly(); | EMPTY_PARAMETERS.makeReadOnly(); | ||||
| } | } | ||||
| private AspectManager m_aspectManager; | |||||
| private AspectManager m_aspectManager; | |||||
| /** | /** | ||||
| * Retrieve relevent services. | * Retrieve relevent services. | ||||
| @@ -158,7 +155,8 @@ public class AspectAwareExecutor | |||||
| if( null == parameters ) parameters = EMPTY_PARAMETERS; | if( null == parameters ) parameters = EMPTY_PARAMETERS; | ||||
| Configuration[] elements = null; | Configuration[] elements = null; | ||||
| if( null == elementList ) elements = EMPTY_ELEMENTS; | |||||
| if( null == elementList ) | |||||
| elements = EMPTY_ELEMENTS; | |||||
| else | else | ||||
| { | { | ||||
| elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | ||||
| @@ -185,7 +183,8 @@ public class AspectAwareExecutor | |||||
| Configuration[] elements = null; | Configuration[] elements = null; | ||||
| if( null == elementList ) elements = EMPTY_ELEMENTS; | |||||
| if( null == elementList ) | |||||
| elements = EMPTY_ELEMENTS; | |||||
| else | else | ||||
| { | { | ||||
| elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | ||||
| @@ -10,21 +10,12 @@ package org.apache.myrmidon.components.executor; | |||||
| import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
| import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
| import org.apache.avalon.framework.component.Composable; | import org.apache.avalon.framework.component.Composable; | ||||
| import org.apache.avalon.framework.component.DefaultComponentManager; | |||||
| import org.apache.avalon.framework.context.Context; | import org.apache.avalon.framework.context.Context; | ||||
| import org.apache.avalon.framework.context.Contextualizable; | import org.apache.avalon.framework.context.Contextualizable; | ||||
| import org.apache.avalon.framework.logger.LogEnabled; | import org.apache.avalon.framework.logger.LogEnabled; | ||||
| import org.apache.avalon.framework.logger.Logger; | import org.apache.avalon.framework.logger.Logger; | ||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.myrmidon.interfaces.aspect.AspectManager; | |||||
| import org.apache.myrmidon.interfaces.builder.ProjectBuilder; | |||||
| import org.apache.myrmidon.interfaces.configurer.Configurer; | |||||
| import org.apache.myrmidon.interfaces.converter.ConverterRegistry; | |||||
| import org.apache.myrmidon.interfaces.converter.MasterConverter; | |||||
| import org.apache.myrmidon.interfaces.deployer.Deployer; | |||||
| import org.apache.myrmidon.interfaces.executor.Executor; | |||||
| import org.apache.myrmidon.interfaces.executor.ExecutionFrame; | import org.apache.myrmidon.interfaces.executor.ExecutionFrame; | ||||
| import org.apache.myrmidon.interfaces.role.RoleManager; | |||||
| import org.apache.myrmidon.interfaces.type.TypeManager; | import org.apache.myrmidon.interfaces.type.TypeManager; | ||||
| /** | /** | ||||
| @@ -35,11 +26,11 @@ import org.apache.myrmidon.interfaces.type.TypeManager; | |||||
| public class DefaultExecutionFrame | public class DefaultExecutionFrame | ||||
| implements ExecutionFrame, LogEnabled, Contextualizable, Composable | implements ExecutionFrame, LogEnabled, Contextualizable, Composable | ||||
| { | { | ||||
| private TypeManager m_typeManager; | |||||
| private TypeManager m_typeManager; | |||||
| private Logger m_logger; | |||||
| private TaskContext m_context; | |||||
| private ComponentManager m_componentManager; | |||||
| private Logger m_logger; | |||||
| private TaskContext m_context; | |||||
| private ComponentManager m_componentManager; | |||||
| public void enableLogging( final Logger logger ) | public void enableLogging( final Logger logger ) | ||||
| { | { | ||||
| @@ -11,14 +11,10 @@ import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.framework.activity.Disposable; | import org.apache.avalon.framework.activity.Disposable; | ||||
| import org.apache.avalon.framework.activity.Initializable; | import org.apache.avalon.framework.activity.Initializable; | ||||
| import org.apache.avalon.framework.component.Component; | |||||
| import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
| import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
| import org.apache.avalon.framework.component.Composable; | import org.apache.avalon.framework.component.Composable; | ||||
| import org.apache.avalon.framework.component.DefaultComponentManager; | |||||
| import org.apache.avalon.framework.configuration.Configurable; | |||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.context.Context; | |||||
| import org.apache.avalon.framework.context.Contextualizable; | import org.apache.avalon.framework.context.Contextualizable; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | import org.apache.avalon.framework.logger.AbstractLogEnabled; | ||||
| import org.apache.avalon.framework.logger.LogEnabled; | import org.apache.avalon.framework.logger.LogEnabled; | ||||
| @@ -26,13 +22,11 @@ import org.apache.avalon.framework.logger.Logger; | |||||
| import org.apache.myrmidon.api.Task; | import org.apache.myrmidon.api.Task; | ||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.interfaces.configurer.Configurer; | import org.apache.myrmidon.interfaces.configurer.Configurer; | ||||
| import org.apache.myrmidon.interfaces.executor.ExecutionFrame; | import org.apache.myrmidon.interfaces.executor.ExecutionFrame; | ||||
| import org.apache.myrmidon.interfaces.executor.Executor; | import org.apache.myrmidon.interfaces.executor.Executor; | ||||
| import org.apache.myrmidon.interfaces.type.TypeException; | import org.apache.myrmidon.interfaces.type.TypeException; | ||||
| import org.apache.myrmidon.interfaces.type.TypeFactory; | import org.apache.myrmidon.interfaces.type.TypeFactory; | ||||
| import org.apache.myrmidon.interfaces.type.TypeManager; | |||||
| public class DefaultExecutor | public class DefaultExecutor | ||||
| extends AbstractLogEnabled | extends AbstractLogEnabled | ||||
| @@ -41,7 +35,7 @@ public class DefaultExecutor | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( DefaultExecutor.class ); | ResourceManager.getPackageResources( DefaultExecutor.class ); | ||||
| private Configurer m_configurer; | |||||
| private Configurer m_configurer; | |||||
| /** | /** | ||||
| * Retrieve relevent services needed to deploy. | * Retrieve relevent services needed to deploy. | ||||
| @@ -112,7 +106,10 @@ public class DefaultExecutor | |||||
| final TaskContext context ) | final TaskContext context ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| try { m_configurer.configure( task, taskModel, context ); } | |||||
| try | |||||
| { | |||||
| m_configurer.configure( task, taskModel, context ); | |||||
| } | |||||
| catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
| { | { | ||||
| final String message = | final String message = | ||||
| @@ -131,7 +128,10 @@ public class DefaultExecutor | |||||
| { | { | ||||
| if( task instanceof Composable ) | if( task instanceof Composable ) | ||||
| { | { | ||||
| try { ((Composable)task).compose( componentManager ); } | |||||
| try | |||||
| { | |||||
| ( (Composable)task ).compose( componentManager ); | |||||
| } | |||||
| catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
| { | { | ||||
| final String message = | final String message = | ||||
| @@ -153,7 +153,7 @@ public class DefaultExecutor | |||||
| { | { | ||||
| if( task instanceof Contextualizable ) | if( task instanceof Contextualizable ) | ||||
| { | { | ||||
| ((Contextualizable)task).contextualize( context ); | |||||
| ( (Contextualizable)task ).contextualize( context ); | |||||
| } | } | ||||
| } | } | ||||
| catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
| @@ -172,7 +172,10 @@ public class DefaultExecutor | |||||
| { | { | ||||
| if( task instanceof Disposable ) | if( task instanceof Disposable ) | ||||
| { | { | ||||
| try { ((Disposable)task).dispose(); } | |||||
| try | |||||
| { | |||||
| ( (Disposable)task ).dispose(); | |||||
| } | |||||
| catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
| { | { | ||||
| final String message = | final String message = | ||||
| @@ -192,7 +195,10 @@ public class DefaultExecutor | |||||
| { | { | ||||
| if( task instanceof LogEnabled ) | if( task instanceof LogEnabled ) | ||||
| { | { | ||||
| try { ((LogEnabled)task).enableLogging( logger ); } | |||||
| try | |||||
| { | |||||
| ( (LogEnabled)task ).enableLogging( logger ); | |||||
| } | |||||
| catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
| { | { | ||||
| final String message = | final String message = | ||||
| @@ -210,7 +216,10 @@ public class DefaultExecutor | |||||
| { | { | ||||
| if( task instanceof Initializable ) | if( task instanceof Initializable ) | ||||
| { | { | ||||
| try { ((Initializable)task).initialize(); } | |||||
| try | |||||
| { | |||||
| ( (Initializable)task ).initialize(); | |||||
| } | |||||
| catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
| { | { | ||||
| final String message = | final String message = | ||||
| @@ -7,9 +7,9 @@ | |||||
| */ | */ | ||||
| package org.apache.myrmidon.components.executor; | package org.apache.myrmidon.components.executor; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | |||||
| import org.apache.myrmidon.api.Task; | import org.apache.myrmidon.api.Task; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | |||||
| public class PrintingExecutor | public class PrintingExecutor | ||||
| extends AspectAwareExecutor | extends AspectAwareExecutor | ||||
| @@ -19,23 +19,22 @@ public class PrintingExecutor | |||||
| { | { | ||||
| final StringBuffer sb = new StringBuffer(); | final StringBuffer sb = new StringBuffer(); | ||||
| printConfiguration( taskModel, 0, sb ); | printConfiguration( taskModel, 0, sb ); | ||||
| System.out.println( sb.toString() ); | System.out.println( sb.toString() ); | ||||
| } | } | ||||
| private void printConfiguration( final Configuration taskModel, | |||||
| final int level, | |||||
| private void printConfiguration( final Configuration taskModel, | |||||
| final int level, | |||||
| final StringBuffer sb ) | final StringBuffer sb ) | ||||
| { | { | ||||
| for( int i = 0; i < level; i++ ) | for( int i = 0; i < level; i++ ) | ||||
| { | { | ||||
| sb.append( ' ' ); | sb.append( ' ' ); | ||||
| } | } | ||||
| sb.append( '<' ); | sb.append( '<' ); | ||||
| sb.append( taskModel.getName() ); | sb.append( taskModel.getName() ); | ||||
| final String[] names = taskModel.getAttributeNames(); | final String[] names = taskModel.getAttributeNames(); | ||||
| for( int i = 0; i < names.length; i++ ) | for( int i = 0; i < names.length; i++ ) | ||||
| { | { | ||||
| @@ -8,7 +8,6 @@ | |||||
| package org.apache.myrmidon.components.model; | package org.apache.myrmidon.components.model; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| @@ -29,22 +28,22 @@ public class DefaultProject | |||||
| ResourceManager.getPackageResources( DefaultProject.class ); | ResourceManager.getPackageResources( DefaultProject.class ); | ||||
| ///The imports | ///The imports | ||||
| private final ArrayList m_imports = new ArrayList(); | |||||
| private final ArrayList m_imports = new ArrayList(); | |||||
| ///The projects refferred to by this project | ///The projects refferred to by this project | ||||
| private final HashMap m_projects = new HashMap(); | |||||
| private final HashMap m_projects = new HashMap(); | |||||
| ///The targets contained by this project | ///The targets contained by this project | ||||
| private final HashMap m_targets = new HashMap(); | |||||
| private final HashMap m_targets = new HashMap(); | |||||
| ///The implicit target (not present in m_targets) | ///The implicit target (not present in m_targets) | ||||
| private Target m_implicitTarget; | |||||
| private Target m_implicitTarget; | |||||
| ///The name of the default target | ///The name of the default target | ||||
| private String m_defaultTarget; | |||||
| private String m_defaultTarget; | |||||
| ///The base directory of project | ///The base directory of project | ||||
| private File m_baseDirectory; | |||||
| private File m_baseDirectory; | |||||
| /** | /** | ||||
| * Get the imports for project. | * Get the imports for project. | ||||
| @@ -19,7 +19,6 @@ import org.apache.avalon.framework.configuration.Configuration; | |||||
| import org.apache.avalon.framework.configuration.ConfigurationException; | import org.apache.avalon.framework.configuration.ConfigurationException; | ||||
| import org.apache.avalon.framework.configuration.SAXConfigurationHandler; | import org.apache.avalon.framework.configuration.SAXConfigurationHandler; | ||||
| import org.apache.myrmidon.interfaces.role.RoleManager; | import org.apache.myrmidon.interfaces.role.RoleManager; | ||||
| import org.xml.sax.SAXException; | |||||
| import org.xml.sax.XMLReader; | import org.xml.sax.XMLReader; | ||||
| /** | /** | ||||
| @@ -37,13 +36,13 @@ public class DefaultRoleManager | |||||
| private final static String ROLE_DESCRIPTOR = "META-INF/ant-roles.xml"; | private final static String ROLE_DESCRIPTOR = "META-INF/ant-roles.xml"; | ||||
| /** Parent <code>RoleManager</code> for nested resolution */ | /** Parent <code>RoleManager</code> for nested resolution */ | ||||
| private final RoleManager m_parent; | |||||
| private final RoleManager m_parent; | |||||
| /** Map for name to role mapping */ | /** Map for name to role mapping */ | ||||
| private final HashMap m_names = new HashMap(); | |||||
| private final HashMap m_names = new HashMap(); | |||||
| /** Map for role to name mapping */ | /** Map for role to name mapping */ | ||||
| private final HashMap m_roles = new HashMap(); | |||||
| private final HashMap m_roles = new HashMap(); | |||||
| /** | /** | ||||
| * constructor--this RoleManager has no parent. | * constructor--this RoleManager has no parent. | ||||
| @@ -10,9 +10,9 @@ package org.apache.myrmidon.components.type; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.myrmidon.interfaces.type.TypeException; | |||||
| import org.apache.myrmidon.interfaces.type.TypeFactory; | import org.apache.myrmidon.interfaces.type.TypeFactory; | ||||
| import org.apache.myrmidon.interfaces.type.TypeManager; | import org.apache.myrmidon.interfaces.type.TypeManager; | ||||
| import org.apache.myrmidon.interfaces.type.TypeException; | |||||
| /** | /** | ||||
| * The interface that is used to manage types. | * The interface that is used to manage types. | ||||
| @@ -26,10 +26,10 @@ public class DefaultTypeManager | |||||
| ResourceManager.getPackageResources( DefaultTypeManager.class ); | ResourceManager.getPackageResources( DefaultTypeManager.class ); | ||||
| ///Parent type manager to inherit values from. | ///Parent type manager to inherit values from. | ||||
| private final DefaultTypeManager m_parent; | |||||
| private final DefaultTypeManager m_parent; | |||||
| ///Maps role to MultiSourceTypeFactory. | ///Maps role to MultiSourceTypeFactory. | ||||
| private final HashMap m_roleMap = new HashMap(); | |||||
| private final HashMap m_roleMap = new HashMap(); | |||||
| public DefaultTypeManager() | public DefaultTypeManager() | ||||
| { | { | ||||
| @@ -41,9 +41,9 @@ public class DefaultTypeManager | |||||
| m_parent = parent; | m_parent = parent; | ||||
| } | } | ||||
| public void registerType( final String role, | |||||
| final String shorthandName, | |||||
| final TypeFactory factory ) | |||||
| public void registerType( final String role, | |||||
| final String shorthandName, | |||||
| final TypeFactory factory ) | |||||
| throws TypeException | throws TypeException | ||||
| { | { | ||||
| final MultiSourceTypeFactory msFactory = createFactory( role ); | final MultiSourceTypeFactory msFactory = createFactory( role ); | ||||
| @@ -72,18 +72,18 @@ public class DefaultTypeManager | |||||
| * | * | ||||
| * @param role the role name(must be name of work interface) | * @param role the role name(must be name of work interface) | ||||
| * @return the Factory for interface | * @return the Factory for interface | ||||
| * @exception TypeException role does not specify accessible work interface | |||||
| * @exception TypeException role does not specify accessible work interface | |||||
| */ | */ | ||||
| private MultiSourceTypeFactory createFactory( final String role ) | private MultiSourceTypeFactory createFactory( final String role ) | ||||
| throws TypeException | throws TypeException | ||||
| { | { | ||||
| MultiSourceTypeFactory factory = (MultiSourceTypeFactory)m_roleMap.get( role ); | MultiSourceTypeFactory factory = (MultiSourceTypeFactory)m_roleMap.get( role ); | ||||
| if( null != factory ) | |||||
| if( null != factory ) | |||||
| { | { | ||||
| return factory; | return factory; | ||||
| } | } | ||||
| final MultiSourceTypeFactory parentFactory = getParentTypedFactory( role ); | |||||
| final MultiSourceTypeFactory parentFactory = getParentTypedFactory( role ); | |||||
| if( null != parentFactory ) | if( null != parentFactory ) | ||||
| { | { | ||||
| factory = new MultiSourceTypeFactory( parentFactory ); | factory = new MultiSourceTypeFactory( parentFactory ); | ||||
| @@ -103,7 +103,7 @@ public class DefaultTypeManager | |||||
| final String message = REZ.getString( "no-work-interface.error", role ); | final String message = REZ.getString( "no-work-interface.error", role ); | ||||
| throw new TypeException( message ); | throw new TypeException( message ); | ||||
| } | } | ||||
| } | |||||
| } | |||||
| m_roleMap.put( role, factory ); | m_roleMap.put( role, factory ); | ||||
| @@ -117,7 +117,7 @@ public class DefaultTypeManager | |||||
| return m_parent.lookupFactory( role ); | return m_parent.lookupFactory( role ); | ||||
| } | } | ||||
| else | else | ||||
| { | |||||
| { | |||||
| return null; | return null; | ||||
| } | } | ||||
| } | } | ||||
| @@ -10,8 +10,8 @@ package org.apache.myrmidon.components.type; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.myrmidon.interfaces.type.TypeFactory; | |||||
| import org.apache.myrmidon.interfaces.type.TypeException; | import org.apache.myrmidon.interfaces.type.TypeException; | ||||
| import org.apache.myrmidon.interfaces.type.TypeFactory; | |||||
| /** | /** | ||||
| * This factory acts as a proxy to set of object factorys. | * This factory acts as a proxy to set of object factorys. | ||||
| @@ -25,13 +25,13 @@ public class MultiSourceTypeFactory | |||||
| ResourceManager.getPackageResources( MultiSourceTypeFactory.class ); | ResourceManager.getPackageResources( MultiSourceTypeFactory.class ); | ||||
| ///Parent Selector | ///Parent Selector | ||||
| private final MultiSourceTypeFactory m_parent; | |||||
| private final MultiSourceTypeFactory m_parent; | |||||
| ///Map of name->factory list | ///Map of name->factory list | ||||
| private final HashMap m_factorys = new HashMap(); | |||||
| private final HashMap m_factorys = new HashMap(); | |||||
| ///Type expected to be created from factorys | ///Type expected to be created from factorys | ||||
| private final Class m_type; | |||||
| private final Class m_type; | |||||
| public MultiSourceTypeFactory( final Class type ) | public MultiSourceTypeFactory( final Class type ) | ||||
| { | { | ||||
| @@ -12,8 +12,6 @@ import java.util.Map; | |||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.avalon.excalibur.property.PropertyException; | |||||
| import org.apache.avalon.excalibur.property.PropertyUtil; | |||||
| import org.apache.avalon.framework.context.ContextException; | import org.apache.avalon.framework.context.ContextException; | ||||
| import org.apache.avalon.framework.context.DefaultContext; | import org.apache.avalon.framework.context.DefaultContext; | ||||
| import org.apache.myrmidon.api.JavaVersion; | import org.apache.myrmidon.api.JavaVersion; | ||||
| @@ -63,7 +61,10 @@ public class DefaultTaskContext | |||||
| */ | */ | ||||
| public JavaVersion getJavaVersion() | public JavaVersion getJavaVersion() | ||||
| { | { | ||||
| try { return (JavaVersion)get( JAVA_VERSION ); } | |||||
| try | |||||
| { | |||||
| return (JavaVersion)get( JAVA_VERSION ); | |||||
| } | |||||
| catch( final ContextException ce ) | catch( final ContextException ce ) | ||||
| { | { | ||||
| final String message = REZ.getString( "no-version.error" ); | final String message = REZ.getString( "no-version.error" ); | ||||
| @@ -71,7 +72,6 @@ public class DefaultTaskContext | |||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Retrieve Name of tasklet. | * Retrieve Name of tasklet. | ||||
| * | * | ||||
| @@ -79,7 +79,10 @@ public class DefaultTaskContext | |||||
| */ | */ | ||||
| public String getName() | public String getName() | ||||
| { | { | ||||
| try { return (String)get( NAME ); } | |||||
| try | |||||
| { | |||||
| return (String)get( NAME ); | |||||
| } | |||||
| catch( final ContextException ce ) | catch( final ContextException ce ) | ||||
| { | { | ||||
| final String message = REZ.getString( "no-name.error" ); | final String message = REZ.getString( "no-name.error" ); | ||||
| @@ -94,7 +97,10 @@ public class DefaultTaskContext | |||||
| */ | */ | ||||
| public File getBaseDirectory() | public File getBaseDirectory() | ||||
| { | { | ||||
| try { return (File)get( BASE_DIRECTORY ); } | |||||
| try | |||||
| { | |||||
| return (File)get( BASE_DIRECTORY ); | |||||
| } | |||||
| catch( final ContextException ce ) | catch( final ContextException ce ) | ||||
| { | { | ||||
| final String message = REZ.getString( "no-dir.error" ); | final String message = REZ.getString( "no-dir.error" ); | ||||
| @@ -125,7 +131,10 @@ public class DefaultTaskContext | |||||
| */ | */ | ||||
| public Object getProperty( final String name ) | public Object getProperty( final String name ) | ||||
| { | { | ||||
| try { return get( name ); } | |||||
| try | |||||
| { | |||||
| return get( name ); | |||||
| } | |||||
| catch( final ContextException ce ) | catch( final ContextException ce ) | ||||
| { | { | ||||
| return null; | return null; | ||||
| @@ -154,7 +163,8 @@ public class DefaultTaskContext | |||||
| { | { | ||||
| checkPropertyValid( name, value ); | checkPropertyValid( name, value ); | ||||
| if( CURRENT == scope ) put( name, value ); | |||||
| if( CURRENT == scope ) | |||||
| put( name, value ); | |||||
| else if( PARENT == scope ) | else if( PARENT == scope ) | ||||
| { | { | ||||
| if( null == getParent() ) | if( null == getParent() ) | ||||
| @@ -164,7 +174,7 @@ public class DefaultTaskContext | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| ((TaskContext)getParent()).setProperty( name, value ); | |||||
| ( (TaskContext)getParent() ).setProperty( name, value ); | |||||
| } | } | ||||
| } | } | ||||
| else if( TOP_LEVEL == scope ) | else if( TOP_LEVEL == scope ) | ||||
| @@ -217,19 +227,19 @@ public class DefaultTaskContext | |||||
| { | { | ||||
| if( BASE_DIRECTORY.equals( name ) && !( value instanceof File ) ) | if( BASE_DIRECTORY.equals( name ) && !( value instanceof File ) ) | ||||
| { | { | ||||
| final String message = | |||||
| final String message = | |||||
| REZ.getString( "bad-property.error", BASE_DIRECTORY, File.class.getName() ); | REZ.getString( "bad-property.error", BASE_DIRECTORY, File.class.getName() ); | ||||
| throw new TaskException( message ); | throw new TaskException( message ); | ||||
| } | } | ||||
| else if( NAME.equals( name ) && !( value instanceof String ) ) | else if( NAME.equals( name ) && !( value instanceof String ) ) | ||||
| { | { | ||||
| final String message = | |||||
| final String message = | |||||
| REZ.getString( "bad-property.error", NAME, String.class.getName() ); | REZ.getString( "bad-property.error", NAME, String.class.getName() ); | ||||
| throw new TaskException( message ); | throw new TaskException( message ); | ||||
| } | } | ||||
| else if( JAVA_VERSION.equals( name ) && !( value instanceof JavaVersion ) ) | else if( JAVA_VERSION.equals( name ) && !( value instanceof JavaVersion ) ) | ||||
| { | { | ||||
| final String message = | |||||
| final String message = | |||||
| REZ.getString( "bad-property.error", JAVA_VERSION, JavaVersion.class.getName() ); | REZ.getString( "bad-property.error", JAVA_VERSION, JavaVersion.class.getName() ); | ||||
| throw new TaskException( message ); | throw new TaskException( message ); | ||||
| } | } | ||||
| @@ -8,13 +8,11 @@ | |||||
| package org.apache.myrmidon.components.workspace; | package org.apache.myrmidon.components.workspace; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.util.ArrayList; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.framework.activity.Disposable; | |||||
| import org.apache.avalon.framework.activity.Initializable; | import org.apache.avalon.framework.activity.Initializable; | ||||
| import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
| import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
| @@ -57,15 +55,15 @@ public class DefaultWorkspace | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( DefaultWorkspace.class ); | ResourceManager.getPackageResources( DefaultWorkspace.class ); | ||||
| private Executor m_executor; | |||||
| private ProjectListenerSupport m_listenerSupport = new ProjectListenerSupport(); | |||||
| private ComponentManager m_componentManager; | |||||
| private Parameters m_parameters; | |||||
| private TaskContext m_baseContext; | |||||
| private HashMap m_entrys = new HashMap(); | |||||
| private TypeManager m_typeManager; | |||||
| private Hierarchy m_hierarchy; | |||||
| private int m_projectID; | |||||
| private Executor m_executor; | |||||
| private ProjectListenerSupport m_listenerSupport = new ProjectListenerSupport(); | |||||
| private ComponentManager m_componentManager; | |||||
| private Parameters m_parameters; | |||||
| private TaskContext m_baseContext; | |||||
| private HashMap m_entrys = new HashMap(); | |||||
| private TypeManager m_typeManager; | |||||
| private Hierarchy m_hierarchy; | |||||
| private int m_projectID; | |||||
| /** | /** | ||||
| * Add a listener to project events. | * Add a listener to project events. | ||||
| @@ -140,7 +138,6 @@ public class DefaultWorkspace | |||||
| m_listenerSupport.projectFinished(); | m_listenerSupport.projectFinished(); | ||||
| } | } | ||||
| private TaskContext createBaseContext() | private TaskContext createBaseContext() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| @@ -239,7 +236,10 @@ public class DefaultWorkspace | |||||
| final DefaultDeployer deployer = new DefaultDeployer(); | final DefaultDeployer deployer = new DefaultDeployer(); | ||||
| deployer.enableLogging( getLogger() ); | deployer.enableLogging( getLogger() ); | ||||
| try { deployer.compose( componentManager ); } | |||||
| try | |||||
| { | |||||
| deployer.compose( componentManager ); | |||||
| } | |||||
| catch( final ComponentException ce ) | catch( final ComponentException ce ) | ||||
| { | { | ||||
| final String message = REZ.getString( "bad-deployer-config.error" ); | final String message = REZ.getString( "bad-deployer-config.error" ); | ||||
| @@ -19,7 +19,7 @@ import org.apache.myrmidon.listeners.ProjectListener; | |||||
| public class LogTargetToListenerAdapter | public class LogTargetToListenerAdapter | ||||
| implements LogTarget | implements LogTarget | ||||
| { | { | ||||
| private final ProjectListener m_listener; | |||||
| private final ProjectListener m_listener; | |||||
| /** | /** | ||||
| * Constructor taking listener to convert to. | * Constructor taking listener to convert to. | ||||
| @@ -18,9 +18,9 @@ import org.apache.myrmidon.interfaces.model.Project; | |||||
| */ | */ | ||||
| public final class ProjectEntry | public final class ProjectEntry | ||||
| { | { | ||||
| private final Project m_project; | |||||
| private final ExecutionFrame m_frame; | |||||
| private final ArrayList m_targetsCompleted = new ArrayList(); | |||||
| private final Project m_project; | |||||
| private final ExecutionFrame m_frame; | |||||
| private final ArrayList m_targetsCompleted = new ArrayList(); | |||||
| public ProjectEntry( final Project project, | public ProjectEntry( final Project project, | ||||
| final ExecutionFrame frame ) | final ExecutionFrame frame ) | ||||
| @@ -17,7 +17,7 @@ import org.apache.myrmidon.listeners.ProjectListener; | |||||
| public class ProjectListenerSupport | public class ProjectListenerSupport | ||||
| implements ProjectListener | implements ProjectListener | ||||
| { | { | ||||
| private ProjectListener[] m_listeners = new ProjectListener[ 0 ]; | |||||
| private ProjectListener[] m_listeners = new ProjectListener[ 0 ]; | |||||
| /** | /** | ||||
| * Add an extra project listener that wants to receive notification of listener events. | * Add an extra project listener that wants to receive notification of listener events. | ||||
| @@ -22,8 +22,8 @@ public abstract class AbstractConverter | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( AbstractConverter.class ); | ResourceManager.getPackageResources( AbstractConverter.class ); | ||||
| private final Class m_source; | |||||
| private final Class m_destination; | |||||
| private final Class m_source; | |||||
| private final Class m_destination; | |||||
| /** | /** | ||||
| * Constructor for a converter between types source and destination | * Constructor for a converter between types source and destination | ||||
| @@ -17,12 +17,11 @@ import org.apache.avalon.framework.component.Composable; | |||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.configuration.ConfigurationException; | import org.apache.avalon.framework.configuration.ConfigurationException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
| import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.converter.Converter; | |||||
| import org.apache.myrmidon.converter.ConverterException; | |||||
| import org.apache.myrmidon.interfaces.configurer.Configurer; | import org.apache.myrmidon.interfaces.configurer.Configurer; | ||||
| import org.apache.myrmidon.interfaces.converter.MasterConverter; | import org.apache.myrmidon.interfaces.converter.MasterConverter; | ||||
| import org.apache.myrmidon.interfaces.executor.Executor; | import org.apache.myrmidon.interfaces.executor.Executor; | ||||
| import org.apache.myrmidon.converter.Converter; | |||||
| import org.apache.myrmidon.converter.ConverterException; | |||||
| /** | /** | ||||
| * This is the class that Task writers should extend to provide custom tasks. | * This is the class that Task writers should extend to provide custom tasks. | ||||
| @@ -37,13 +36,13 @@ public abstract class AbstractContainerTask | |||||
| ResourceManager.getPackageResources( AbstractContainerTask.class ); | ResourceManager.getPackageResources( AbstractContainerTask.class ); | ||||
| ///For converting own attributes | ///For converting own attributes | ||||
| private MasterConverter m_converter; | |||||
| private MasterConverter m_converter; | |||||
| ///For configuring own sub-elements | ///For configuring own sub-elements | ||||
| private Configurer m_configurer; | |||||
| private Configurer m_configurer; | |||||
| ///For executing sub-elements as tasks | ///For executing sub-elements as tasks | ||||
| private Executor m_executor; | |||||
| private Executor m_executor; | |||||
| public void compose( final ComponentManager componentManager ) | public void compose( final ComponentManager componentManager ) | ||||
| throws ComponentException | throws ComponentException | ||||
| @@ -118,7 +117,6 @@ public abstract class AbstractContainerTask | |||||
| getConfigurer().configure( object, element, getContext() ); | getConfigurer().configure( object, element, getContext() ); | ||||
| } | } | ||||
| /** | /** | ||||
| * Configure an objects attribute using parameters. | * Configure an objects attribute using parameters. | ||||
| * | * | ||||
| @@ -36,11 +36,11 @@ public abstract class AbstractTypeDef | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( AbstractTypeDef.class ); | ResourceManager.getPackageResources( AbstractTypeDef.class ); | ||||
| private File m_lib; | |||||
| private String m_name; | |||||
| private String m_className; | |||||
| private TypeManager m_typeManager; | |||||
| private RoleManager m_roleManager; | |||||
| private File m_lib; | |||||
| private String m_name; | |||||
| private String m_className; | |||||
| private TypeManager m_typeManager; | |||||
| private RoleManager m_roleManager; | |||||
| public void compose( final ComponentManager componentManager ) | public void compose( final ComponentManager componentManager ) | ||||
| throws ComponentException | throws ComponentException | ||||
| @@ -86,7 +86,10 @@ public abstract class AbstractTypeDef | |||||
| final DefaultTypeFactory factory = new DefaultTypeFactory( classLoader ); | final DefaultTypeFactory factory = new DefaultTypeFactory( classLoader ); | ||||
| factory.addNameClassMapping( m_name, m_className ); | factory.addNameClassMapping( m_name, m_className ); | ||||
| try { m_typeManager.registerType( role, m_name, factory ); } | |||||
| try | |||||
| { | |||||
| m_typeManager.registerType( role, m_name, factory ); | |||||
| } | |||||
| catch( final TypeException te ) | catch( final TypeException te ) | ||||
| { | { | ||||
| final String message = REZ.getString( "typedef.no-register.error" ); | final String message = REZ.getString( "typedef.no-register.error" ); | ||||
| @@ -104,7 +107,7 @@ public abstract class AbstractTypeDef | |||||
| final ClassLoader classLoader = | final ClassLoader classLoader = | ||||
| Thread.currentThread().getContextClassLoader(); | Thread.currentThread().getContextClassLoader(); | ||||
| return new URLClassLoader( new URL[] { url }, classLoader ); | |||||
| return new URLClassLoader( new URL[]{url}, classLoader ); | |||||
| } | } | ||||
| catch( final Exception e ) | catch( final Exception e ) | ||||
| { | { | ||||
| @@ -14,7 +14,6 @@ import org.apache.avalon.excalibur.property.PropertyUtil; | |||||
| import org.apache.avalon.framework.component.Component; | import org.apache.avalon.framework.component.Component; | ||||
| import org.apache.avalon.framework.context.Context; | import org.apache.avalon.framework.context.Context; | ||||
| import org.apache.avalon.framework.context.ContextException; | import org.apache.avalon.framework.context.ContextException; | ||||
| import org.apache.myrmidon.api.TaskException; | |||||
| /** | /** | ||||
| * Class representing a condition. | * Class representing a condition. | ||||
| @@ -27,8 +26,8 @@ public class Condition | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( Condition.class ); | ResourceManager.getPackageResources( Condition.class ); | ||||
| private String m_condition; | |||||
| private boolean m_isIfCondition; | |||||
| private String m_condition; | |||||
| private boolean m_isIfCondition; | |||||
| public Condition( final boolean isIfCondition, final String condition ) | public Condition( final boolean isIfCondition, final String condition ) | ||||
| { | { | ||||
| @@ -9,7 +9,7 @@ package org.apache.myrmidon.framework; | |||||
| /** | /** | ||||
| * Base class for those classes that can appear inside the build file | * Base class for those classes that can appear inside the build file | ||||
| * as stand alone data types. | |||||
| * as stand alone data types. | |||||
| * | * | ||||
| * @author <a href="mailto:peter@apache.org">Peter Donald</a> | * @author <a href="mailto:peter@apache.org">Peter Donald</a> | ||||
| */ | */ | ||||
| @@ -99,67 +99,88 @@ public class Os | |||||
| final String arch, | final String arch, | ||||
| final String version ) | final String version ) | ||||
| { | { | ||||
| boolean retValue = false; | |||||
| if( family != null || name != null || arch != null || version != null ) | if( family != null || name != null || arch != null || version != null ) | ||||
| { | { | ||||
| boolean isFamily = true; | |||||
| boolean isName = true; | |||||
| boolean isArch = true; | |||||
| boolean isVersion = true; | |||||
| final boolean isFamily = familyMatches( family ); | |||||
| final boolean isName = nameMatches( name ); | |||||
| final boolean isArch = archMatches( arch ); | |||||
| final boolean isVersion = versionMatches( version ); | |||||
| if( family != null ) | |||||
| return isFamily && isName && isArch && isVersion; | |||||
| } | |||||
| else | |||||
| { | |||||
| return false; | |||||
| } | |||||
| } | |||||
| private static boolean versionMatches( final String version ) | |||||
| { | |||||
| boolean isVersion = true; | |||||
| if( version != null ) | |||||
| { | |||||
| isVersion = version.equals( m_osVersion ); | |||||
| } | |||||
| return isVersion; | |||||
| } | |||||
| private static boolean archMatches( final String arch ) | |||||
| { | |||||
| boolean isArch = true; | |||||
| if( arch != null ) | |||||
| { | |||||
| isArch = arch.equals( m_osArch ); | |||||
| } | |||||
| return isArch; | |||||
| } | |||||
| private static boolean nameMatches( final String name ) | |||||
| { | |||||
| boolean isName = true; | |||||
| if( name != null ) | |||||
| { | |||||
| isName = name.equals( m_osName ); | |||||
| } | |||||
| return isName; | |||||
| } | |||||
| private static boolean familyMatches( final String family ) | |||||
| { | |||||
| boolean isFamily = true; | |||||
| if( family != null ) | |||||
| { | |||||
| if( family.equals( "windows" ) ) | |||||
| { | { | ||||
| if( family.equals( "windows" ) ) | |||||
| { | |||||
| isFamily = m_osName.indexOf( "windows" ) > -1; | |||||
| } | |||||
| else if( family.equals( "os/2" ) ) | |||||
| { | |||||
| isFamily = m_osName.indexOf( "os/2" ) > -1; | |||||
| } | |||||
| else if( family.equals( "netware" ) ) | |||||
| { | |||||
| isFamily = m_osName.indexOf( "netware" ) > -1; | |||||
| } | |||||
| else if( family.equals( "dos" ) ) | |||||
| { | |||||
| isFamily = m_pathSep.equals( ";" ) && !isFamily( "netware" ); | |||||
| } | |||||
| else if( family.equals( "mac" ) ) | |||||
| { | |||||
| isFamily = m_osName.indexOf( "mac" ) > -1; | |||||
| } | |||||
| else if( family.equals( "unix" ) ) | |||||
| { | |||||
| isFamily = m_pathSep.equals( ":" ) && | |||||
| ( !isFamily( "mac" ) || m_osName.endsWith( "x" ) ); | |||||
| } | |||||
| else | |||||
| { | |||||
| final String message = REZ.getString( "unknown-os-family", family ); | |||||
| throw new IllegalArgumentException( message ); | |||||
| } | |||||
| isFamily = m_osName.indexOf( "windows" ) > -1; | |||||
| } | } | ||||
| if( name != null ) | |||||
| else if( family.equals( "os/2" ) ) | |||||
| { | { | ||||
| isName = name.equals( m_osName ); | |||||
| isFamily = m_osName.indexOf( "os/2" ) > -1; | |||||
| } | } | ||||
| if( arch != null ) | |||||
| else if( family.equals( "netware" ) ) | |||||
| { | { | ||||
| isArch = arch.equals( m_osArch ); | |||||
| isFamily = m_osName.indexOf( "netware" ) > -1; | |||||
| } | } | ||||
| if( version != null ) | |||||
| else if( family.equals( "dos" ) ) | |||||
| { | { | ||||
| isVersion = version.equals( m_osVersion ); | |||||
| isFamily = m_pathSep.equals( ";" ) && !isFamily( "netware" ); | |||||
| } | |||||
| else if( family.equals( "mac" ) ) | |||||
| { | |||||
| isFamily = m_osName.indexOf( "mac" ) > -1; | |||||
| } | |||||
| else if( family.equals( "unix" ) ) | |||||
| { | |||||
| isFamily = m_pathSep.equals( ":" ) && | |||||
| ( !isFamily( "mac" ) || m_osName.endsWith( "x" ) ); | |||||
| } | |||||
| else | |||||
| { | |||||
| final String message = REZ.getString( "unknown-os-family", family ); | |||||
| throw new IllegalArgumentException( message ); | |||||
| } | } | ||||
| retValue = isFamily && isName && isArch && isVersion; | |||||
| } | } | ||||
| return retValue; | |||||
| return isFamily; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -22,8 +22,8 @@ public class Pattern | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( Pattern.class ); | ResourceManager.getPackageResources( Pattern.class ); | ||||
| private String m_value; | |||||
| private Condition m_condition; | |||||
| private String m_value; | |||||
| private Condition m_condition; | |||||
| /** | /** | ||||
| * Retrieve value of pattern. | * Retrieve value of pattern. | ||||
| @@ -11,7 +11,6 @@ import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
| import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
| import org.apache.avalon.framework.component.Composable; | |||||
| import org.apache.avalon.framework.configuration.Configurable; | import org.apache.avalon.framework.configuration.Configurable; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.configuration.ConfigurationException; | import org.apache.avalon.framework.configuration.ConfigurationException; | ||||
| @@ -34,10 +33,10 @@ public class TypeInstanceTask | |||||
| private static final Resources REZ = | private static final Resources REZ = | ||||
| ResourceManager.getPackageResources( TypeInstanceTask.class ); | ResourceManager.getPackageResources( TypeInstanceTask.class ); | ||||
| private String m_id; | |||||
| private Object m_value; | |||||
| private boolean m_localScope = true; | |||||
| private TypeFactory m_factory; | |||||
| private String m_id; | |||||
| private Object m_value; | |||||
| private boolean m_localScope = true; | |||||
| private TypeFactory m_factory; | |||||
| public void compose( final ComponentManager componentManager ) | public void compose( final ComponentManager componentManager ) | ||||
| throws ComponentException | throws ComponentException | ||||
| @@ -45,7 +44,10 @@ public class TypeInstanceTask | |||||
| super.compose( componentManager ); | super.compose( componentManager ); | ||||
| final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE ); | final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE ); | ||||
| try { m_factory = typeManager.getFactory( DataType.ROLE ); } | |||||
| try | |||||
| { | |||||
| m_factory = typeManager.getFactory( DataType.ROLE ); | |||||
| } | |||||
| catch( final TypeException te ) | catch( final TypeException te ) | ||||
| { | { | ||||
| final String message = REZ.getString( "type.no-factory.error" ); | final String message = REZ.getString( "type.no-factory.error" ); | ||||
| @@ -9,14 +9,8 @@ package org.apache.myrmidon.frontends; | |||||
| import java.io.BufferedReader; | import java.io.BufferedReader; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.FileInputStream; | |||||
| import java.io.IOException; | |||||
| import java.io.InputStream; | |||||
| import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||
| import java.net.MalformedURLException; | |||||
| import java.net.URL; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.HashMap; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -24,7 +18,8 @@ import org.apache.avalon.excalibur.cli.CLArgsParser; | |||||
| import org.apache.avalon.excalibur.cli.CLOption; | import org.apache.avalon.excalibur.cli.CLOption; | ||||
| import org.apache.avalon.excalibur.cli.CLOptionDescriptor; | import org.apache.avalon.excalibur.cli.CLOptionDescriptor; | ||||
| import org.apache.avalon.excalibur.cli.CLUtil; | import org.apache.avalon.excalibur.cli.CLUtil; | ||||
| import org.apache.avalon.excalibur.io.ExtensionFileFilter; | |||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
| import org.apache.avalon.excalibur.i18n.Resources; | |||||
| import org.apache.avalon.framework.ExceptionUtil; | import org.apache.avalon.framework.ExceptionUtil; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | import org.apache.avalon.framework.logger.AbstractLogEnabled; | ||||
| import org.apache.avalon.framework.logger.LogKitLogger; | import org.apache.avalon.framework.logger.LogKitLogger; | ||||
| @@ -37,15 +32,12 @@ import org.apache.log.output.DefaultOutputLogTarget; | |||||
| import org.apache.myrmidon.Constants; | import org.apache.myrmidon.Constants; | ||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.interfaces.builder.ProjectBuilder; | |||||
| import org.apache.myrmidon.interfaces.executor.Executor; | |||||
| import org.apache.myrmidon.interfaces.embeddor.Embeddor; | |||||
| import org.apache.myrmidon.components.embeddor.DefaultEmbeddor; | import org.apache.myrmidon.components.embeddor.DefaultEmbeddor; | ||||
| import org.apache.myrmidon.interfaces.workspace.Workspace; | |||||
| import org.apache.myrmidon.interfaces.embeddor.Embeddor; | |||||
| import org.apache.myrmidon.interfaces.executor.Executor; | |||||
| import org.apache.myrmidon.interfaces.model.Project; | import org.apache.myrmidon.interfaces.model.Project; | ||||
| import org.apache.myrmidon.interfaces.workspace.Workspace; | |||||
| import org.apache.myrmidon.listeners.ProjectListener; | import org.apache.myrmidon.listeners.ProjectListener; | ||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
| import org.apache.avalon.excalibur.i18n.Resources; | |||||
| /** | /** | ||||
| * The class to kick the tires and light the fires. | * The class to kick the tires and light the fires. | ||||
| @@ -61,22 +53,22 @@ public class CLIMain | |||||
| ResourceManager.getPackageResources( CLIMain.class ); | ResourceManager.getPackageResources( CLIMain.class ); | ||||
| //defines for the Command Line options | //defines for the Command Line options | ||||
| private static final int HELP_OPT = 'h'; | |||||
| private static final int QUIET_OPT = 'q'; | |||||
| private static final int VERBOSE_OPT = 'v'; | |||||
| private static final int FILE_OPT = 'f'; | |||||
| private static final int LOG_LEVEL_OPT = 'l'; | |||||
| private static final int DEFINE_OPT = 'D'; | |||||
| private static final int BUILDER_PARAM_OPT = 'B'; | |||||
| private static final int VERSION_OPT = 1; | |||||
| private static final int LISTENER_OPT = 2; | |||||
| private static final int TASKLIB_DIR_OPT = 5; | |||||
| private static final int INCREMENTAL_OPT = 6; | |||||
| private static final int HOME_DIR_OPT = 7; | |||||
| private static final int DRY_RUN_OPT = 8; | |||||
| private static final int HELP_OPT = 'h'; | |||||
| private static final int QUIET_OPT = 'q'; | |||||
| private static final int VERBOSE_OPT = 'v'; | |||||
| private static final int FILE_OPT = 'f'; | |||||
| private static final int LOG_LEVEL_OPT = 'l'; | |||||
| private static final int DEFINE_OPT = 'D'; | |||||
| private static final int BUILDER_PARAM_OPT = 'B'; | |||||
| private static final int VERSION_OPT = 1; | |||||
| private static final int LISTENER_OPT = 2; | |||||
| private static final int TASKLIB_DIR_OPT = 5; | |||||
| private static final int INCREMENTAL_OPT = 6; | |||||
| private static final int HOME_DIR_OPT = 7; | |||||
| private static final int DRY_RUN_OPT = 8; | |||||
| //incompatable options for info options | //incompatable options for info options | ||||
| private static final int[] INFO_OPT_INCOMPAT = new int[] | |||||
| private static final int[] INFO_OPT_INCOMPAT = new int[] | |||||
| { | { | ||||
| HELP_OPT, QUIET_OPT, VERBOSE_OPT, FILE_OPT, | HELP_OPT, QUIET_OPT, VERBOSE_OPT, FILE_OPT, | ||||
| LOG_LEVEL_OPT, VERSION_OPT, LISTENER_OPT, | LOG_LEVEL_OPT, VERSION_OPT, LISTENER_OPT, | ||||
| @@ -84,27 +76,27 @@ public class CLIMain | |||||
| }; | }; | ||||
| //incompatable options for other logging options | //incompatable options for other logging options | ||||
| private static final int[] LOG_OPT_INCOMPAT = new int[] | |||||
| private static final int[] LOG_OPT_INCOMPAT = new int[] | |||||
| { | { | ||||
| QUIET_OPT, VERBOSE_OPT, LOG_LEVEL_OPT | QUIET_OPT, VERBOSE_OPT, LOG_LEVEL_OPT | ||||
| }; | }; | ||||
| private ProjectListener m_listener; | |||||
| private ProjectListener m_listener; | |||||
| ///Parameters for run of myrmidon | ///Parameters for run of myrmidon | ||||
| private Parameters m_parameters = new Parameters(); | |||||
| private Parameters m_parameters = new Parameters(); | |||||
| ///List of targets supplied on command line to execute | ///List of targets supplied on command line to execute | ||||
| private ArrayList m_targets = new ArrayList(); | |||||
| private ArrayList m_targets = new ArrayList(); | |||||
| ///List of user supplied defines | ///List of user supplied defines | ||||
| private Parameters m_defines = new Parameters(); | |||||
| private Parameters m_defines = new Parameters(); | |||||
| ///List of user supplied parameters for builder | ///List of user supplied parameters for builder | ||||
| private Parameters m_builderParameters = new Parameters(); | |||||
| private Parameters m_builderParameters = new Parameters(); | |||||
| ///Determine whether tasks are actually executed | ///Determine whether tasks are actually executed | ||||
| private boolean m_dryRun = false; | |||||
| private boolean m_dryRun = false; | |||||
| /** | /** | ||||
| * Main entry point called to run standard Myrmidon. | * Main entry point called to run standard Myrmidon. | ||||
| @@ -115,12 +107,15 @@ public class CLIMain | |||||
| { | { | ||||
| final CLIMain main = new CLIMain(); | final CLIMain main = new CLIMain(); | ||||
| try { main.execute( args ); } | |||||
| try | |||||
| { | |||||
| main.execute( args ); | |||||
| } | |||||
| catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
| { | { | ||||
| final String message = | |||||
| final String message = | |||||
| REZ.getString( "error-message", ExceptionUtil.printStackTrace( throwable ) ); | REZ.getString( "error-message", ExceptionUtil.printStackTrace( throwable ) ); | ||||
| System.err.println( message ); | |||||
| System.err.println( message ); | |||||
| System.exit( -1 ); | System.exit( -1 ); | ||||
| } | } | ||||
| @@ -134,7 +129,7 @@ public class CLIMain | |||||
| private void usage( final CLOptionDescriptor[] options ) | private void usage( final CLOptionDescriptor[] options ) | ||||
| { | { | ||||
| System.out.println( "java " + getClass().getName() + " [options]" ); | System.out.println( "java " + getClass().getName() + " [options]" ); | ||||
| System.out.println( "\tAvailable options:"); | |||||
| System.out.println( "\tAvailable options:" ); | |||||
| System.out.println( CLUtil.describeOptions( options ) ); | System.out.println( CLUtil.describeOptions( options ) ); | ||||
| } | } | ||||
| @@ -145,74 +140,74 @@ public class CLIMain | |||||
| { | { | ||||
| //TODO: localise | //TODO: localise | ||||
| final CLOptionDescriptor[] options = new CLOptionDescriptor[ 13 ]; | final CLOptionDescriptor[] options = new CLOptionDescriptor[ 13 ]; | ||||
| options[0] = | |||||
| options[ 0 ] = | |||||
| new CLOptionDescriptor( "help", | new CLOptionDescriptor( "help", | ||||
| CLOptionDescriptor.ARGUMENT_DISALLOWED, | CLOptionDescriptor.ARGUMENT_DISALLOWED, | ||||
| HELP_OPT, | HELP_OPT, | ||||
| REZ.getString( "help.opt" ), | REZ.getString( "help.opt" ), | ||||
| INFO_OPT_INCOMPAT ); | INFO_OPT_INCOMPAT ); | ||||
| options[1] = | |||||
| options[ 1 ] = | |||||
| new CLOptionDescriptor( "file", | new CLOptionDescriptor( "file", | ||||
| CLOptionDescriptor.ARGUMENT_REQUIRED, | CLOptionDescriptor.ARGUMENT_REQUIRED, | ||||
| FILE_OPT, | FILE_OPT, | ||||
| REZ.getString( "file.opt" ) ); | REZ.getString( "file.opt" ) ); | ||||
| options[2] = | |||||
| options[ 2 ] = | |||||
| new CLOptionDescriptor( "log-level", | new CLOptionDescriptor( "log-level", | ||||
| CLOptionDescriptor.ARGUMENT_REQUIRED, | CLOptionDescriptor.ARGUMENT_REQUIRED, | ||||
| LOG_LEVEL_OPT, | LOG_LEVEL_OPT, | ||||
| REZ.getString( "log-level.opt" ), | REZ.getString( "log-level.opt" ), | ||||
| LOG_OPT_INCOMPAT ); | LOG_OPT_INCOMPAT ); | ||||
| options[3] = | |||||
| options[ 3 ] = | |||||
| new CLOptionDescriptor( "quiet", | new CLOptionDescriptor( "quiet", | ||||
| CLOptionDescriptor.ARGUMENT_DISALLOWED, | CLOptionDescriptor.ARGUMENT_DISALLOWED, | ||||
| QUIET_OPT, | QUIET_OPT, | ||||
| REZ.getString( "quiet.opt" ), | REZ.getString( "quiet.opt" ), | ||||
| LOG_OPT_INCOMPAT ); | LOG_OPT_INCOMPAT ); | ||||
| options[4] = | |||||
| options[ 4 ] = | |||||
| new CLOptionDescriptor( "verbose", | new CLOptionDescriptor( "verbose", | ||||
| CLOptionDescriptor.ARGUMENT_DISALLOWED, | CLOptionDescriptor.ARGUMENT_DISALLOWED, | ||||
| VERBOSE_OPT, | VERBOSE_OPT, | ||||
| REZ.getString( "verbose.opt" ), | REZ.getString( "verbose.opt" ), | ||||
| LOG_OPT_INCOMPAT ); | LOG_OPT_INCOMPAT ); | ||||
| options[5] = | |||||
| options[ 5 ] = | |||||
| new CLOptionDescriptor( "listener", | new CLOptionDescriptor( "listener", | ||||
| CLOptionDescriptor.ARGUMENT_REQUIRED, | CLOptionDescriptor.ARGUMENT_REQUIRED, | ||||
| LISTENER_OPT, | LISTENER_OPT, | ||||
| REZ.getString( "listener.opt" ) ); | REZ.getString( "listener.opt" ) ); | ||||
| options[6] = | |||||
| options[ 6 ] = | |||||
| new CLOptionDescriptor( "version", | new CLOptionDescriptor( "version", | ||||
| CLOptionDescriptor.ARGUMENT_DISALLOWED, | CLOptionDescriptor.ARGUMENT_DISALLOWED, | ||||
| VERSION_OPT, | VERSION_OPT, | ||||
| REZ.getString( "version.opt" ), | REZ.getString( "version.opt" ), | ||||
| INFO_OPT_INCOMPAT ); | INFO_OPT_INCOMPAT ); | ||||
| options[7] = | |||||
| options[ 7 ] = | |||||
| new CLOptionDescriptor( "task-lib-dir", | new CLOptionDescriptor( "task-lib-dir", | ||||
| CLOptionDescriptor.ARGUMENT_REQUIRED, | CLOptionDescriptor.ARGUMENT_REQUIRED, | ||||
| TASKLIB_DIR_OPT, | TASKLIB_DIR_OPT, | ||||
| REZ.getString( "tasklib.opt" ) ); | REZ.getString( "tasklib.opt" ) ); | ||||
| options[8] = | |||||
| options[ 8 ] = | |||||
| new CLOptionDescriptor( "incremental", | new CLOptionDescriptor( "incremental", | ||||
| CLOptionDescriptor.ARGUMENT_DISALLOWED, | CLOptionDescriptor.ARGUMENT_DISALLOWED, | ||||
| INCREMENTAL_OPT, | INCREMENTAL_OPT, | ||||
| REZ.getString( "incremental.opt" ) ); | REZ.getString( "incremental.opt" ) ); | ||||
| options[9] = | |||||
| options[ 9 ] = | |||||
| new CLOptionDescriptor( "myrmidon-home", | new CLOptionDescriptor( "myrmidon-home", | ||||
| CLOptionDescriptor.ARGUMENT_REQUIRED, | CLOptionDescriptor.ARGUMENT_REQUIRED, | ||||
| HOME_DIR_OPT, | HOME_DIR_OPT, | ||||
| REZ.getString( "home.opt" ) ); | REZ.getString( "home.opt" ) ); | ||||
| options[10] = | |||||
| options[ 10 ] = | |||||
| new CLOptionDescriptor( "define", | new CLOptionDescriptor( "define", | ||||
| CLOptionDescriptor.ARGUMENTS_REQUIRED_2, | CLOptionDescriptor.ARGUMENTS_REQUIRED_2, | ||||
| DEFINE_OPT, | DEFINE_OPT, | ||||
| REZ.getString( "define.opt" ), | REZ.getString( "define.opt" ), | ||||
| new int[ 0 ] ); | new int[ 0 ] ); | ||||
| options[11] = | |||||
| options[ 11 ] = | |||||
| new CLOptionDescriptor( "builder-parameter", | new CLOptionDescriptor( "builder-parameter", | ||||
| CLOptionDescriptor.ARGUMENTS_REQUIRED_2, | CLOptionDescriptor.ARGUMENTS_REQUIRED_2, | ||||
| BUILDER_PARAM_OPT, | BUILDER_PARAM_OPT, | ||||
| REZ.getString( "build.opt" ) ); | REZ.getString( "build.opt" ) ); | ||||
| options[12] = | |||||
| options[ 12 ] = | |||||
| new CLOptionDescriptor( "dry-run", | new CLOptionDescriptor( "dry-run", | ||||
| CLOptionDescriptor.ARGUMENT_DISALLOWED, | CLOptionDescriptor.ARGUMENT_DISALLOWED, | ||||
| DRY_RUN_OPT, | DRY_RUN_OPT, | ||||
| @@ -241,34 +236,56 @@ public class CLIMain | |||||
| switch( option.getId() ) | switch( option.getId() ) | ||||
| { | { | ||||
| case HELP_OPT: usage( options ); return false; | |||||
| case VERSION_OPT: System.out.println( Constants.BUILD_DESCRIPTION ); return false; | |||||
| case HOME_DIR_OPT: m_parameters.setParameter( "myrmidon.home", option.getArgument() ); break; | |||||
| case TASKLIB_DIR_OPT: | |||||
| m_parameters.setParameter( "myrmidon.lib.path", option.getArgument() ); | |||||
| break; | |||||
| case LOG_LEVEL_OPT: m_parameters.setParameter( "log.level", option.getArgument() ); break; | |||||
| case VERBOSE_OPT: m_parameters.setParameter( "log.level", "INFO" ); break; | |||||
| case QUIET_OPT: m_parameters.setParameter( "log.level", "ERROR" ); break; | |||||
| case INCREMENTAL_OPT: m_parameters.setParameter( "incremental", "true" ); break; | |||||
| case FILE_OPT: m_parameters.setParameter( "filename", option.getArgument() ); break; | |||||
| case LISTENER_OPT: m_parameters.setParameter( "listener", option.getArgument() ); break; | |||||
| case DEFINE_OPT: | |||||
| m_defines.setParameter( option.getArgument( 0 ), option.getArgument( 1 ) ); | |||||
| break; | |||||
| case BUILDER_PARAM_OPT: | |||||
| m_builderParameters.setParameter( option.getArgument( 0 ), option.getArgument( 1 ) ); | |||||
| break; | |||||
| case DRY_RUN_OPT: m_dryRun = true; break; | |||||
| case 0: m_targets.add( option.getArgument() ); break; | |||||
| case HELP_OPT: | |||||
| usage( options ); | |||||
| return false; | |||||
| case VERSION_OPT: | |||||
| System.out.println( Constants.BUILD_DESCRIPTION ); | |||||
| return false; | |||||
| case HOME_DIR_OPT: | |||||
| m_parameters.setParameter( "myrmidon.home", option.getArgument() ); | |||||
| break; | |||||
| case TASKLIB_DIR_OPT: | |||||
| m_parameters.setParameter( "myrmidon.lib.path", option.getArgument() ); | |||||
| break; | |||||
| case LOG_LEVEL_OPT: | |||||
| m_parameters.setParameter( "log.level", option.getArgument() ); | |||||
| break; | |||||
| case VERBOSE_OPT: | |||||
| m_parameters.setParameter( "log.level", "INFO" ); | |||||
| break; | |||||
| case QUIET_OPT: | |||||
| m_parameters.setParameter( "log.level", "ERROR" ); | |||||
| break; | |||||
| case INCREMENTAL_OPT: | |||||
| m_parameters.setParameter( "incremental", "true" ); | |||||
| break; | |||||
| case FILE_OPT: | |||||
| m_parameters.setParameter( "filename", option.getArgument() ); | |||||
| break; | |||||
| case LISTENER_OPT: | |||||
| m_parameters.setParameter( "listener", option.getArgument() ); | |||||
| break; | |||||
| case DEFINE_OPT: | |||||
| m_defines.setParameter( option.getArgument( 0 ), option.getArgument( 1 ) ); | |||||
| break; | |||||
| case BUILDER_PARAM_OPT: | |||||
| m_builderParameters.setParameter( option.getArgument( 0 ), option.getArgument( 1 ) ); | |||||
| break; | |||||
| case DRY_RUN_OPT: | |||||
| m_dryRun = true; | |||||
| break; | |||||
| case 0: | |||||
| m_targets.add( option.getArgument() ); | |||||
| break; | |||||
| } | } | ||||
| } | } | ||||
| @@ -301,7 +318,7 @@ public class CLIMain | |||||
| enableLogging( new LogKitLogger( createLogger( logLevel ) ) ); | enableLogging( new LogKitLogger( createLogger( logLevel ) ) ); | ||||
| final String home = m_parameters.getParameter( "myrmidon.home", null ); | final String home = m_parameters.getParameter( "myrmidon.home", null ); | ||||
| final File homeDir = (new File( home )).getAbsoluteFile(); | |||||
| final File homeDir = ( new File( home ) ).getAbsoluteFile(); | |||||
| if( !homeDir.isDirectory() ) | if( !homeDir.isDirectory() ) | ||||
| { | { | ||||
| final String message = REZ.getString( "home-not-dir.error", homeDir ); | final String message = REZ.getString( "home-not-dir.error", homeDir ); | ||||
| @@ -309,7 +326,7 @@ public class CLIMain | |||||
| } | } | ||||
| final String filename = m_parameters.getParameter( "filename", null ); | final String filename = m_parameters.getParameter( "filename", null ); | ||||
| final File buildFile = (new File( filename )).getCanonicalFile(); | |||||
| final File buildFile = ( new File( filename ) ).getCanonicalFile(); | |||||
| if( !buildFile.isFile() ) | if( !buildFile.isFile() ) | ||||
| { | { | ||||
| final String message = REZ.getString( "bad-file.error", buildFile ); | final String message = REZ.getString( "bad-file.error", buildFile ); | ||||
| @@ -337,7 +354,7 @@ public class CLIMain | |||||
| if( m_dryRun ) | if( m_dryRun ) | ||||
| { | { | ||||
| m_parameters.setParameter( Executor.ROLE, | |||||
| m_parameters.setParameter( Executor.ROLE, | |||||
| "org.apache.myrmidon.components.executor.PrintingExecutor" ); | "org.apache.myrmidon.components.executor.PrintingExecutor" ); | ||||
| } | } | ||||
| @@ -348,7 +365,7 @@ public class CLIMain | |||||
| embeddor.start(); | embeddor.start(); | ||||
| //create the project | //create the project | ||||
| final Project project = | |||||
| final Project project = | |||||
| embeddor.createProject( buildFile.toString(), null, m_builderParameters ); | embeddor.createProject( buildFile.toString(), null, m_builderParameters ); | ||||
| BufferedReader reader = null; | BufferedReader reader = null; | ||||
| @@ -413,7 +430,7 @@ public class CLIMain | |||||
| } | } | ||||
| catch( final TaskException ae ) | catch( final TaskException ae ) | ||||
| { | { | ||||
| final String message = | |||||
| final String message = | |||||
| REZ.getString( "build-failed.error", ExceptionUtil.printStackTrace( ae, 5, true ) ); | REZ.getString( "build-failed.error", ExceptionUtil.printStackTrace( ae, 5, true ) ); | ||||
| getLogger().error( message ); | getLogger().error( message ); | ||||
| } | } | ||||
| @@ -442,7 +459,7 @@ public class CLIMain | |||||
| final DefaultOutputLogTarget target = new DefaultOutputLogTarget(); | final DefaultOutputLogTarget target = new DefaultOutputLogTarget(); | ||||
| target.setFormat( "[%8.8{category}] %{message}\\n%{throwable}" ); | target.setFormat( "[%8.8{category}] %{message}\\n%{throwable}" ); | ||||
| logger.setLogTargets( new LogTarget[] { target } ); | |||||
| logger.setLogTargets( new LogTarget[]{target} ); | |||||
| logger.setPriority( priority ); | logger.setPriority( priority ); | ||||
| @@ -457,12 +474,15 @@ public class CLIMain | |||||
| private ProjectListener createListener( final String listener ) | private ProjectListener createListener( final String listener ) | ||||
| throws Exception | throws Exception | ||||
| { | { | ||||
| try { return (ProjectListener)Class.forName( listener ).newInstance(); } | |||||
| try | |||||
| { | |||||
| return (ProjectListener)Class.forName( listener ).newInstance(); | |||||
| } | |||||
| catch( final Throwable t ) | catch( final Throwable t ) | ||||
| { | { | ||||
| final String message = | |||||
| REZ.getString( "bad-listener.error", | |||||
| listener, | |||||
| final String message = | |||||
| REZ.getString( "bad-listener.error", | |||||
| listener, | |||||
| ExceptionUtil.printStackTrace( t, 5, true ) ); | ExceptionUtil.printStackTrace( t, 5, true ) ); | ||||
| throw new Exception( message ); | throw new Exception( message ); | ||||
| } | } | ||||
| @@ -7,8 +7,6 @@ | |||||
| */ | */ | ||||
| package org.apache.myrmidon.interfaces.builder; | package org.apache.myrmidon.interfaces.builder; | ||||
| import java.io.File; | |||||
| import java.io.IOException; | |||||
| import org.apache.avalon.framework.component.Component; | import org.apache.avalon.framework.component.Component; | ||||
| import org.apache.myrmidon.interfaces.model.Project; | import org.apache.myrmidon.interfaces.model.Project; | ||||
| @@ -7,7 +7,6 @@ | |||||
| */ | */ | ||||
| package org.apache.myrmidon.interfaces.embeddor; | package org.apache.myrmidon.interfaces.embeddor; | ||||
| import java.util.Map; | |||||
| import org.apache.avalon.framework.activity.Disposable; | import org.apache.avalon.framework.activity.Disposable; | ||||
| import org.apache.avalon.framework.activity.Initializable; | import org.apache.avalon.framework.activity.Initializable; | ||||
| import org.apache.avalon.framework.activity.Startable; | import org.apache.avalon.framework.activity.Startable; | ||||
| @@ -20,7 +20,10 @@ import org.apache.myrmidon.interfaces.type.TypeManager; | |||||
| public interface ExecutionFrame | public interface ExecutionFrame | ||||
| { | { | ||||
| TypeManager getTypeManager(); | TypeManager getTypeManager(); | ||||
| Logger getLogger(); | Logger getLogger(); | ||||
| TaskContext getContext(); | TaskContext getContext(); | ||||
| ComponentManager getComponentManager(); | ComponentManager getComponentManager(); | ||||
| } | } | ||||
| @@ -9,7 +9,6 @@ package org.apache.myrmidon.interfaces.executor; | |||||
| import org.apache.avalon.framework.component.Component; | import org.apache.avalon.framework.component.Component; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| /** | /** | ||||
| @@ -7,8 +7,8 @@ | |||||
| */ | */ | ||||
| package org.apache.myrmidon.interfaces.extensions; | package org.apache.myrmidon.interfaces.extensions; | ||||
| import org.apache.avalon.framework.component.Component; | |||||
| import org.apache.avalon.excalibur.extension.PackageRepository; | import org.apache.avalon.excalibur.extension.PackageRepository; | ||||
| import org.apache.avalon.framework.component.Component; | |||||
| /** | /** | ||||
| * PackageRepository | * PackageRepository | ||||
| @@ -25,7 +25,7 @@ public interface Project | |||||
| String ROLE = "org.apache.myrmidon.interfaces.model.Project"; | String ROLE = "org.apache.myrmidon.interfaces.model.Project"; | ||||
| // the name of currently executing project | // the name of currently executing project | ||||
| String PROJECT = "myrmidon.project.name"; | |||||
| String PROJECT = "myrmidon.project.name"; | |||||
| // the name of currently executing project | // the name of currently executing project | ||||
| //String PROJECT_FILE = "myrmidon.project.file"; | //String PROJECT_FILE = "myrmidon.project.file"; | ||||
| @@ -18,9 +18,9 @@ import org.apache.myrmidon.framework.Condition; | |||||
| */ | */ | ||||
| public class Target | public class Target | ||||
| { | { | ||||
| private final ArrayList m_dependencies = new ArrayList(); | |||||
| private final ArrayList m_tasks = new ArrayList(); | |||||
| private final Condition m_condition; | |||||
| private final ArrayList m_dependencies = new ArrayList(); | |||||
| private final ArrayList m_tasks = new ArrayList(); | |||||
| private final Condition m_condition; | |||||
| /** | /** | ||||
| * Constructor taking condition for target. | * Constructor taking condition for target. | ||||
| @@ -56,6 +56,7 @@ public class Target | |||||
| { | { | ||||
| return m_condition; | return m_condition; | ||||
| } | } | ||||
| /** | /** | ||||
| * Get dependencies of target | * Get dependencies of target | ||||
| * | * | ||||
| @@ -15,16 +15,16 @@ package org.apache.myrmidon.interfaces.model; | |||||
| public class TypeLib | public class TypeLib | ||||
| { | { | ||||
| //Name of library (this is location independent) | //Name of library (this is location independent) | ||||
| private final String m_library; | |||||
| private final String m_library; | |||||
| //Do we need this?? | //Do we need this?? | ||||
| //private final String m_namespace; | //private final String m_namespace; | ||||
| //The role of object to be imported | //The role of object to be imported | ||||
| private final String m_role; | |||||
| private final String m_role; | |||||
| //The name of type instance | //The name of type instance | ||||
| private final String m_name; | |||||
| private final String m_name; | |||||
| public TypeLib( final String library ) | public TypeLib( final String library ) | ||||
| { | { | ||||
| @@ -12,8 +12,6 @@ import java.net.URLClassLoader; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.myrmidon.interfaces.type.TypeException; | |||||
| import org.apache.myrmidon.interfaces.type.TypeFactory; | |||||
| /** | /** | ||||
| * Create a type instance based on name. | * Create a type instance based on name. | ||||
| @@ -28,20 +26,20 @@ public class DefaultTypeFactory | |||||
| ResourceManager.getPackageResources( DefaultTypeFactory.class ); | ResourceManager.getPackageResources( DefaultTypeFactory.class ); | ||||
| ///A Map of shortnames to classnames | ///A Map of shortnames to classnames | ||||
| private final HashMap m_classNames = new HashMap(); | |||||
| private final HashMap m_classNames = new HashMap(); | |||||
| ///A list of URLs from which classLoader is constructed | ///A list of URLs from which classLoader is constructed | ||||
| private final URL[] m_urls; | |||||
| private final URL[] m_urls; | |||||
| ///The parent classLoader (if any) | ///The parent classLoader (if any) | ||||
| private final ClassLoader m_parent; | |||||
| private final ClassLoader m_parent; | |||||
| ///The parent classLoader (if any) | ///The parent classLoader (if any) | ||||
| private ClassLoader m_classLoader; | |||||
| private ClassLoader m_classLoader; | |||||
| public DefaultTypeFactory( final URL url ) | public DefaultTypeFactory( final URL url ) | ||||
| { | { | ||||
| this( new URL[] { url } ); | |||||
| this( new URL[]{url} ); | |||||
| } | } | ||||
| public DefaultTypeFactory( final URL[] urls ) | public DefaultTypeFactory( final URL[] urls ) | ||||
| @@ -7,7 +7,6 @@ | |||||
| */ | */ | ||||
| package org.apache.myrmidon.interfaces.workspace; | package org.apache.myrmidon.interfaces.workspace; | ||||
| import java.util.Map; | |||||
| import org.apache.avalon.framework.component.Component; | import org.apache.avalon.framework.component.Component; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.interfaces.model.Project; | import org.apache.myrmidon.interfaces.model.Project; | ||||
| @@ -13,7 +13,6 @@ import java.lang.reflect.Method; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLClassLoader; | import java.net.URLClassLoader; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Arrays; | |||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
| /** | /** | ||||
| @@ -46,17 +45,17 @@ public final class Main | |||||
| final File containerLibDir = new File( installDirectory, "bin" + File.separator + "lib" ); | final File containerLibDir = new File( installDirectory, "bin" + File.separator + "lib" ); | ||||
| final URL[] containerLibUrls = buildURLList( containerLibDir ); | final URL[] containerLibUrls = buildURLList( containerLibDir ); | ||||
| final URLClassLoader classLoader = | |||||
| final URLClassLoader classLoader = | |||||
| new URLClassLoader( containerLibUrls, libClassLoader ); | new URLClassLoader( containerLibUrls, libClassLoader ); | ||||
| //load class and retrieve appropriate main method. | //load class and retrieve appropriate main method. | ||||
| final Class clazz = classLoader.loadClass( "org.apache.myrmidon.frontends.CLIMain" ); | final Class clazz = classLoader.loadClass( "org.apache.myrmidon.frontends.CLIMain" ); | ||||
| final Method method = clazz.getMethod( "main", new Class[] { args.getClass() } ); | |||||
| final Method method = clazz.getMethod( "main", new Class[]{args.getClass()} ); | |||||
| Thread.currentThread().setContextClassLoader( classLoader ); | Thread.currentThread().setContextClassLoader( classLoader ); | ||||
| //kick the tires and light the fires.... | //kick the tires and light the fires.... | ||||
| method.invoke( null, new Object[] { args } ); | |||||
| method.invoke( null, new Object[]{args} ); | |||||
| } | } | ||||
| catch( final InvocationTargetException ite ) | catch( final InvocationTargetException ite ) | ||||
| { | { | ||||
| @@ -100,7 +99,7 @@ public final class Main | |||||
| } | } | ||||
| file = file.getCanonicalFile(); | file = file.getCanonicalFile(); | ||||
| urlList.add( file.toURL() ); | urlList.add( file.toURL() ); | ||||
| } | } | ||||
| @@ -123,7 +122,7 @@ public final class Main | |||||
| if( element.endsWith( "myrmidon-launcher.jar" ) ) | if( element.endsWith( "myrmidon-launcher.jar" ) ) | ||||
| { | { | ||||
| File file = (new File( element )).getAbsoluteFile(); | |||||
| File file = ( new File( element ) ).getAbsoluteFile(); | |||||
| file = file.getParentFile(); | file = file.getParentFile(); | ||||
| if( null != file ) | if( null != file ) | ||||
| @@ -7,8 +7,6 @@ | |||||
| */ | */ | ||||
| package org.apache.myrmidon.listeners; | package org.apache.myrmidon.listeners; | ||||
| import org.apache.avalon.framework.ExceptionUtil; | |||||
| /** | /** | ||||
| * Abstract listener from which to extend. | * Abstract listener from which to extend. | ||||
| * | * | ||||
| @@ -17,7 +17,7 @@ import org.apache.avalon.framework.ExceptionUtil; | |||||
| public class ClassicProjectListener | public class ClassicProjectListener | ||||
| extends AbstractProjectListener | extends AbstractProjectListener | ||||
| { | { | ||||
| private String m_prefix; | |||||
| private String m_prefix; | |||||
| /** | /** | ||||
| * Notify listener of targetStarted event. | * Notify listener of targetStarted event. | ||||
| @@ -76,8 +76,10 @@ public class ClassicProjectListener | |||||
| */ | */ | ||||
| protected void output( final String data ) | protected void output( final String data ) | ||||
| { | { | ||||
| if( null != getPrefix() ) System.out.println( "\t[" + getPrefix() + "] " + data ); | |||||
| else System.out.println( data ); | |||||
| if( null != getPrefix() ) | |||||
| System.out.println( "\t[" + getPrefix() + "] " + data ); | |||||
| else | |||||
| System.out.println( data ); | |||||
| } | } | ||||
| protected final String getPrefix() | protected final String getPrefix() | ||||
| @@ -17,8 +17,8 @@ import org.apache.avalon.framework.ExceptionUtil; | |||||
| public class DefaultProjectListener | public class DefaultProjectListener | ||||
| extends AbstractProjectListener | extends AbstractProjectListener | ||||
| { | { | ||||
| private String m_prefix; | |||||
| private String m_targetName; | |||||
| private String m_prefix; | |||||
| private String m_targetName; | |||||
| /** | /** | ||||
| * Notify listener of targetStarted event. | * Notify listener of targetStarted event. | ||||
| @@ -83,8 +83,10 @@ public class DefaultProjectListener | |||||
| m_targetName = null; | m_targetName = null; | ||||
| } | } | ||||
| if( null != getPrefix() ) System.out.println( "\t[" + getPrefix() + "] " + data ); | |||||
| else System.out.println( data ); | |||||
| if( null != getPrefix() ) | |||||
| System.out.println( "\t[" + getPrefix() + "] " + data ); | |||||
| else | |||||
| System.out.println( data ); | |||||
| } | } | ||||
| protected final String getPrefix() | protected final String getPrefix() | ||||