diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/Constants.java b/proposal/myrmidon/src/java/org/apache/myrmidon/Constants.java index 9542e7175..e0671893c 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/Constants.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/Constants.java @@ -9,14 +9,14 @@ package org.apache.myrmidon; /** * Abstract interface to hold constants. - * + * * @author Peter Donald */ public interface Constants { //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; } diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java b/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java index 1d6ccce4f..500f9cc19 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java @@ -119,8 +119,8 @@ public abstract class AbstractTask } protected final void setProperty( final String name, - final Object value, - final TaskContext.ScopeEnum scope ) + final Object value, + final TaskContext.ScopeEnum scope ) throws TaskException { getContext().setProperty( name, value, scope ); diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/api/JavaVersion.java b/proposal/myrmidon/src/java/org/apache/myrmidon/api/JavaVersion.java index 208b709a7..fd6708b90 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/api/JavaVersion.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/api/JavaVersion.java @@ -18,10 +18,10 @@ public final class JavaVersion extends ValuedEnum { //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. diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/api/Task.java b/proposal/myrmidon/src/java/org/apache/myrmidon/api/Task.java index 8a68397fa..86423556b 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/api/Task.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/api/Task.java @@ -9,8 +9,8 @@ package org.apache.myrmidon.api; /** * 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. * 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"; /** - * Execute task. + * Execute task. * This method is called to perform actual work associated with task. * It is called after Task has been Configured and Initialized and before * being Disposed (If task implements appropriate interfaces). diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/aspects/AbstractAspectHandler.java b/proposal/myrmidon/src/java/org/apache/myrmidon/aspects/AbstractAspectHandler.java index 3d196c445..606995063 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/aspects/AbstractAspectHandler.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/aspects/AbstractAspectHandler.java @@ -8,8 +8,8 @@ package org.apache.myrmidon.aspects; 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.parameters.Parameters; import org.apache.myrmidon.api.Task; import org.apache.myrmidon.api.TaskException; @@ -22,12 +22,12 @@ import org.apache.myrmidon.api.TaskException; public abstract class AbstractAspectHandler 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 ) throws TaskException diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/aspects/AspectHandler.java b/proposal/myrmidon/src/java/org/apache/myrmidon/aspects/AspectHandler.java index 40e7942b7..24f9b6d44 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/aspects/AspectHandler.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/aspects/AspectHandler.java @@ -8,8 +8,8 @@ package org.apache.myrmidon.aspects; 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.parameters.Parameters; import org.apache.myrmidon.api.Task; import org.apache.myrmidon.api.TaskException; diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ATIProjectBuilder.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ATIProjectBuilder.java index 7066a1cce..26d78e827 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ATIProjectBuilder.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ATIProjectBuilder.java @@ -13,13 +13,8 @@ import java.util.Properties; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; 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 org.apache.avalon.excalibur.i18n.ResourceManager; import org.apache.avalon.excalibur.i18n.Resources; @@ -41,8 +36,8 @@ public class ATIProjectBuilder private static final Resources REZ = 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 ) { @@ -62,7 +57,10 @@ public class ATIProjectBuilder final ReactorPIHandler reactorHandler = new ReactorPIHandler(); reader.setContentHandler( reactorHandler ); - try { reader.parse( sourceID.toString() ); } + try + { + reader.parse( sourceID.toString() ); + } catch( final StopParsingException spe ) { //Ignore me @@ -76,8 +74,10 @@ public class ATIProjectBuilder final String target = reactorHandler.getTarget( 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" ) ) { if( null != transformer ) @@ -180,7 +180,10 @@ public class ATIProjectBuilder throw new SAXException( message ); } - try { return new URL( baseSource, stylesheet[ 1 ] ).toString(); } + try + { + return new URL( baseSource, stylesheet[ 1 ] ).toString(); + } catch( final Exception e ) { final String message = diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java index 632538552..cb33bf2fb 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java @@ -8,7 +8,6 @@ package org.apache.myrmidon.components.builder; import java.io.File; -import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; @@ -16,22 +15,16 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.apache.avalon.excalibur.i18n.ResourceManager; 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.configuration.Configuration; -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.parameters.Parameters; -import org.apache.log.Logger; -import org.apache.myrmidon.api.TaskContext; import org.apache.myrmidon.components.model.DefaultProject; import org.apache.myrmidon.framework.Condition; import org.apache.myrmidon.interfaces.builder.ProjectBuilder; import org.apache.myrmidon.interfaces.model.Project; import org.apache.myrmidon.interfaces.model.Target; import org.apache.myrmidon.interfaces.model.TypeLib; -import org.xml.sax.SAXException; import org.xml.sax.XMLReader; /** @@ -46,10 +39,10 @@ public class DefaultProjectBuilder private static final Resources REZ = 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. @@ -135,7 +128,7 @@ public class DefaultProjectBuilder //determine base directory for project final File baseDirectory = - (new File( file.getParentFile(), baseDirectoryName )).getAbsoluteFile(); + ( new File( file.getParentFile(), baseDirectoryName ) ).getAbsoluteFile(); 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 { final String message = @@ -406,7 +400,9 @@ public class DefaultProjectBuilder protected boolean validName( final String name ) { - if( -1 != name.indexOf( "->" ) ) return false; - else return true; + if( -1 != name.indexOf( "->" ) ) + return false; + else + return true; } } diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ReactorPIHandler.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ReactorPIHandler.java index 227d9dcab..34cd29314 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ReactorPIHandler.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ReactorPIHandler.java @@ -22,8 +22,8 @@ import org.xml.sax.helpers.DefaultHandler; public class ReactorPIHandler 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() { @@ -46,7 +46,7 @@ public class ReactorPIHandler m_targets.add( target ); m_data.add( data ); } - + public void startElement( final String uri, final String localName, final String qName, diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java index 7c91f7f52..f32b7bec2 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java @@ -92,7 +92,7 @@ public class DefaultConfigurer getLogger().debug( "Configuring object via Configurable interface" ); } - ((Configurable)object).configure( configuration ); + ( (Configurable)object ).configure( configuration ); } else { @@ -317,14 +317,22 @@ public class DefaultConfigurer 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 { final String message = REZ.getString( "no-complex-type.error", clazz.getName() ); @@ -341,7 +349,7 @@ public class DefaultConfigurer { final Method method = methods[ i ]; if( methodName.equals( method.getName() ) && - Method.PUBLIC == (method.getModifiers() & Method.PUBLIC) ) + Method.PUBLIC == ( method.getModifiers() & Method.PUBLIC ) ) { if( method.getReturnType().equals( Void.TYPE ) ) { @@ -366,7 +374,7 @@ public class DefaultConfigurer { final Method method = methods[ i ]; if( methodName.equals( method.getName() ) && - Method.PUBLIC == (method.getModifiers() & Method.PUBLIC) ) + Method.PUBLIC == ( method.getModifiers() & Method.PUBLIC ) ) { final Class returnType = method.getReturnType(); if( !returnType.equals( Void.TYPE ) && diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultConverterRegistry.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultConverterRegistry.java index 0bc15c591..13528f404 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultConverterRegistry.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultConverterRegistry.java @@ -18,7 +18,7 @@ import org.apache.myrmidon.interfaces.converter.ConverterRegistry; public class DefaultConverterRegistry 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 ) { @@ -27,8 +27,8 @@ public class DefaultConverterRegistry 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 ) { HashMap map = (HashMap)m_mapping.get( source ); diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultMasterConverter.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultMasterConverter.java index 635e6dadb..a7780d23c 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultMasterConverter.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultMasterConverter.java @@ -7,20 +7,20 @@ */ 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.ComponentManager; import org.apache.avalon.framework.component.Composable; 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.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.MasterConverter; import org.apache.myrmidon.interfaces.type.TypeException; import org.apache.myrmidon.interfaces.type.TypeFactory; 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. @@ -34,10 +34,10 @@ public class DefaultMasterConverter private static final Resources REZ = 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. @@ -51,7 +51,10 @@ public class DefaultMasterConverter m_registry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.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 ) { final String message = REZ.getString( "no-converter-factory.error" ); @@ -80,9 +83,9 @@ public class DefaultMasterConverter if( DEBUG ) { - final String message = - REZ.getString( "converter-lookup.notice", - originalClass.getName(), + final String message = + REZ.getString( "converter-lookup.notice", + originalClass.getName(), destination.getName() ); getLogger().debug( message ); } @@ -93,9 +96,9 @@ public class DefaultMasterConverter 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() ); throw new ConverterException( message ); } diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultDeployer.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultDeployer.java index 51cdd6a71..83a92d15b 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultDeployer.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultDeployer.java @@ -8,31 +8,30 @@ package org.apache.myrmidon.components.deployer; import java.io.File; -import java.net.URL; +import java.net.JarURLConnection; import java.net.MalformedURLException; +import java.net.URL; import java.net.URLClassLoader; -import java.net.JarURLConnection; -import java.util.Arrays; import java.util.ArrayList; +import java.util.Arrays; import java.util.Enumeration; -import java.util.jar.Manifest; import java.util.HashMap; +import java.util.jar.Manifest; import javax.xml.parsers.SAXParser; 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.OptionalPackage; +import org.apache.avalon.excalibur.extension.PackageManager; import org.apache.avalon.excalibur.i18n.ResourceManager; import org.apache.avalon.excalibur.i18n.Resources; import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; 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.ConfigurationException; +import org.apache.avalon.framework.configuration.SAXConfigurationHandler; import org.apache.avalon.framework.logger.AbstractLogEnabled; -import org.apache.myrmidon.api.Task; import org.apache.myrmidon.converter.Converter; import org.apache.myrmidon.interfaces.converter.ConverterRegistry; 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.type.DefaultTypeFactory; import org.apache.myrmidon.interfaces.type.TypeManager; -import org.xml.sax.SAXException; import org.xml.sax.XMLReader; /** @@ -58,10 +56,10 @@ public class DefaultDeployer 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. @@ -126,7 +124,7 @@ public class DefaultDeployer final URL[] urls = buildClasspath( file, extensions ); final Deployment deployment = new Deployment( file ); final Configuration descriptor = deployment.getDescriptor(); - + final URLClassLoader classLoader = new URLClassLoader( urls, Thread.currentThread().getContextClassLoader() ); @@ -218,7 +216,7 @@ public class DefaultDeployer throws MalformedURLException { final URL[] urls = new URL[ dependencies.length + 1 ]; - + for( int i = 0; i < dependencies.length; i++ ) { urls[ i ] = dependencies[ i ].toURL(); @@ -247,10 +245,10 @@ public class DefaultDeployer if( getLogger().isDebugEnabled() ) { - final String message1 = + final String message1 = REZ.getString( "available-extensions", Arrays.asList( available ) ); getLogger().debug( message1 ); - final String message2 = + final String message2 = REZ.getString( "required-extensions", Arrays.asList( required ) ); getLogger().debug( message2 ); } @@ -271,12 +269,12 @@ public class DefaultDeployer final Extension extension = (Extension)unsatisfied.get( i ); final Object[] params = new Object[] { - extension.getExtensionName(), - extension.getSpecificationVendor(), + extension.getExtensionName(), + extension.getSpecificationVendor(), extension.getSpecificationVersion(), - extension.getImplementationVendor(), + extension.getImplementationVendor(), extension.getImplementationVendorId(), - extension.getImplementationVersion(), + extension.getImplementationVersion(), extension.getImplementationURL() }; final String message = REZ.format( "missing.extension", params ); diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/Deployment.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/Deployment.java index 40306822e..9f8bae51e 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/Deployment.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/Deployment.java @@ -9,7 +9,6 @@ package org.apache.myrmidon.components.deployer; import java.io.File; import java.io.IOException; -import java.net.MalformedURLException; import java.net.URL; import javax.xml.parsers.ParserConfigurationException; 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.Resources; import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.configuration.SAXConfigurationHandler; +import org.apache.myrmidon.interfaces.deployer.DeploymentException; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; -import org.apache.myrmidon.interfaces.deployer.DeploymentException; /** * This class deploys a .tsk file into a registry. @@ -33,17 +31,17 @@ public class Deployment private static final Resources REZ = 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 ) { m_file = file; } - + public Configuration getDescriptor() throws DeploymentException { @@ -58,7 +56,10 @@ public class Deployment public URL getURL() throws DeploymentException { - try { return m_file.getCanonicalFile().toURL(); } + try + { + return m_file.getCanonicalFile().toURL(); + } catch( final IOException ioe ) { final String message = REZ.getString( "bad-url.error", m_file ); diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java index 6684da70a..1b7ba1b03 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java @@ -9,7 +9,6 @@ package org.apache.myrmidon.components.embeddor; import java.io.File; import java.io.FilenameFilter; -import java.util.Map; import org.apache.avalon.excalibur.i18n.ResourceManager; import org.apache.avalon.excalibur.i18n.Resources; 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.deployer.Deployer; 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.extensions.ExtensionManager; -import org.apache.myrmidon.interfaces.embeddor.Embeddor; import org.apache.myrmidon.interfaces.model.Project; import org.apache.myrmidon.interfaces.role.RoleManager; import org.apache.myrmidon.interfaces.type.TypeFactory; @@ -51,26 +50,26 @@ public class DefaultEmbeddor private static final Resources REZ = 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. @@ -114,17 +113,17 @@ public class DefaultEmbeddor if( builder instanceof Composable ) { - ((Composable)builder).compose( m_componentManager ); + ( (Composable)builder ).compose( m_componentManager ); } if( builder instanceof Parameterizable ) { - ((Parameterizable)builder).parameterize( parameters ); + ( (Parameterizable)builder ).parameterize( parameters ); } if( builder instanceof Initializable ) { - ((Initializable)builder).initialize(); + ( (Initializable)builder ).initialize(); } return builder; @@ -139,20 +138,19 @@ public class DefaultEmbeddor setupLogger( workspace ); - if( workspace instanceof Composable ) { - ((Composable)workspace).compose( m_componentManager ); + ( (Composable)workspace ).compose( m_componentManager ); } if( workspace instanceof Parameterizable ) { - ((Parameterizable)workspace).parameterize( parameters ); + ( (Parameterizable)workspace ).parameterize( parameters ); } if( workspace instanceof Initializable ) { - ((Initializable)workspace).initialize(); + ( (Initializable)workspace ).initialize(); } return workspace; @@ -350,17 +348,17 @@ public class DefaultEmbeddor if( component instanceof Composable ) { - ((Composable)component).compose( m_componentManager ); + ( (Composable)component ).compose( m_componentManager ); } if( component instanceof Parameterizable ) { - ((Parameterizable)component).parameterize( m_parameters ); + ( (Parameterizable)component ).parameterize( m_parameters ); } if( component instanceof Initializable ) { - ((Initializable)component).initialize(); + ( (Initializable)component ).initialize(); } } @@ -373,7 +371,7 @@ public class DefaultEmbeddor String filepath = null; filepath = getParameter( "myrmidon.home" ); - m_homeDir = (new File( filepath )).getAbsoluteFile(); + m_homeDir = ( new File( filepath ) ).getAbsoluteFile(); checkDirectory( m_homeDir, "home" ); filepath = getParameter( "myrmidon.bin.path" ); @@ -457,7 +455,9 @@ public class DefaultEmbeddor Class.forName( "java.lang.StrictMath" ); version = JavaVersion.JAVA1_3; } - catch( final ClassNotFoundException cnfe ) {} + catch( final ClassNotFoundException cnfe ) + { + } return version; } diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java index 76a078576..7a676975a 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/AspectAwareExecutor.java @@ -14,15 +14,12 @@ import org.apache.avalon.excalibur.i18n.Resources; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; 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.parameters.Parameters; +import org.apache.avalon.framework.configuration.DefaultConfiguration; 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.TaskContext; import org.apache.myrmidon.api.TaskException; -import org.apache.myrmidon.aspects.AspectHandler; import org.apache.myrmidon.interfaces.aspect.AspectManager; import org.apache.myrmidon.interfaces.executor.ExecutionFrame; @@ -32,8 +29,8 @@ public class AspectAwareExecutor private static final Resources REZ = 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 { @@ -41,7 +38,7 @@ public class AspectAwareExecutor EMPTY_PARAMETERS.makeReadOnly(); } - private AspectManager m_aspectManager; + private AspectManager m_aspectManager; /** * Retrieve relevent services. @@ -158,7 +155,8 @@ public class AspectAwareExecutor if( null == parameters ) parameters = EMPTY_PARAMETERS; Configuration[] elements = null; - if( null == elementList ) elements = EMPTY_ELEMENTS; + if( null == elementList ) + elements = EMPTY_ELEMENTS; else { elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); @@ -185,7 +183,8 @@ public class AspectAwareExecutor Configuration[] elements = null; - if( null == elementList ) elements = EMPTY_ELEMENTS; + if( null == elementList ) + elements = EMPTY_ELEMENTS; else { elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutionFrame.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutionFrame.java index af67643dc..42f28691e 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutionFrame.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutionFrame.java @@ -10,21 +10,12 @@ package org.apache.myrmidon.components.executor; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; 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.Contextualizable; import org.apache.avalon.framework.logger.LogEnabled; import org.apache.avalon.framework.logger.Logger; 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.role.RoleManager; import org.apache.myrmidon.interfaces.type.TypeManager; /** @@ -35,11 +26,11 @@ import org.apache.myrmidon.interfaces.type.TypeManager; public class DefaultExecutionFrame 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 ) { diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java index a655b3e04..f8e59af70 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java @@ -11,14 +11,10 @@ import org.apache.avalon.excalibur.i18n.ResourceManager; 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.component.Component; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; 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.context.Context; import org.apache.avalon.framework.context.Contextualizable; import org.apache.avalon.framework.logger.AbstractLogEnabled; 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.TaskContext; import org.apache.myrmidon.api.TaskException; -import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.interfaces.configurer.Configurer; import org.apache.myrmidon.interfaces.executor.ExecutionFrame; import org.apache.myrmidon.interfaces.executor.Executor; import org.apache.myrmidon.interfaces.type.TypeException; import org.apache.myrmidon.interfaces.type.TypeFactory; -import org.apache.myrmidon.interfaces.type.TypeManager; public class DefaultExecutor extends AbstractLogEnabled @@ -41,7 +35,7 @@ public class DefaultExecutor private static final Resources REZ = ResourceManager.getPackageResources( DefaultExecutor.class ); - private Configurer m_configurer; + private Configurer m_configurer; /** * Retrieve relevent services needed to deploy. @@ -112,7 +106,10 @@ public class DefaultExecutor final TaskContext context ) throws TaskException { - try { m_configurer.configure( task, taskModel, context ); } + try + { + m_configurer.configure( task, taskModel, context ); + } catch( final Throwable throwable ) { final String message = @@ -131,7 +128,10 @@ public class DefaultExecutor { if( task instanceof Composable ) { - try { ((Composable)task).compose( componentManager ); } + try + { + ( (Composable)task ).compose( componentManager ); + } catch( final Throwable throwable ) { final String message = @@ -153,7 +153,7 @@ public class DefaultExecutor { if( task instanceof Contextualizable ) { - ((Contextualizable)task).contextualize( context ); + ( (Contextualizable)task ).contextualize( context ); } } catch( final Throwable throwable ) @@ -172,7 +172,10 @@ public class DefaultExecutor { if( task instanceof Disposable ) { - try { ((Disposable)task).dispose(); } + try + { + ( (Disposable)task ).dispose(); + } catch( final Throwable throwable ) { final String message = @@ -192,7 +195,10 @@ public class DefaultExecutor { if( task instanceof LogEnabled ) { - try { ((LogEnabled)task).enableLogging( logger ); } + try + { + ( (LogEnabled)task ).enableLogging( logger ); + } catch( final Throwable throwable ) { final String message = @@ -210,7 +216,10 @@ public class DefaultExecutor { if( task instanceof Initializable ) { - try { ((Initializable)task).initialize(); } + try + { + ( (Initializable)task ).initialize(); + } catch( final Throwable throwable ) { final String message = diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/PrintingExecutor.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/PrintingExecutor.java index 6ba68aa49..d22029f28 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/PrintingExecutor.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/PrintingExecutor.java @@ -7,9 +7,9 @@ */ package org.apache.myrmidon.components.executor; +import org.apache.avalon.framework.configuration.Configuration; import org.apache.myrmidon.api.Task; import org.apache.myrmidon.api.TaskException; -import org.apache.avalon.framework.configuration.Configuration; public class PrintingExecutor extends AspectAwareExecutor @@ -19,23 +19,22 @@ public class PrintingExecutor { final StringBuffer sb = new StringBuffer(); printConfiguration( taskModel, 0, sb ); - + 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 ) { for( int i = 0; i < level; i++ ) { sb.append( ' ' ); } - + sb.append( '<' ); sb.append( taskModel.getName() ); - final String[] names = taskModel.getAttributeNames(); for( int i = 0; i < names.length; i++ ) { diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/DefaultProject.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/DefaultProject.java index 53af890f1..b5be81b79 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/DefaultProject.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/DefaultProject.java @@ -8,7 +8,6 @@ package org.apache.myrmidon.components.model; import java.io.File; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import org.apache.avalon.excalibur.i18n.ResourceManager; @@ -29,22 +28,22 @@ public class DefaultProject ResourceManager.getPackageResources( DefaultProject.class ); ///The imports - private final ArrayList m_imports = new ArrayList(); + private final ArrayList m_imports = new ArrayList(); ///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 - private final HashMap m_targets = new HashMap(); + private final HashMap m_targets = new HashMap(); ///The implicit target (not present in m_targets) - private Target m_implicitTarget; + private Target m_implicitTarget; ///The name of the default target - private String m_defaultTarget; + private String m_defaultTarget; ///The base directory of project - private File m_baseDirectory; + private File m_baseDirectory; /** * Get the imports for project. diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/role/DefaultRoleManager.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/role/DefaultRoleManager.java index eb0ea5135..82138e5ef 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/role/DefaultRoleManager.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/role/DefaultRoleManager.java @@ -19,7 +19,6 @@ import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.configuration.SAXConfigurationHandler; import org.apache.myrmidon.interfaces.role.RoleManager; -import org.xml.sax.SAXException; import org.xml.sax.XMLReader; /** @@ -37,13 +36,13 @@ public class DefaultRoleManager private final static String ROLE_DESCRIPTOR = "META-INF/ant-roles.xml"; /** Parent RoleManager for nested resolution */ - private final RoleManager m_parent; + private final RoleManager m_parent; /** 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 */ - private final HashMap m_roles = new HashMap(); + private final HashMap m_roles = new HashMap(); /** * constructor--this RoleManager has no parent. diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/type/DefaultTypeManager.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/type/DefaultTypeManager.java index 2900f3a3f..1562c02a6 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/type/DefaultTypeManager.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/type/DefaultTypeManager.java @@ -10,9 +10,9 @@ package org.apache.myrmidon.components.type; import java.util.HashMap; import org.apache.avalon.excalibur.i18n.ResourceManager; 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.TypeManager; -import org.apache.myrmidon.interfaces.type.TypeException; /** * The interface that is used to manage types. @@ -26,10 +26,10 @@ public class DefaultTypeManager ResourceManager.getPackageResources( DefaultTypeManager.class ); ///Parent type manager to inherit values from. - private final DefaultTypeManager m_parent; + private final DefaultTypeManager m_parent; ///Maps role to MultiSourceTypeFactory. - private final HashMap m_roleMap = new HashMap(); + private final HashMap m_roleMap = new HashMap(); public DefaultTypeManager() { @@ -41,9 +41,9 @@ public class DefaultTypeManager 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 { final MultiSourceTypeFactory msFactory = createFactory( role ); @@ -72,18 +72,18 @@ public class DefaultTypeManager * * @param role the role name(must be name of work 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 ) throws TypeException { MultiSourceTypeFactory factory = (MultiSourceTypeFactory)m_roleMap.get( role ); - if( null != factory ) + if( null != factory ) { return factory; } - final MultiSourceTypeFactory parentFactory = getParentTypedFactory( role ); + final MultiSourceTypeFactory parentFactory = getParentTypedFactory( role ); if( null != parentFactory ) { factory = new MultiSourceTypeFactory( parentFactory ); @@ -103,7 +103,7 @@ public class DefaultTypeManager final String message = REZ.getString( "no-work-interface.error", role ); throw new TypeException( message ); } - } + } m_roleMap.put( role, factory ); @@ -117,7 +117,7 @@ public class DefaultTypeManager return m_parent.lookupFactory( role ); } else - { + { return null; } } diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/type/MultiSourceTypeFactory.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/type/MultiSourceTypeFactory.java index 464743e36..40896b663 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/type/MultiSourceTypeFactory.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/type/MultiSourceTypeFactory.java @@ -10,8 +10,8 @@ package org.apache.myrmidon.components.type; import java.util.HashMap; import org.apache.avalon.excalibur.i18n.ResourceManager; 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.TypeFactory; /** * This factory acts as a proxy to set of object factorys. @@ -25,13 +25,13 @@ public class MultiSourceTypeFactory ResourceManager.getPackageResources( MultiSourceTypeFactory.class ); ///Parent Selector - private final MultiSourceTypeFactory m_parent; + private final MultiSourceTypeFactory m_parent; ///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 - private final Class m_type; + private final Class m_type; public MultiSourceTypeFactory( final Class type ) { diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java index a4619f890..caf958905 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java @@ -12,8 +12,6 @@ import java.util.Map; import org.apache.avalon.excalibur.i18n.ResourceManager; import org.apache.avalon.excalibur.i18n.Resources; 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.DefaultContext; import org.apache.myrmidon.api.JavaVersion; @@ -63,7 +61,10 @@ public class DefaultTaskContext */ public JavaVersion getJavaVersion() { - try { return (JavaVersion)get( JAVA_VERSION ); } + try + { + return (JavaVersion)get( JAVA_VERSION ); + } catch( final ContextException ce ) { final String message = REZ.getString( "no-version.error" ); @@ -71,7 +72,6 @@ public class DefaultTaskContext } } - /** * Retrieve Name of tasklet. * @@ -79,7 +79,10 @@ public class DefaultTaskContext */ public String getName() { - try { return (String)get( NAME ); } + try + { + return (String)get( NAME ); + } catch( final ContextException ce ) { final String message = REZ.getString( "no-name.error" ); @@ -94,7 +97,10 @@ public class DefaultTaskContext */ public File getBaseDirectory() { - try { return (File)get( BASE_DIRECTORY ); } + try + { + return (File)get( BASE_DIRECTORY ); + } catch( final ContextException ce ) { final String message = REZ.getString( "no-dir.error" ); @@ -125,7 +131,10 @@ public class DefaultTaskContext */ public Object getProperty( final String name ) { - try { return get( name ); } + try + { + return get( name ); + } catch( final ContextException ce ) { return null; @@ -154,7 +163,8 @@ public class DefaultTaskContext { checkPropertyValid( name, value ); - if( CURRENT == scope ) put( name, value ); + if( CURRENT == scope ) + put( name, value ); else if( PARENT == scope ) { if( null == getParent() ) @@ -164,7 +174,7 @@ public class DefaultTaskContext } else { - ((TaskContext)getParent()).setProperty( name, value ); + ( (TaskContext)getParent() ).setProperty( name, value ); } } else if( TOP_LEVEL == scope ) @@ -217,19 +227,19 @@ public class DefaultTaskContext { if( BASE_DIRECTORY.equals( name ) && !( value instanceof File ) ) { - final String message = + final String message = REZ.getString( "bad-property.error", BASE_DIRECTORY, File.class.getName() ); throw new TaskException( message ); } else if( NAME.equals( name ) && !( value instanceof String ) ) { - final String message = + final String message = REZ.getString( "bad-property.error", NAME, String.class.getName() ); throw new TaskException( message ); } 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() ); throw new TaskException( message ); } diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java index 3f576f6f4..e57881217 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java @@ -8,13 +8,11 @@ package org.apache.myrmidon.components.workspace; import java.io.File; -import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.avalon.excalibur.i18n.ResourceManager; 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.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; @@ -57,15 +55,15 @@ public class DefaultWorkspace private static final Resources REZ = 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. @@ -140,7 +138,6 @@ public class DefaultWorkspace m_listenerSupport.projectFinished(); } - private TaskContext createBaseContext() throws TaskException { @@ -239,7 +236,10 @@ public class DefaultWorkspace final DefaultDeployer deployer = new DefaultDeployer(); deployer.enableLogging( getLogger() ); - try { deployer.compose( componentManager ); } + try + { + deployer.compose( componentManager ); + } catch( final ComponentException ce ) { final String message = REZ.getString( "bad-deployer-config.error" ); diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/LogTargetToListenerAdapter.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/LogTargetToListenerAdapter.java index ce45736bb..cf2acbe70 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/LogTargetToListenerAdapter.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/LogTargetToListenerAdapter.java @@ -19,7 +19,7 @@ import org.apache.myrmidon.listeners.ProjectListener; public class LogTargetToListenerAdapter implements LogTarget { - private final ProjectListener m_listener; + private final ProjectListener m_listener; /** * Constructor taking listener to convert to. diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/ProjectEntry.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/ProjectEntry.java index 09ba68c2c..cae7806b5 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/ProjectEntry.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/ProjectEntry.java @@ -18,9 +18,9 @@ import org.apache.myrmidon.interfaces.model.Project; */ 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, final ExecutionFrame frame ) diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/ProjectListenerSupport.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/ProjectListenerSupport.java index 1283814a3..4ad503acd 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/ProjectListenerSupport.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/ProjectListenerSupport.java @@ -17,7 +17,7 @@ import org.apache.myrmidon.listeners.ProjectListener; public class ProjectListenerSupport 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. diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/converter/AbstractConverter.java b/proposal/myrmidon/src/java/org/apache/myrmidon/converter/AbstractConverter.java index e7d50ec19..5674f5283 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/converter/AbstractConverter.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/converter/AbstractConverter.java @@ -22,8 +22,8 @@ public abstract class AbstractConverter private static final Resources REZ = 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 diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractContainerTask.java b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractContainerTask.java index 24958095b..617bfc63e 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractContainerTask.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractContainerTask.java @@ -17,12 +17,11 @@ import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; 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.converter.MasterConverter; 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. @@ -37,13 +36,13 @@ public abstract class AbstractContainerTask ResourceManager.getPackageResources( AbstractContainerTask.class ); ///For converting own attributes - private MasterConverter m_converter; + private MasterConverter m_converter; ///For configuring own sub-elements - private Configurer m_configurer; + private Configurer m_configurer; ///For executing sub-elements as tasks - private Executor m_executor; + private Executor m_executor; public void compose( final ComponentManager componentManager ) throws ComponentException @@ -118,7 +117,6 @@ public abstract class AbstractContainerTask getConfigurer().configure( object, element, getContext() ); } - /** * Configure an objects attribute using parameters. * diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractTypeDef.java b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractTypeDef.java index 3c3ab84eb..9024a6380 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractTypeDef.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractTypeDef.java @@ -36,11 +36,11 @@ public abstract class AbstractTypeDef private static final Resources REZ = 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 ) throws ComponentException @@ -86,7 +86,10 @@ public abstract class AbstractTypeDef final DefaultTypeFactory factory = new DefaultTypeFactory( classLoader ); 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 ) { final String message = REZ.getString( "typedef.no-register.error" ); @@ -104,7 +107,7 @@ public abstract class AbstractTypeDef final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - return new URLClassLoader( new URL[] { url }, classLoader ); + return new URLClassLoader( new URL[]{url}, classLoader ); } catch( final Exception e ) { diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Condition.java b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Condition.java index ee31b4c22..1cec338c3 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Condition.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Condition.java @@ -14,7 +14,6 @@ import org.apache.avalon.excalibur.property.PropertyUtil; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.context.ContextException; -import org.apache.myrmidon.api.TaskException; /** * Class representing a condition. @@ -27,8 +26,8 @@ public class Condition private static final Resources REZ = 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 ) { diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/DataType.java b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/DataType.java index 7891b871e..db92fef1b 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/DataType.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/DataType.java @@ -9,7 +9,7 @@ package org.apache.myrmidon.framework; /** * Base class for those classes that can appear inside the build file - * as stand alone data types. + * as stand alone data types. * * @author Peter Donald */ diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Os.java b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Os.java index c8e3c01a9..8c1035e18 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Os.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Os.java @@ -99,67 +99,88 @@ public class Os final String arch, final String version ) { - boolean retValue = false; - 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; } /** diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Pattern.java b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Pattern.java index 7123b47f9..dad8f1e34 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Pattern.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Pattern.java @@ -22,8 +22,8 @@ public class Pattern private static final Resources REZ = ResourceManager.getPackageResources( Pattern.class ); - private String m_value; - private Condition m_condition; + private String m_value; + private Condition m_condition; /** * Retrieve value of pattern. diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/TypeInstanceTask.java b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/TypeInstanceTask.java index 07a72de7e..ae63a9069 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/TypeInstanceTask.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/TypeInstanceTask.java @@ -11,7 +11,6 @@ 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.ComponentManager; -import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; @@ -34,10 +33,10 @@ public class TypeInstanceTask private static final Resources REZ = 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 ) throws ComponentException @@ -45,7 +44,10 @@ public class TypeInstanceTask super.compose( componentManager ); 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 ) { final String message = REZ.getString( "type.no-factory.error" ); diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java b/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java index 1344383c7..52bd15b34 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java @@ -9,14 +9,8 @@ package org.apache.myrmidon.frontends; import java.io.BufferedReader; import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.List; 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.CLOptionDescriptor; 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.logger.AbstractLogEnabled; 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.api.TaskContext; 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.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.workspace.Workspace; 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. @@ -61,22 +53,22 @@ public class CLIMain ResourceManager.getPackageResources( CLIMain.class ); //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 - 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, LOG_LEVEL_OPT, VERSION_OPT, LISTENER_OPT, @@ -84,27 +76,27 @@ public class CLIMain }; //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 }; - private ProjectListener m_listener; + private ProjectListener m_listener; ///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 - private ArrayList m_targets = new ArrayList(); + private ArrayList m_targets = new ArrayList(); ///List of user supplied defines - private Parameters m_defines = new Parameters(); + private Parameters m_defines = new Parameters(); ///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 - private boolean m_dryRun = false; + private boolean m_dryRun = false; /** * Main entry point called to run standard Myrmidon. @@ -115,12 +107,15 @@ public class CLIMain { final CLIMain main = new CLIMain(); - try { main.execute( args ); } + try + { + main.execute( args ); + } catch( final Throwable throwable ) { - final String message = + final String message = REZ.getString( "error-message", ExceptionUtil.printStackTrace( throwable ) ); - System.err.println( message ); + System.err.println( message ); System.exit( -1 ); } @@ -134,7 +129,7 @@ public class CLIMain private void usage( final CLOptionDescriptor[] options ) { System.out.println( "java " + getClass().getName() + " [options]" ); - System.out.println( "\tAvailable options:"); + System.out.println( "\tAvailable options:" ); System.out.println( CLUtil.describeOptions( options ) ); } @@ -145,74 +140,74 @@ public class CLIMain { //TODO: localise final CLOptionDescriptor[] options = new CLOptionDescriptor[ 13 ]; - options[0] = + options[ 0 ] = new CLOptionDescriptor( "help", CLOptionDescriptor.ARGUMENT_DISALLOWED, HELP_OPT, REZ.getString( "help.opt" ), INFO_OPT_INCOMPAT ); - options[1] = + options[ 1 ] = new CLOptionDescriptor( "file", CLOptionDescriptor.ARGUMENT_REQUIRED, FILE_OPT, REZ.getString( "file.opt" ) ); - options[2] = + options[ 2 ] = new CLOptionDescriptor( "log-level", CLOptionDescriptor.ARGUMENT_REQUIRED, LOG_LEVEL_OPT, REZ.getString( "log-level.opt" ), LOG_OPT_INCOMPAT ); - options[3] = + options[ 3 ] = new CLOptionDescriptor( "quiet", CLOptionDescriptor.ARGUMENT_DISALLOWED, QUIET_OPT, REZ.getString( "quiet.opt" ), LOG_OPT_INCOMPAT ); - options[4] = + options[ 4 ] = new CLOptionDescriptor( "verbose", CLOptionDescriptor.ARGUMENT_DISALLOWED, VERBOSE_OPT, REZ.getString( "verbose.opt" ), LOG_OPT_INCOMPAT ); - options[5] = + options[ 5 ] = new CLOptionDescriptor( "listener", CLOptionDescriptor.ARGUMENT_REQUIRED, LISTENER_OPT, REZ.getString( "listener.opt" ) ); - options[6] = + options[ 6 ] = new CLOptionDescriptor( "version", CLOptionDescriptor.ARGUMENT_DISALLOWED, VERSION_OPT, REZ.getString( "version.opt" ), INFO_OPT_INCOMPAT ); - options[7] = + options[ 7 ] = new CLOptionDescriptor( "task-lib-dir", CLOptionDescriptor.ARGUMENT_REQUIRED, TASKLIB_DIR_OPT, REZ.getString( "tasklib.opt" ) ); - options[8] = + options[ 8 ] = new CLOptionDescriptor( "incremental", CLOptionDescriptor.ARGUMENT_DISALLOWED, INCREMENTAL_OPT, REZ.getString( "incremental.opt" ) ); - options[9] = + options[ 9 ] = new CLOptionDescriptor( "myrmidon-home", CLOptionDescriptor.ARGUMENT_REQUIRED, HOME_DIR_OPT, REZ.getString( "home.opt" ) ); - options[10] = + options[ 10 ] = new CLOptionDescriptor( "define", CLOptionDescriptor.ARGUMENTS_REQUIRED_2, DEFINE_OPT, REZ.getString( "define.opt" ), new int[ 0 ] ); - options[11] = + options[ 11 ] = new CLOptionDescriptor( "builder-parameter", CLOptionDescriptor.ARGUMENTS_REQUIRED_2, BUILDER_PARAM_OPT, REZ.getString( "build.opt" ) ); - options[12] = + options[ 12 ] = new CLOptionDescriptor( "dry-run", CLOptionDescriptor.ARGUMENT_DISALLOWED, DRY_RUN_OPT, @@ -241,34 +236,56 @@ public class CLIMain 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 ) ) ); 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() ) { 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 File buildFile = (new File( filename )).getCanonicalFile(); + final File buildFile = ( new File( filename ) ).getCanonicalFile(); if( !buildFile.isFile() ) { final String message = REZ.getString( "bad-file.error", buildFile ); @@ -337,7 +354,7 @@ public class CLIMain if( m_dryRun ) { - m_parameters.setParameter( Executor.ROLE, + m_parameters.setParameter( Executor.ROLE, "org.apache.myrmidon.components.executor.PrintingExecutor" ); } @@ -348,7 +365,7 @@ public class CLIMain embeddor.start(); //create the project - final Project project = + final Project project = embeddor.createProject( buildFile.toString(), null, m_builderParameters ); BufferedReader reader = null; @@ -413,7 +430,7 @@ public class CLIMain } catch( final TaskException ae ) { - final String message = + final String message = REZ.getString( "build-failed.error", ExceptionUtil.printStackTrace( ae, 5, true ) ); getLogger().error( message ); } @@ -442,7 +459,7 @@ public class CLIMain final DefaultOutputLogTarget target = new DefaultOutputLogTarget(); target.setFormat( "[%8.8{category}] %{message}\\n%{throwable}" ); - logger.setLogTargets( new LogTarget[] { target } ); + logger.setLogTargets( new LogTarget[]{target} ); logger.setPriority( priority ); @@ -457,12 +474,15 @@ public class CLIMain private ProjectListener createListener( final String listener ) throws Exception { - try { return (ProjectListener)Class.forName( listener ).newInstance(); } + try + { + return (ProjectListener)Class.forName( listener ).newInstance(); + } 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 ) ); throw new Exception( message ); } diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/builder/ProjectBuilder.java b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/builder/ProjectBuilder.java index a65beadc4..1c2e4b15a 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/builder/ProjectBuilder.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/builder/ProjectBuilder.java @@ -7,8 +7,6 @@ */ package org.apache.myrmidon.interfaces.builder; -import java.io.File; -import java.io.IOException; import org.apache.avalon.framework.component.Component; import org.apache.myrmidon.interfaces.model.Project; diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java index 1a9105ecf..540c6a64e 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java @@ -7,7 +7,6 @@ */ package org.apache.myrmidon.interfaces.embeddor; -import java.util.Map; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.activity.Startable; diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/executor/ExecutionFrame.java b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/executor/ExecutionFrame.java index b55e92ef7..caa1fabfe 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/executor/ExecutionFrame.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/executor/ExecutionFrame.java @@ -20,7 +20,10 @@ import org.apache.myrmidon.interfaces.type.TypeManager; public interface ExecutionFrame { TypeManager getTypeManager(); + Logger getLogger(); + TaskContext getContext(); + ComponentManager getComponentManager(); } diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/executor/Executor.java b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/executor/Executor.java index 0f123830e..00ca16055 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/executor/Executor.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/executor/Executor.java @@ -9,7 +9,6 @@ package org.apache.myrmidon.interfaces.executor; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.configuration.Configuration; -import org.apache.myrmidon.api.TaskContext; import org.apache.myrmidon.api.TaskException; /** diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/extensions/ExtensionManager.java b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/extensions/ExtensionManager.java index a7bda7f3e..6680cd47e 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/extensions/ExtensionManager.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/extensions/ExtensionManager.java @@ -7,8 +7,8 @@ */ package org.apache.myrmidon.interfaces.extensions; -import org.apache.avalon.framework.component.Component; import org.apache.avalon.excalibur.extension.PackageRepository; +import org.apache.avalon.framework.component.Component; /** * PackageRepository diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/Project.java b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/Project.java index 8c28cb8c3..69bf02810 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/Project.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/Project.java @@ -25,7 +25,7 @@ public interface Project String ROLE = "org.apache.myrmidon.interfaces.model.Project"; // the name of currently executing project - String PROJECT = "myrmidon.project.name"; + String PROJECT = "myrmidon.project.name"; // the name of currently executing project //String PROJECT_FILE = "myrmidon.project.file"; diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/Target.java b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/Target.java index 57216a352..8f7aca63c 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/Target.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/Target.java @@ -18,9 +18,9 @@ import org.apache.myrmidon.framework.Condition; */ 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. @@ -56,6 +56,7 @@ public class Target { return m_condition; } + /** * Get dependencies of target * diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/TypeLib.java b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/TypeLib.java index 07c6a3185..ddf963529 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/TypeLib.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/model/TypeLib.java @@ -15,16 +15,16 @@ package org.apache.myrmidon.interfaces.model; public class TypeLib { //Name of library (this is location independent) - private final String m_library; + private final String m_library; //Do we need this?? //private final String m_namespace; //The role of object to be imported - private final String m_role; + private final String m_role; //The name of type instance - private final String m_name; + private final String m_name; public TypeLib( final String library ) { diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/type/DefaultTypeFactory.java b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/type/DefaultTypeFactory.java index 37416f642..9164a218f 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/type/DefaultTypeFactory.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/type/DefaultTypeFactory.java @@ -12,8 +12,6 @@ import java.net.URLClassLoader; import java.util.HashMap; import org.apache.avalon.excalibur.i18n.ResourceManager; 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. @@ -28,20 +26,20 @@ public class DefaultTypeFactory ResourceManager.getPackageResources( DefaultTypeFactory.class ); ///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 - private final URL[] m_urls; + private final URL[] m_urls; ///The parent classLoader (if any) - private final ClassLoader m_parent; + private final ClassLoader m_parent; ///The parent classLoader (if any) - private ClassLoader m_classLoader; + private ClassLoader m_classLoader; public DefaultTypeFactory( final URL url ) { - this( new URL[] { url } ); + this( new URL[]{url} ); } public DefaultTypeFactory( final URL[] urls ) diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/workspace/Workspace.java b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/workspace/Workspace.java index b1e28384b..67293d7ca 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/workspace/Workspace.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/interfaces/workspace/Workspace.java @@ -7,7 +7,6 @@ */ package org.apache.myrmidon.interfaces.workspace; -import java.util.Map; import org.apache.avalon.framework.component.Component; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.interfaces.model.Project; diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/launcher/Main.java b/proposal/myrmidon/src/java/org/apache/myrmidon/launcher/Main.java index f246f9eb6..90c4f7361 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/launcher/Main.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/launcher/Main.java @@ -13,7 +13,6 @@ import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; -import java.util.Arrays; import java.util.StringTokenizer; /** @@ -46,17 +45,17 @@ public final class Main final File containerLibDir = new File( installDirectory, "bin" + File.separator + "lib" ); final URL[] containerLibUrls = buildURLList( containerLibDir ); - final URLClassLoader classLoader = + final URLClassLoader classLoader = new URLClassLoader( containerLibUrls, libClassLoader ); //load class and retrieve appropriate main method. 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 ); //kick the tires and light the fires.... - method.invoke( null, new Object[] { args } ); + method.invoke( null, new Object[]{args} ); } catch( final InvocationTargetException ite ) { @@ -100,7 +99,7 @@ public final class Main } file = file.getCanonicalFile(); - + urlList.add( file.toURL() ); } @@ -123,7 +122,7 @@ public final class Main if( element.endsWith( "myrmidon-launcher.jar" ) ) { - File file = (new File( element )).getAbsoluteFile(); + File file = ( new File( element ) ).getAbsoluteFile(); file = file.getParentFile(); if( null != file ) diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/AbstractProjectListener.java b/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/AbstractProjectListener.java index b29db18ad..ea5da64eb 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/AbstractProjectListener.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/AbstractProjectListener.java @@ -7,8 +7,6 @@ */ package org.apache.myrmidon.listeners; -import org.apache.avalon.framework.ExceptionUtil; - /** * Abstract listener from which to extend. * diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ClassicProjectListener.java b/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ClassicProjectListener.java index 3d3e5436f..f99717bba 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ClassicProjectListener.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/ClassicProjectListener.java @@ -17,7 +17,7 @@ import org.apache.avalon.framework.ExceptionUtil; public class ClassicProjectListener extends AbstractProjectListener { - private String m_prefix; + private String m_prefix; /** * Notify listener of targetStarted event. @@ -76,8 +76,10 @@ public class ClassicProjectListener */ 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() diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/DefaultProjectListener.java b/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/DefaultProjectListener.java index 99e38361e..370ce9f76 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/DefaultProjectListener.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/listeners/DefaultProjectListener.java @@ -17,8 +17,8 @@ import org.apache.avalon.framework.ExceptionUtil; public class DefaultProjectListener extends AbstractProjectListener { - private String m_prefix; - private String m_targetName; + private String m_prefix; + private String m_targetName; /** * Notify listener of targetStarted event. @@ -83,8 +83,10 @@ public class DefaultProjectListener 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()