git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269067 13f79535-47bb-0310-9956-ffa450edef68master
@@ -7,7 +7,7 @@ | |||
*/ | |||
package org.apache.ant.convert; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.avalon.framework.CascadingException; | |||
/** | |||
* ConverterException thrown when a problem occurs during convertion etc. | |||
@@ -15,7 +15,7 @@ import org.apache.myrmidon.AntException; | |||
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
*/ | |||
public class ConverterException | |||
extends AntException | |||
extends CascadingException | |||
{ | |||
/** | |||
* Basic constructor with a message | |||
@@ -7,7 +7,6 @@ | |||
*/ | |||
package org.apache.ant.convert.engine; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.ant.convert.Converter; | |||
import org.apache.ant.convert.ConverterException; | |||
import org.apache.avalon.framework.logger.AbstractLoggable; | |||
@@ -8,23 +8,23 @@ | |||
package org.apache.ant.modules.basic; | |||
import java.util.ArrayList; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.components.model.Project; | |||
import org.apache.myrmidon.components.manager.ProjectManager; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.DefaultTaskContext; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.avalon.framework.component.ComponentManager; | |||
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.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.DefaultTaskContext; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.myrmidon.components.manager.ProjectManager; | |||
import org.apache.myrmidon.components.model.Project; | |||
/** | |||
* This is abstract base class for tasklets. | |||
* | |||
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
*/ | |||
public class AntCall | |||
public class AntCall | |||
extends AbstractTask | |||
implements Composable | |||
{ | |||
@@ -39,7 +39,7 @@ public class AntCall | |||
{ | |||
super.contextualize( context ); | |||
m_childContext = new DefaultTaskContext( getContext() ); | |||
} | |||
} | |||
public void compose( final ComponentManager componentManager ) | |||
throws ComponentException | |||
@@ -67,11 +67,11 @@ public class AntCall | |||
} | |||
public void execute() | |||
throws AntException | |||
throws TaskException | |||
{ | |||
if( null == m_target ) | |||
{ | |||
throw new AntException( "Target attribute must be specified" ); | |||
throw new TaskException( "Target attribute must be specified" ); | |||
} | |||
final int size = m_properties.size(); | |||
@@ -7,7 +7,7 @@ | |||
*/ | |||
package org.apache.ant.modules.basic; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
/** | |||
@@ -26,7 +26,7 @@ public class Echo | |||
} | |||
public void execute() | |||
throws AntException | |||
throws TaskException | |||
{ | |||
getLogger().warn( m_message ); | |||
} | |||
@@ -7,7 +7,7 @@ | |||
*/ | |||
package org.apache.ant.modules.basic; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.ant.tasklet.DataType; | |||
import org.apache.ant.util.Condition; | |||
@@ -57,10 +57,10 @@ public class Pattern | |||
* Set if clause on pattern. | |||
* | |||
* @param condition the condition | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
public void setIf( final String condition ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
verifyConditionNull(); | |||
m_condition = new Condition( true, condition ); | |||
@@ -70,10 +70,10 @@ public class Pattern | |||
* Set unless clause of pattern. | |||
* | |||
* @param condition the unless clause | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
public void setUnless( final String condition ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
verifyConditionNull(); | |||
m_condition = new Condition( false, condition ); | |||
@@ -83,14 +83,14 @@ public class Pattern | |||
* Utility method to make sure condition unset. | |||
* Made so that it is not possible for both if and unless to be set. | |||
* | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
protected void verifyConditionNull() | |||
throws AntException | |||
throws TaskException | |||
{ | |||
if( null != m_condition ) | |||
{ | |||
throw new AntException( "Can only set one of if/else for pattern data type" ); | |||
throw new TaskException( "Can only set one of if/else for pattern data type" ); | |||
} | |||
} | |||
} |
@@ -8,7 +8,7 @@ | |||
package org.apache.ant.modules.basic; | |||
import java.util.Iterator; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.ant.convert.Converter; | |||
import org.apache.ant.tasklet.DataType; | |||
import org.apache.ant.tasklet.engine.DataTypeEngine; | |||
@@ -65,9 +65,9 @@ public class Property | |||
Object object = null; | |||
try { object = getContext().resolveValue( value ); } | |||
catch( final AntException ae ) | |||
catch( final TaskException te ) | |||
{ | |||
throw new ConfigurationException( "Error resolving value: " + value, ae ); | |||
throw new ConfigurationException( "Error resolving value: " + value, te ); | |||
} | |||
if( null == object ) | |||
@@ -91,9 +91,9 @@ public class Property | |||
else if( name.equals( "value" ) ) | |||
{ | |||
try { setValue( object ); } | |||
catch( final AntException ae ) | |||
catch( final TaskException te ) | |||
{ | |||
throw new ConfigurationException( "Error setting value: " + value, ae ); | |||
throw new ConfigurationException( "Error setting value: " + value, te ); | |||
} | |||
} | |||
else if( name.equals( "local-scope" ) ) | |||
@@ -140,11 +140,11 @@ public class Property | |||
} | |||
public void setValue( final Object value ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
if( null != m_value ) | |||
{ | |||
throw new AntException( "Value can not be set multiple times" ); | |||
throw new TaskException( "Value can not be set multiple times" ); | |||
} | |||
m_value = value; | |||
@@ -156,16 +156,16 @@ public class Property | |||
} | |||
public void execute() | |||
throws AntException | |||
throws TaskException | |||
{ | |||
if( null == m_name ) | |||
{ | |||
throw new AntException( "Name must be specified" ); | |||
throw new TaskException( "Name must be specified" ); | |||
} | |||
if( null == m_value ) | |||
{ | |||
throw new AntException( "Value must be specified" ); | |||
throw new TaskException( "Value must be specified" ); | |||
} | |||
final TaskContext context = getContext(); | |||
@@ -15,7 +15,7 @@ import org.apache.avalon.framework.camelot.RegistryException; | |||
import org.apache.avalon.framework.component.ComponentException; | |||
import org.apache.avalon.framework.component.ComponentManager; | |||
import org.apache.avalon.framework.component.Composable; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.components.deployer.TskDeployer; | |||
import org.apache.myrmidon.components.executor.Executor; | |||
@@ -65,15 +65,15 @@ public abstract class AbstractResourceRegisterer | |||
} | |||
public void execute() | |||
throws AntException | |||
throws TaskException | |||
{ | |||
if( null == m_name ) | |||
{ | |||
throw new AntException( "Must specify name parameter" ); | |||
throw new TaskException( "Must specify name parameter" ); | |||
} | |||
else if( null == m_lib && null == m_classname ) | |||
{ | |||
throw new AntException( "Must specify classname if you don't specify " + | |||
throw new TaskException( "Must specify classname if you don't specify " + | |||
"lib parameter" ); | |||
} | |||
@@ -85,12 +85,12 @@ public abstract class AbstractResourceRegisterer | |||
} | |||
catch( final RegistryException re ) | |||
{ | |||
throw new AntException( "Error registering resource", re ); | |||
throw new TaskException( "Error registering resource", re ); | |||
} | |||
} | |||
protected URL getURL( final String libName ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
if( null != libName ) | |||
{ | |||
@@ -98,7 +98,7 @@ public abstract class AbstractResourceRegisterer | |||
try { return lib.toURL(); } | |||
catch( final MalformedURLException mue ) | |||
{ | |||
throw new AntException( "Malformed task-lib parameter " + m_lib, mue ); | |||
throw new TaskException( "Malformed task-lib parameter " + m_lib, mue ); | |||
} | |||
} | |||
else | |||
@@ -108,5 +108,5 @@ public abstract class AbstractResourceRegisterer | |||
} | |||
protected abstract void registerResource( String name, String classname, URL url ) | |||
throws AntException, RegistryException; | |||
throws TaskException, RegistryException; | |||
} |
@@ -10,7 +10,7 @@ package org.apache.ant.modules.core; | |||
import java.io.File; | |||
import java.net.MalformedURLException; | |||
import java.net.URL; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.ant.convert.engine.ConverterEngine; | |||
import org.apache.ant.convert.engine.DefaultConverterInfo; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
@@ -69,11 +69,11 @@ public class RegisterConverter | |||
} | |||
public void execute() | |||
throws AntException | |||
throws TaskException | |||
{ | |||
if( null == m_classname ) | |||
{ | |||
throw new AntException( "Must specify classname parameter" ); | |||
throw new TaskException( "Must specify classname parameter" ); | |||
} | |||
final URL url = getURL( m_lib ); | |||
@@ -86,13 +86,13 @@ public class RegisterConverter | |||
} | |||
else if( null == m_sourceType || null == m_destinationType ) | |||
{ | |||
throw new AntException( "Must specify the source-type and destination-type " + | |||
throw new TaskException( "Must specify the source-type and destination-type " + | |||
"parameters when supplying a name" ); | |||
} | |||
if( !isFullyDefined && null == url ) | |||
{ | |||
throw new AntException( "Must supply parameter if not fully specifying converter" ); | |||
throw new TaskException( "Must supply parameter if not fully specifying converter" ); | |||
} | |||
if( !isFullyDefined ) | |||
@@ -103,7 +103,7 @@ public class RegisterConverter | |||
} | |||
catch( final DeploymentException de ) | |||
{ | |||
throw new AntException( "Failed deploying " + m_classname + | |||
throw new TaskException( "Failed deploying " + m_classname + | |||
" from " + url, de ); | |||
} | |||
} | |||
@@ -120,13 +120,13 @@ public class RegisterConverter | |||
} | |||
catch( final RegistryException re ) | |||
{ | |||
throw new AntException( "Error registering resource", re ); | |||
throw new TaskException( "Error registering resource", re ); | |||
} | |||
} | |||
} | |||
protected URL getURL( final String libName ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
if( null != libName ) | |||
{ | |||
@@ -134,7 +134,7 @@ public class RegisterConverter | |||
try { return lib.toURL(); } | |||
catch( final MalformedURLException mue ) | |||
{ | |||
throw new AntException( "Malformed task-lib parameter " + m_lib, mue ); | |||
throw new TaskException( "Malformed task-lib parameter " + m_lib, mue ); | |||
} | |||
} | |||
else | |||
@@ -8,10 +8,10 @@ | |||
package org.apache.ant.modules.core; | |||
import java.net.URL; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.avalon.framework.camelot.DefaultLocator; | |||
import org.apache.avalon.framework.camelot.DeploymentException; | |||
import org.apache.avalon.framework.camelot.RegistryException; | |||
import org.apache.myrmidon.api.TaskException; | |||
/** | |||
* Method to register a single datatype. | |||
@@ -21,23 +21,23 @@ import org.apache.avalon.framework.camelot.RegistryException; | |||
public class RegisterDataType | |||
extends AbstractResourceRegisterer | |||
{ | |||
protected void registerResource( final String name, | |||
final String classname, | |||
protected void registerResource( final String name, | |||
final String classname, | |||
final URL url ) | |||
throws AntException, RegistryException | |||
throws TaskException, RegistryException | |||
{ | |||
if( null == classname ) | |||
{ | |||
try { m_tskDeployer.deployDataType( name, url.toString(), url ); } | |||
catch( final DeploymentException de ) | |||
{ | |||
throw new AntException( "Failed deploying " + name + " from " + url, de ); | |||
throw new TaskException( "Failed deploying " + name + " from " + url, de ); | |||
} | |||
} | |||
else | |||
{ | |||
final DefaultLocator locator = new DefaultLocator( classname, url ); | |||
m_dataTypeEngine.getRegistry().register( name, locator ); | |||
m_dataTypeEngine.getRegistry().register( name, locator ); | |||
} | |||
} | |||
} |
@@ -8,7 +8,7 @@ | |||
package org.apache.ant.modules.core; | |||
import java.net.URL; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.avalon.framework.camelot.DefaultLocator; | |||
import org.apache.avalon.framework.camelot.DeploymentException; | |||
import org.apache.avalon.framework.camelot.RegistryException; | |||
@@ -24,14 +24,14 @@ public class RegisterTasklet | |||
protected void registerResource( final String name, | |||
final String classname, | |||
final URL url ) | |||
throws AntException, RegistryException | |||
throws TaskException, RegistryException | |||
{ | |||
if( null == classname ) | |||
{ | |||
try { m_tskDeployer.deployTask( name, url.toString(), url ); } | |||
catch( final DeploymentException de ) | |||
{ | |||
throw new AntException( "Failed deploying " + name + " from " + url, de ); | |||
throw new TaskException( "Failed deploying " + name + " from " + url, de ); | |||
} | |||
} | |||
else | |||
@@ -14,7 +14,7 @@ import org.apache.avalon.framework.camelot.DeploymentException; | |||
import org.apache.avalon.framework.component.ComponentException; | |||
import org.apache.avalon.framework.component.ComponentManager; | |||
import org.apache.avalon.framework.component.Composable; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.components.deployer.TskDeployer; | |||
@@ -43,11 +43,11 @@ public class RegisterTasklib | |||
} | |||
public void execute() | |||
throws AntException | |||
throws TaskException | |||
{ | |||
if( null == m_lib ) | |||
{ | |||
throw new AntException( "Must specify lib parameter" ); | |||
throw new TaskException( "Must specify lib parameter" ); | |||
} | |||
URL url = null; | |||
@@ -56,7 +56,7 @@ public class RegisterTasklib | |||
try { url = lib.toURL(); } | |||
catch( final MalformedURLException mue ) | |||
{ | |||
throw new AntException( "Malformed task-lib parameter " + m_lib, mue ); | |||
throw new TaskException( "Malformed task-lib parameter " + m_lib, mue ); | |||
} | |||
try | |||
@@ -65,7 +65,7 @@ public class RegisterTasklib | |||
} | |||
catch( final DeploymentException de ) | |||
{ | |||
throw new AntException( "Error registering resource", de ); | |||
throw new TaskException( "Error registering resource", de ); | |||
} | |||
} | |||
} |
@@ -7,7 +7,7 @@ | |||
*/ | |||
package org.apache.ant.modules.test; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.avalon.framework.configuration.Configuration; | |||
import org.apache.avalon.framework.configuration.Configurable; | |||
@@ -32,7 +32,7 @@ public class ConfigurationTest | |||
Object object = null; | |||
try { object = getContext().resolveValue( message ); } | |||
catch( final AntException ae ) | |||
catch( final TaskException ae ) | |||
{ | |||
throw new ConfigurationException( "Error resolving : " + message, ae ); | |||
} | |||
@@ -48,7 +48,7 @@ public class ConfigurationTest | |||
} | |||
public void execute() | |||
throws AntException | |||
throws TaskException | |||
{ | |||
getLogger().warn( m_message ); | |||
} | |||
@@ -7,7 +7,7 @@ | |||
*/ | |||
package org.apache.ant.modules.test; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
/** | |||
@@ -31,7 +31,7 @@ public class ContentTest | |||
*/ | |||
public void execute() | |||
throws Exception | |||
throws TaskException | |||
{ | |||
} | |||
} |
@@ -8,7 +8,7 @@ | |||
*/ | |||
package org.apache.ant.modules.test; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
/** | |||
@@ -85,7 +85,7 @@ public class PrimitiveTypesTest | |||
} | |||
public void execute() | |||
throws AntException | |||
throws TaskException | |||
{ | |||
} | |||
} |
@@ -7,7 +7,7 @@ | |||
*/ | |||
package org.apache.ant.modules.test; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
/** | |||
@@ -38,7 +38,7 @@ public class SubElementTest | |||
} | |||
public void execute() | |||
throws AntException | |||
throws TaskException | |||
{ | |||
} | |||
} |
@@ -7,7 +7,7 @@ | |||
*/ | |||
package org.apache.ant.util; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.avalon.framework.component.Component; | |||
import org.apache.avalon.framework.context.Context; | |||
import org.apache.avalon.framework.context.ContextException; | |||
@@ -42,7 +42,7 @@ public class Condition | |||
} | |||
public boolean evaluate( final Context context ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
boolean result = false; | |||
@@ -66,7 +66,7 @@ public class Condition | |||
} | |||
catch( final PropertyException pe ) | |||
{ | |||
throw new AntException( "Error resolving " + m_condition, pe ); | |||
throw new TaskException( "Error resolving " + m_condition, pe ); | |||
} | |||
if( !m_isIfCondition ) | |||
@@ -34,6 +34,7 @@ import org.apache.log.Logger; | |||
import org.apache.log.Priority; | |||
import org.apache.myrmidon.api.DefaultTaskContext; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.components.builder.ProjectBuilder; | |||
import org.apache.myrmidon.components.embeddor.Embeddor; | |||
import org.apache.myrmidon.components.embeddor.MyrmidonEmbeddor; | |||
@@ -107,7 +108,7 @@ public class Main | |||
main.setLogger( Hierarchy.getDefaultHierarchy().getLoggerFor( "default" ) ); | |||
try { main.execute( args ); } | |||
catch( final AntException ae ) | |||
catch( final TaskException ae ) | |||
{ | |||
main.getLogger().error( "Error: " + ae.getMessage() ); | |||
main.getLogger().debug( "Exception..." + ExceptionUtil.printStackTrace( ae ) ); | |||
@@ -276,7 +277,7 @@ public class Main | |||
m_homeDir = (new File( homeDir )).getAbsoluteFile(); | |||
if( !m_homeDir.isDirectory() ) | |||
{ | |||
throw new AntException( "ant-home (" + m_homeDir + ") is not a directory" ); | |||
throw new TaskException( "ant-home (" + m_homeDir + ") is not a directory" ); | |||
} | |||
final File libDir = new File( m_homeDir, "lib" ); | |||
@@ -284,7 +285,7 @@ public class Main | |||
final File buildFile = (new File( filename )).getCanonicalFile(); | |||
if( !buildFile.isFile() ) | |||
{ | |||
throw new AntException( "File " + buildFile + " is not a file or doesn't exist" ); | |||
throw new TaskException( "File " + buildFile + " is not a file or doesn't exist" ); | |||
} | |||
//setup classloader so that it will correctly load | |||
@@ -379,7 +380,7 @@ public class Main | |||
} | |||
} | |||
} | |||
catch( final AntException ae ) | |||
catch( final TaskException ae ) | |||
{ | |||
getLogger().error( "BUILD FAILED" ); | |||
getLogger().error( "Reason:\n" + ExceptionUtil.printStackTrace( ae, 5, true ) ); | |||
@@ -391,17 +392,17 @@ public class Main | |||
* | |||
* @param logLevel the log-level | |||
* @return the logger | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
protected Logger createLogger( final String logLevel ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
final String logLevelCapitalized = logLevel.toUpperCase(); | |||
final Priority priority = Priority.getPriorityForName( logLevelCapitalized ); | |||
if( !priority.getName().equals( logLevelCapitalized ) ) | |||
{ | |||
throw new AntException( "Unknown log level - " + logLevel ); | |||
throw new TaskException( "Unknown log level - " + logLevel ); | |||
} | |||
final Logger logger = | |||
@@ -418,14 +419,14 @@ public class Main | |||
* @param listenerName the name of project listener | |||
*/ | |||
protected ProjectListener createListener( final String listenerName ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
ProjectListener result = null; | |||
try { result = (ProjectListener)Class.forName( listenerName ).newInstance(); } | |||
catch( final Throwable t ) | |||
{ | |||
throw new AntException( "Error creating the listener " + listenerName + | |||
throw new TaskException( "Error creating the listener " + listenerName + | |||
" due to " + ExceptionUtil.printStackTrace( t, 5, true ), | |||
t ); | |||
} | |||
@@ -484,10 +485,10 @@ public class Main | |||
* | |||
* @param project the project | |||
* @param defines the defines | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
protected void setupContext( final TaskContext context, final HashMap defines ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
//put these values into defines so that they overide | |||
//user-defined proeprties | |||
@@ -510,7 +511,7 @@ public class Main | |||
* @param map the map of names->values | |||
*/ | |||
protected void addToContext( final TaskContext context, final Map map ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
final Iterator keys = map.keySet().iterator(); | |||
@@ -54,7 +54,7 @@ public abstract class AbstractTask | |||
* @exception Exception if an error occurs | |||
*/ | |||
public abstract void execute() | |||
throws Exception; | |||
throws TaskException; | |||
/** | |||
* This will be called after execute() method. | |||
@@ -8,7 +8,6 @@ | |||
package org.apache.myrmidon.api; | |||
import java.io.File; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.avalon.excalibur.io.FileUtil; | |||
import org.apache.avalon.excalibur.property.PropertyException; | |||
import org.apache.avalon.excalibur.property.PropertyUtil; | |||
@@ -116,12 +115,12 @@ public class DefaultTaskContext | |||
* @return the resolved property | |||
*/ | |||
public Object resolveValue( final String property ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
try { return PropertyUtil.resolveProperty( property, this, false ); } | |||
catch( final PropertyException pe ) | |||
{ | |||
throw new AntException( "Error resolving " + property + " due to " + pe.getMessage(), | |||
throw new TaskException( "Error resolving " + property + " due to " + pe.getMessage(), | |||
pe ); | |||
} | |||
} | |||
@@ -148,7 +147,7 @@ public class DefaultTaskContext | |||
* @param value the value of property | |||
*/ | |||
public void setProperty( final String name, final Object value ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
setProperty( name, value, CURRENT ); | |||
} | |||
@@ -159,7 +158,7 @@ public class DefaultTaskContext | |||
* @param property the property | |||
*/ | |||
public void setProperty( final String name, final Object value, final ScopeEnum scope ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
checkPropertyValid( name, value ); | |||
@@ -168,7 +167,7 @@ public class DefaultTaskContext | |||
{ | |||
if( null == m_parent ) | |||
{ | |||
throw new AntException( "Can't set a property with parent scope when context " + | |||
throw new TaskException( "Can't set a property with parent scope when context " + | |||
" has no parent" ); | |||
} | |||
else | |||
@@ -189,7 +188,7 @@ public class DefaultTaskContext | |||
} | |||
else | |||
{ | |||
throw new AntException( "Can't set a property with an unknown " + | |||
throw new TaskException( "Can't set a property with an unknown " + | |||
"property context! (" + scope + ")" ); | |||
} | |||
} | |||
@@ -203,14 +202,14 @@ public class DefaultTaskContext | |||
* @param value the value | |||
*/ | |||
public void putValue( final Object key, final Object value ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
if( key.equals( BASE_DIRECTORY ) ) | |||
{ | |||
try { m_baseDirectory = (File)value; } | |||
catch( final ClassCastException cce ) | |||
{ | |||
throw new AntException( "Can not set baseDirectory to a non-file value.", | |||
throw new TaskException( "Can not set baseDirectory to a non-file value.", | |||
cce ); | |||
} | |||
} | |||
@@ -223,28 +222,28 @@ public class DefaultTaskContext | |||
* | |||
* @param name the name of property | |||
* @param value the value of proeprty | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
protected void checkPropertyValid( final String name, final Object value ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
if( BASE_DIRECTORY.equals( name ) && !( value instanceof File ) ) | |||
{ | |||
throw new AntException( "Property " + BASE_DIRECTORY + | |||
" must have a value of type " + | |||
File.class.getName() ); | |||
throw new TaskException( "Property " + BASE_DIRECTORY + | |||
" must have a value of type " + | |||
File.class.getName() ); | |||
} | |||
else if( NAME.equals( name ) && !( value instanceof String ) ) | |||
{ | |||
throw new AntException( "Property " + NAME + | |||
" must have a value of type " + | |||
String.class.getName() ); | |||
throw new TaskException( "Property " + NAME + | |||
" must have a value of type " + | |||
String.class.getName() ); | |||
} | |||
else if( JAVA_VERSION.equals( name ) && !( value instanceof JavaVersion ) ) | |||
{ | |||
throw new AntException( "property " + JAVA_VERSION + | |||
" must have a value of type " + | |||
JavaVersion.class.getName() ); | |||
throw new TaskException( "property " + JAVA_VERSION + | |||
" must have a value of type " + | |||
JavaVersion.class.getName() ); | |||
} | |||
} | |||
} |
@@ -20,7 +20,6 @@ package org.apache.myrmidon.api; | |||
* to task object. | |||
* | |||
* The Components passed in via ComponentManager are determined by container. | |||
* Most containers will include the Engine and Registrys. | |||
* | |||
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
*/ | |||
@@ -30,10 +29,10 @@ public interface 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 | |||
* beig Disposed (If task implements appropriate interfaces). | |||
* being Disposed (If task implements appropriate interfaces). | |||
* | |||
* @exception Exception if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
void execute() | |||
throws Exception; | |||
throws TaskException; | |||
} |
@@ -10,7 +10,6 @@ package org.apache.myrmidon.api; | |||
import java.io.File; | |||
import org.apache.avalon.framework.Enum; | |||
import org.apache.avalon.framework.context.Context; | |||
import org.apache.myrmidon.AntException; | |||
/** | |||
* This interface represents the <em>Context</em> in which Task is executed. | |||
@@ -67,7 +66,7 @@ public interface TaskContext | |||
* @return the resolved file | |||
*/ | |||
File resolveFile( String filename ) | |||
throws AntException; | |||
throws TaskException; | |||
/** | |||
* Resolve property. | |||
@@ -77,7 +76,7 @@ public interface TaskContext | |||
* @return the resolved property | |||
*/ | |||
Object resolveValue( String property ) | |||
throws AntException; | |||
throws TaskException; | |||
/** | |||
* Retrieve property for name. | |||
@@ -94,7 +93,7 @@ public interface TaskContext | |||
* @param value the value of property | |||
*/ | |||
void setProperty( String name, Object value ) | |||
throws AntException; | |||
throws TaskException; | |||
/** | |||
* Set property value. | |||
@@ -104,7 +103,7 @@ public interface TaskContext | |||
* @param scope the scope at which to set property | |||
*/ | |||
void setProperty( String name, Object value, ScopeEnum scope ) | |||
throws AntException; | |||
throws TaskException; | |||
/** | |||
* Safe wrapper class for Scope enums. | |||
@@ -5,20 +5,18 @@ | |||
* version 1.1, a copy of which has been included with this distribution in | |||
* the LICENSE file. | |||
*/ | |||
package org.apache.myrmidon; | |||
package org.apache.myrmidon.api; | |||
import org.apache.avalon.framework.CascadingException; | |||
/** | |||
* AntException thrown when a problem with tasks etc. | |||
* TaskException thrown when a problem with tasks etc. | |||
* It is cascading so that further embedded information can be contained. | |||
* ie ANtException was caused by IOException etc. | |||
* It is RuntimeException as it has to pass through a number of Java-defined | |||
* interfaces - ala Runnable and also to aid in ease of indicating an error. | |||
* ie TaskException was caused by IOException etc. | |||
* | |||
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
*/ | |||
public class AntException | |||
public class TaskException | |||
extends CascadingException | |||
{ | |||
/** | |||
@@ -26,7 +24,7 @@ public class AntException | |||
* | |||
* @param message the message | |||
*/ | |||
public AntException( final String message ) | |||
public TaskException( final String message ) | |||
{ | |||
this( message, null ); | |||
} | |||
@@ -37,7 +35,7 @@ public class AntException | |||
* @param message the message | |||
* @param throwable the throwable | |||
*/ | |||
public AntException( final String message, final Throwable throwable ) | |||
public TaskException( final String message, final Throwable throwable ) | |||
{ | |||
super( message, throwable ); | |||
} |
@@ -16,7 +16,6 @@ import org.apache.avalon.framework.configuration.ConfigurationException; | |||
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; | |||
import org.apache.avalon.framework.logger.AbstractLoggable; | |||
import org.apache.log.Logger; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.myrmidon.components.model.DefaultProject; | |||
import org.apache.myrmidon.components.model.DefaultTarget; | |||
@@ -47,44 +46,14 @@ public class DefaultProjectBuilder | |||
* @param source the source | |||
* @return the constructed Project | |||
* @exception IOException if an error occurs | |||
* @exception AntException if an error occurs | |||
* @exception Exception if an error occurs | |||
*/ | |||
public Project build( final File projectFile ) | |||
throws IOException, AntException | |||
throws Exception | |||
{ | |||
try | |||
{ | |||
final String location = projectFile.getCanonicalFile().toString(); | |||
final Configuration configuration = buildConfiguration( location ); | |||
return build( projectFile, configuration ); | |||
} | |||
catch( final ConfigurationException ce ) | |||
{ | |||
throw new AntException( "ConfigurationException: " + ce.getMessage(), ce ); | |||
} | |||
} | |||
/** | |||
* Utility method to build a Configuration tree from a source. | |||
* Overide this in sub-classes if you want to provide extra | |||
* functionality (ie xslt/css). | |||
* | |||
* @param location the location | |||
* @return the created Configuration | |||
* @exception AntException if an error occurs | |||
* @exception IOException if an error occurs | |||
*/ | |||
protected Configuration buildConfiguration( final String location ) | |||
throws AntException, IOException, ConfigurationException | |||
{ | |||
try | |||
{ | |||
return (Configuration)m_builder.buildFromFile( location ); | |||
} | |||
catch( final SAXException se ) | |||
{ | |||
throw new AntException( "SAXEception: " + se.getMessage(), se ); | |||
} | |||
final String location = projectFile.getCanonicalFile().toString(); | |||
final Configuration configuration = (Configuration)m_builder.buildFromFile( location ); | |||
return build( projectFile, configuration ); | |||
} | |||
/** | |||
@@ -94,15 +63,15 @@ public class DefaultProjectBuilder | |||
* @param configuration the configuration loaded | |||
* @return the created Project | |||
* @exception IOException if an error occurs | |||
* @exception AntException if an error occurs | |||
* @exception Exception if an error occurs | |||
* @exception ConfigurationException if an error occurs | |||
*/ | |||
protected Project build( final File file, final Configuration configuration ) | |||
throws IOException, AntException, ConfigurationException | |||
throws Exception | |||
{ | |||
if( !configuration.getName().equals("project") ) | |||
{ | |||
throw new AntException( "Project file must be enclosed in project element" ); | |||
throw new Exception( "Project file must be enclosed in project element" ); | |||
} | |||
//get project-level attributes | |||
@@ -133,11 +102,11 @@ public class DefaultProjectBuilder | |||
* | |||
* @param project the project | |||
* @param configuration the Configuration | |||
* @exception AntException if an error occurs | |||
* @exception Exception if an error occurs | |||
*/ | |||
protected void buildTopLevelProject( final DefaultProject project, | |||
final Configuration configuration ) | |||
throws AntException | |||
throws Exception | |||
{ | |||
final Configuration[] children = configuration.getChildren(); | |||
@@ -151,7 +120,7 @@ public class DefaultProjectBuilder | |||
else if( name.equals( "property" ) ) buildImplicitTask( project, element ); | |||
else | |||
{ | |||
throw new AntException( "Unknown top-level element " + name + | |||
throw new Exception( "Unknown top-level element " + name + | |||
" at " + element.getLocation() ); | |||
} | |||
} | |||
@@ -164,7 +133,7 @@ public class DefaultProjectBuilder | |||
* @param task the Configuration | |||
*/ | |||
protected void buildTarget( final DefaultProject project, final Configuration target ) | |||
throws AntException | |||
throws Exception | |||
{ | |||
final String name = target.getAttribute( "name", null ); | |||
final String depends = target.getAttribute( "depends", null ); | |||
@@ -173,7 +142,7 @@ public class DefaultProjectBuilder | |||
if( null == name ) | |||
{ | |||
throw new AntException( "Discovered un-named target at " + | |||
throw new Exception( "Discovered un-named target at " + | |||
target.getLocation() ); | |||
} | |||
@@ -181,7 +150,7 @@ public class DefaultProjectBuilder | |||
if( null != ifCondition && null != unlessCondition ) | |||
{ | |||
throw new AntException( "Discovered invalid target that has both a if and " + | |||
throw new Exception( "Discovered invalid target that has both a if and " + | |||
"unless condition at " + target.getLocation() ); | |||
} | |||
@@ -211,8 +180,8 @@ public class DefaultProjectBuilder | |||
if( 0 == dependency.length() ) | |||
{ | |||
throw new AntException( "Discovered empty dependency in target " + | |||
target.getName() + " at " + target.getLocation() ); | |||
throw new Exception( "Discovered empty dependency in target " + | |||
target.getName() + " at " + target.getLocation() ); | |||
} | |||
getLogger().debug( "Target dependency: " + dependency ); | |||
@@ -9,7 +9,6 @@ package org.apache.myrmidon.components.builder; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.avalon.framework.component.Component; | |||
import org.apache.myrmidon.components.model.Project; | |||
@@ -30,5 +29,5 @@ public interface ProjectBuilder | |||
* @exception AntException if an error occurs | |||
*/ | |||
Project build( File source ) | |||
throws IOException, AntException; | |||
throws Exception; | |||
} |
@@ -8,7 +8,6 @@ | |||
package org.apache.myrmidon.components.embeddor; | |||
import java.io.File; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.ant.convert.engine.ConverterEngine; | |||
import org.apache.ant.tasklet.engine.DataTypeEngine; | |||
import org.apache.avalon.excalibur.io.FileUtil; | |||
@@ -290,7 +289,7 @@ public class MyrmidonEmbeddor | |||
* Setup all the files attributes. | |||
*/ | |||
private void setupFiles() | |||
throws AntException | |||
throws Exception | |||
{ | |||
String filepath = null; | |||
@@ -333,10 +332,10 @@ public class MyrmidonEmbeddor | |||
* @param dir the base directory | |||
* @param name the relative directory | |||
* @return the created File | |||
* @exception AntException if an error occurs | |||
* @exception Exception if an error occurs | |||
*/ | |||
private File resolveDirectory( final String dir, final String name ) | |||
throws AntException | |||
throws Exception | |||
{ | |||
final File file = FileUtil.resolveFile( m_homeDir, dir ); | |||
checkDirectory( file, name ); | |||
@@ -350,15 +349,15 @@ public class MyrmidonEmbeddor | |||
* @param name the name of file type (used in error messages) | |||
*/ | |||
private void checkDirectory( final File file, final String name ) | |||
throws AntException | |||
throws Exception | |||
{ | |||
if( !file.exists() ) | |||
{ | |||
throw new AntException( name + " (" + file + ") does not exist" ); | |||
throw new Exception( name + " (" + file + ") does not exist" ); | |||
} | |||
else if( !file.isDirectory() ) | |||
{ | |||
throw new AntException( name + " (" + file + ") is not a directory" ); | |||
throw new Exception( name + " (" + file + ") is not a directory" ); | |||
} | |||
} | |||
@@ -392,10 +391,10 @@ public class MyrmidonEmbeddor | |||
* @param component the name of the component | |||
* @param clazz the name of interface/type | |||
* @return the created object | |||
* @exception AntException if an error occurs | |||
* @exception Exception if an error occurs | |||
*/ | |||
private Object createComponent( final String component, final Class clazz ) | |||
throws AntException | |||
throws Exception | |||
{ | |||
try | |||
{ | |||
@@ -403,26 +402,24 @@ public class MyrmidonEmbeddor | |||
if( !clazz.isInstance( object ) ) | |||
{ | |||
throw new AntException( "Object " + component + " is not an instance of " + | |||
clazz ); | |||
throw new Exception( "Object " + component + " is not an instance of " + | |||
clazz ); | |||
} | |||
return object; | |||
} | |||
catch( final IllegalAccessException iae ) | |||
{ | |||
throw new AntException( "Non-public constructor for " + clazz + " " + component, | |||
iae ); | |||
throw new Exception( "Non-public constructor for " + clazz + " " + component ); | |||
} | |||
catch( final InstantiationException ie ) | |||
{ | |||
throw new AntException( "Error instantiating class for " + clazz + " " + component, | |||
ie ); | |||
throw new Exception( "Error instantiating class for " + clazz + " " + component ); | |||
} | |||
catch( final ClassNotFoundException cnfe ) | |||
{ | |||
throw new AntException( "Could not find the class for " + clazz + | |||
" (" + component + ")", cnfe ); | |||
throw new Exception( "Could not find the class for " + clazz + | |||
" (" + component + ")" ); | |||
} | |||
} | |||
} |
@@ -7,8 +7,6 @@ | |||
*/ | |||
package org.apache.myrmidon.components.executor; | |||
import java.util.HashMap; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.ant.convert.engine.ConverterEngine; | |||
import org.apache.avalon.framework.activity.Disposable; | |||
import org.apache.avalon.framework.activity.Initializable; | |||
@@ -33,17 +31,19 @@ import org.apache.avalon.framework.logger.Loggable; | |||
import org.apache.log.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.components.configurer.Configurer; | |||
public class DefaultExecutor | |||
extends AbstractLoggable | |||
implements Executor, Composable | |||
{ | |||
protected Factory m_factory; | |||
protected Registry m_registry = new DefaultRegistry( Locator.class ); | |||
protected Configurer m_configurer; | |||
private Factory m_factory; | |||
private Registry m_registry = new DefaultRegistry( Locator.class ); | |||
private Configurer m_configurer; | |||
protected ComponentManager m_componentManager; | |||
private ComponentManager m_componentManager; | |||
public Registry getRegistry() | |||
{ | |||
@@ -69,7 +69,7 @@ public class DefaultExecutor | |||
} | |||
public void execute( final Configuration taskData, final TaskContext context ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
getLogger().debug( "Creating" ); | |||
final Task task = createTask( taskData.getName() ); | |||
@@ -89,18 +89,14 @@ public class DefaultExecutor | |||
getLogger().debug( "Running" ); | |||
try { task.execute(); } | |||
catch( final Exception e ) | |||
{ | |||
throw new AntException( "Error executing task", e ); | |||
} | |||
task.execute(); | |||
getLogger().debug( "Disposing" ); | |||
doDispose( task, taskData ); | |||
} | |||
protected Task createTask( final String name ) | |||
throws AntException | |||
private Task createTask( final String name ) | |||
throws TaskException | |||
{ | |||
try | |||
{ | |||
@@ -109,47 +105,47 @@ public class DefaultExecutor | |||
} | |||
catch( final RegistryException re ) | |||
{ | |||
throw new AntException( "Unable to locate task " + name, re ); | |||
throw new TaskException( "Unable to locate task " + name, re ); | |||
} | |||
catch( final FactoryException fe ) | |||
{ | |||
throw new AntException( "Unable to create task " + name, fe ); | |||
throw new TaskException( "Unable to create task " + name, fe ); | |||
} | |||
} | |||
protected void doConfigure( final Task task, | |||
final Configuration taskData, | |||
final TaskContext context ) | |||
throws AntException | |||
private void doConfigure( final Task task, | |||
final Configuration taskData, | |||
final TaskContext context ) | |||
throws TaskException | |||
{ | |||
try { m_configurer.configure( task, taskData, context ); } | |||
catch( final Throwable throwable ) | |||
{ | |||
throw new AntException( "Error configuring task " + taskData.getName() + " at " + | |||
taskData.getLocation() + "(Reason: " + | |||
throwable.getMessage() + ")", throwable ); | |||
throw new TaskException( "Error configuring task " + taskData.getName() + " at " + | |||
taskData.getLocation() + "(Reason: " + | |||
throwable.getMessage() + ")", throwable ); | |||
} | |||
} | |||
protected void doCompose( final Task task, final Configuration taskData ) | |||
throws AntException | |||
private void doCompose( final Task task, final Configuration taskData ) | |||
throws TaskException | |||
{ | |||
if( task instanceof Composable ) | |||
{ | |||
try { ((Composable)task).compose( m_componentManager ); } | |||
catch( final Throwable throwable ) | |||
{ | |||
throw new AntException( "Error composing task " + taskData.getName() + " at " + | |||
taskData.getLocation() + "(Reason: " + | |||
throwable.getMessage() + ")", throwable ); | |||
throw new TaskException( "Error composing task " + taskData.getName() + " at " + | |||
taskData.getLocation() + "(Reason: " + | |||
throwable.getMessage() + ")", throwable ); | |||
} | |||
} | |||
} | |||
protected void doContextualize( final Task task, | |||
final Configuration taskData, | |||
final TaskContext context ) | |||
throws AntException | |||
private void doContextualize( final Task task, | |||
final Configuration taskData, | |||
final TaskContext context ) | |||
throws TaskException | |||
{ | |||
try | |||
{ | |||
@@ -160,38 +156,38 @@ public class DefaultExecutor | |||
} | |||
catch( final Throwable throwable ) | |||
{ | |||
throw new AntException( "Error contextualizing task " + taskData.getName() + " at " + | |||
taskData.getLocation() + "(Reason: " + | |||
throwable.getMessage() + ")", throwable ); | |||
throw new TaskException( "Error contextualizing task " + taskData.getName() + " at " + | |||
taskData.getLocation() + "(Reason: " + | |||
throwable.getMessage() + ")", throwable ); | |||
} | |||
} | |||
protected void doDispose( final Task task, final Configuration taskData ) | |||
throws AntException | |||
private void doDispose( final Task task, final Configuration taskData ) | |||
throws TaskException | |||
{ | |||
if( task instanceof Disposable ) | |||
{ | |||
try { ((Disposable)task).dispose(); } | |||
catch( final Throwable throwable ) | |||
{ | |||
throw new AntException( "Error disposing task " + taskData.getName() + " at " + | |||
taskData.getLocation() + "(Reason: " + | |||
throwable.getMessage() + ")", throwable ); | |||
throw new TaskException( "Error disposing task " + taskData.getName() + " at " + | |||
taskData.getLocation() + "(Reason: " + | |||
throwable.getMessage() + ")", throwable ); | |||
} | |||
} | |||
} | |||
protected void doInitialize( final Task task, final Configuration taskData ) | |||
throws AntException | |||
private void doInitialize( final Task task, final Configuration taskData ) | |||
throws TaskException | |||
{ | |||
if( task instanceof Initializable ) | |||
{ | |||
try { ((Initializable)task).initialize(); } | |||
catch( final Throwable throwable ) | |||
{ | |||
throw new AntException( "Error initializing task " + taskData.getName() + " at " + | |||
taskData.getLocation() + "(Reason: " + | |||
throwable.getMessage() + ")", throwable ); | |||
throw new TaskException( "Error initializing task " + taskData.getName() + " at " + | |||
taskData.getLocation() + "(Reason: " + | |||
throwable.getMessage() + ")", throwable ); | |||
} | |||
} | |||
} | |||
@@ -7,11 +7,11 @@ | |||
*/ | |||
package org.apache.myrmidon.components.executor; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.avalon.framework.camelot.Registry; | |||
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; | |||
/** | |||
* Engine inteface that should be implemented by all tasklet engines. | |||
@@ -33,8 +33,8 @@ public interface Executor | |||
* execute a task. | |||
* | |||
* @param task the configruation data for task | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
void execute( Configuration task, TaskContext context ) | |||
throws AntException; | |||
throws TaskException; | |||
} |
@@ -8,8 +8,6 @@ | |||
package org.apache.myrmidon.components.manager; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.ant.util.Condition; | |||
import org.apache.avalon.framework.activity.Disposable; | |||
import org.apache.avalon.framework.activity.Initializable; | |||
@@ -23,6 +21,7 @@ import org.apache.avalon.framework.logger.AbstractLoggable; | |||
import org.apache.log.Logger; | |||
import org.apache.myrmidon.api.DefaultTaskContext; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.components.executor.Executor; | |||
import org.apache.myrmidon.components.model.Project; | |||
import org.apache.myrmidon.components.model.Target; | |||
@@ -81,10 +80,10 @@ public class DefaultProjectManager | |||
* | |||
* @param project the Project | |||
* @param target the name of the target | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
public void executeTarget( final Project project, final String target, final TaskContext context ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
//HACK: should do this a better way !!!!!! | |||
m_componentManager.put( "org.apache.ant.project.Project", project ); | |||
@@ -104,10 +103,10 @@ public class DefaultProjectManager | |||
* @param project the Project | |||
* @param target the name of the target | |||
* @param context the context | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
public void execute( Project project, String target, TaskContext context ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
execute( project, target, context, new ArrayList() ); | |||
} | |||
@@ -119,19 +118,19 @@ public class DefaultProjectManager | |||
* @param target the name of the target | |||
* @param context the context | |||
* @param done the list of targets already executed in current run | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
private void execute( final Project project, | |||
final String targetName, | |||
final TaskContext context, | |||
final ArrayList done ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
final Target target = project.getTarget( targetName ); | |||
if( null == target ) | |||
{ | |||
throw new AntException( "Unable to find target " + targetName ); | |||
throw new TaskException( "Unable to find target " + targetName ); | |||
} | |||
//add target to list of targets executed | |||
@@ -156,12 +155,12 @@ public class DefaultProjectManager | |||
* @param targetName the name of target | |||
* @param target the target | |||
* @param context the context in which to execute | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
private void executeTarget( final String targetName, | |||
final Target target, | |||
final TaskContext context ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
//is this necessary ? I think not but .... | |||
// NO it isn't because you set target name and project has already been provided | |||
@@ -192,7 +191,7 @@ public class DefaultProjectManager | |||
private void executeTargetWork( final String name, | |||
final Target target, | |||
final TaskContext context ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
//check the condition associated with target. | |||
//if it is not satisfied then skip target | |||
@@ -222,10 +221,10 @@ public class DefaultProjectManager | |||
* | |||
* @param task the task definition | |||
* @param context the context | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
private void executeTask( final Configuration task, final TaskContext context ) | |||
throws AntException | |||
throws TaskException | |||
{ | |||
final String name = task.getName(); | |||
getLogger().debug( "Executing task " + name ); | |||
@@ -7,9 +7,9 @@ | |||
*/ | |||
package org.apache.myrmidon.components.manager; | |||
import org.apache.myrmidon.AntException; | |||
import org.apache.avalon.framework.component.Component; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.components.model.Project; | |||
import org.apache.myrmidon.listeners.ProjectListener; | |||
@@ -42,8 +42,8 @@ public interface ProjectManager | |||
* @param project the Project | |||
* @param target the name of the target | |||
* @param context the context | |||
* @exception AntException if an error occurs | |||
* @exception TaskException if an error occurs | |||
*/ | |||
void executeTarget( Project project, String target, TaskContext context ) | |||
throws AntException; | |||
throws TaskException; | |||
} |
@@ -10,7 +10,6 @@ package org.apache.myrmidon.components.model; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import java.util.HashMap; | |||
import org.apache.myrmidon.AntException; | |||
/** | |||
* Default project implementation. | |||
@@ -119,15 +118,14 @@ public class DefaultProject | |||
* | |||
* @param name the name of target | |||
* @param target the Target | |||
* @exception AntException if an error occurs | |||
* @exception IllegalArgumentException if target already exists with same name | |||
*/ | |||
public final void addTarget( final String name, final Target target ) | |||
throws AntException | |||
{ | |||
if( null != m_targets.get( name ) ) | |||
{ | |||
throw new AntException( "Can not have two targets in a file with the name " + | |||
name ); | |||
throw new IllegalArgumentException( "Can not have two targets in a " + | |||
"file with the name " + name ); | |||
} | |||
else | |||
{ | |||