git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270459 13f79535-47bb-0310-9956-ffa450edef68remotes/1764488820693591984/tmp_c0287b1df84553d37a79726b800acceb865cc6c2
| @@ -29,15 +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 ]; | |||
| static | |||
| { | |||
| EMPTY_PARAMETERS = new Parameters(); | |||
| EMPTY_PARAMETERS.makeReadOnly(); | |||
| } | |||
| private AspectManager m_aspectManager; | |||
| /** | |||
| @@ -95,16 +88,10 @@ public class AspectAwareExecutor | |||
| getAspectManager().preConfigure( taskModel ); | |||
| doConfigure( task, taskModel, frame.getContext() ); | |||
| debug( "initializing.notice" ); | |||
| doInitialize( task, taskModel ); | |||
| debug( "executing.notice" ); | |||
| getAspectManager().preExecute(); | |||
| doExecute( taskModel, task ); | |||
| debug( "disposing.notice" ); | |||
| getAspectManager().preDestroy(); | |||
| doDispose( task, taskModel ); | |||
| } | |||
| protected void doExecute( final Configuration taskModel, final Task task ) | |||
| @@ -152,7 +139,7 @@ public class AspectAwareExecutor | |||
| final ArrayList elementList = (ArrayList)elementMap.remove( names[ i ] ); | |||
| Parameters parameters = (Parameters)parameterMap.remove( names[ i ] ); | |||
| if( null == parameters ) parameters = EMPTY_PARAMETERS; | |||
| if( null == parameters ) parameters = Parameters.EMPTY_PARAMETERS; | |||
| Configuration[] elements = null; | |||
| if( null == elementList ) | |||
| @@ -206,7 +193,7 @@ public class AspectAwareExecutor | |||
| final Configuration[] elements = | |||
| (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | |||
| unusedSetting( namespace, EMPTY_PARAMETERS, elements ); | |||
| unusedSetting( namespace, Parameters.EMPTY_PARAMETERS, elements ); | |||
| } | |||
| } | |||
| } | |||
| @@ -67,14 +67,8 @@ public class DefaultExecutor | |||
| debug( "configuring.notice" ); | |||
| doConfigure( task, taskModel, frame.getContext() ); | |||
| debug( "initializing.notice" ); | |||
| doInitialize( task, taskModel ); | |||
| debug( "executing.notice" ); | |||
| task.execute(); | |||
| debug( "disposing.notice" ); | |||
| doDispose( task, taskModel ); | |||
| } | |||
| protected final void debug( final String key ) | |||
| @@ -167,27 +161,6 @@ public class DefaultExecutor | |||
| } | |||
| } | |||
| protected final void doDispose( final Task task, final Configuration taskModel ) | |||
| throws TaskException | |||
| { | |||
| if( task instanceof Disposable ) | |||
| { | |||
| try | |||
| { | |||
| ( (Disposable)task ).dispose(); | |||
| } | |||
| catch( final Throwable throwable ) | |||
| { | |||
| final String message = | |||
| REZ.getString( "dispose.error", | |||
| taskModel.getName(), | |||
| taskModel.getLocation(), | |||
| throwable.getMessage() ); | |||
| throw new TaskException( message, throwable ); | |||
| } | |||
| } | |||
| } | |||
| protected final void doLogEnabled( final Task task, | |||
| final Configuration taskModel, | |||
| final Logger logger ) | |||
| @@ -210,25 +183,4 @@ public class DefaultExecutor | |||
| } | |||
| } | |||
| } | |||
| protected final void doInitialize( final Task task, final Configuration taskModel ) | |||
| throws TaskException | |||
| { | |||
| if( task instanceof Initializable ) | |||
| { | |||
| try | |||
| { | |||
| ( (Initializable)task ).initialize(); | |||
| } | |||
| catch( final Throwable throwable ) | |||
| { | |||
| final String message = | |||
| REZ.getString( "init.error", | |||
| taskModel.getName(), | |||
| taskModel.getLocation(), | |||
| throwable.getMessage() ); | |||
| throw new TaskException( message, throwable ); | |||
| } | |||
| } | |||
| } | |||
| } | |||