git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269642 13f79535-47bb-0310-9956-ffa450edef68master
@@ -10,6 +10,8 @@ package org.apache.myrmidon.components.embeddor; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.FilenameFilter; | import java.io.FilenameFilter; | ||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.avalon.excalibur.io.ExtensionFileFilter; | import org.apache.avalon.excalibur.io.ExtensionFileFilter; | ||||
import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
import org.apache.avalon.framework.activity.Initializable; | import org.apache.avalon.framework.activity.Initializable; | ||||
@@ -28,11 +30,11 @@ import org.apache.myrmidon.components.converter.MasterConverter; | |||||
import org.apache.myrmidon.components.deployer.Deployer; | import org.apache.myrmidon.components.deployer.Deployer; | ||||
import org.apache.myrmidon.components.deployer.DeploymentException; | import org.apache.myrmidon.components.deployer.DeploymentException; | ||||
import org.apache.myrmidon.components.executor.Executor; | import org.apache.myrmidon.components.executor.Executor; | ||||
import org.apache.myrmidon.components.workspace.Workspace; | |||||
import org.apache.myrmidon.components.model.Project; | import org.apache.myrmidon.components.model.Project; | ||||
import org.apache.myrmidon.components.role.RoleManager; | import org.apache.myrmidon.components.role.RoleManager; | ||||
import org.apache.myrmidon.components.type.TypeFactory; | import org.apache.myrmidon.components.type.TypeFactory; | ||||
import org.apache.myrmidon.components.type.TypeManager; | import org.apache.myrmidon.components.type.TypeManager; | ||||
import org.apache.myrmidon.components.workspace.Workspace; | |||||
/** | /** | ||||
* Default implementation of Embeddor. | * Default implementation of Embeddor. | ||||
@@ -44,6 +46,9 @@ public class DefaultEmbeddor | |||||
extends AbstractLoggable | extends AbstractLoggable | ||||
implements Embeddor | implements Embeddor | ||||
{ | { | ||||
private static final Resources REZ = | |||||
ResourceManager.getPackageResources( DefaultEmbeddor.class ); | |||||
private Deployer m_deployer; | private Deployer m_deployer; | ||||
private RoleManager m_roleManager; | private RoleManager m_roleManager; | ||||
@@ -75,8 +80,8 @@ public class DefaultEmbeddor | |||||
m_parameters = parameters; | m_parameters = parameters; | ||||
} | } | ||||
public Project createProject( final String location, | |||||
String type, | |||||
public Project createProject( final String location, | |||||
String type, | |||||
final Parameters parameters ) | final Parameters parameters ) | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
@@ -94,7 +99,7 @@ public class DefaultEmbeddor | |||||
return FileUtil.getExtension( location ); | return FileUtil.getExtension( location ); | ||||
} | } | ||||
private ProjectBuilder getProjectBuilder( final String type, | |||||
private ProjectBuilder getProjectBuilder( final String type, | |||||
final Parameters parameters ) | final Parameters parameters ) | ||||
throws Exception | throws Exception | ||||
{ | { | ||||
@@ -112,12 +117,12 @@ public class DefaultEmbeddor | |||||
if( builder instanceof Parameterizable ) | if( builder instanceof Parameterizable ) | ||||
{ | { | ||||
((Parameterizable)builder).parameterize( parameters ); | ((Parameterizable)builder).parameterize( parameters ); | ||||
} | |||||
} | |||||
if( builder instanceof Initializable ) | if( builder instanceof Initializable ) | ||||
{ | { | ||||
((Initializable)builder).initialize(); | ((Initializable)builder).initialize(); | ||||
} | |||||
} | |||||
return builder; | return builder; | ||||
} | } | ||||
@@ -126,7 +131,7 @@ public class DefaultEmbeddor | |||||
throws Exception | throws Exception | ||||
{ | { | ||||
final String component = getParameter( Workspace.ROLE ); | final String component = getParameter( Workspace.ROLE ); | ||||
final Workspace workspace = | |||||
final Workspace workspace = | |||||
(Workspace)createComponent( component, Workspace.class ); | (Workspace)createComponent( component, Workspace.class ); | ||||
setupLogger( workspace ); | setupLogger( workspace ); | ||||
@@ -140,12 +145,12 @@ public class DefaultEmbeddor | |||||
if( workspace instanceof Parameterizable ) | if( workspace instanceof Parameterizable ) | ||||
{ | { | ||||
((Parameterizable)workspace).parameterize( parameters ); | ((Parameterizable)workspace).parameterize( parameters ); | ||||
} | |||||
} | |||||
if( workspace instanceof Initializable ) | if( workspace instanceof Initializable ) | ||||
{ | { | ||||
((Initializable)workspace).initialize(); | ((Initializable)workspace).initialize(); | ||||
} | |||||
} | |||||
return workspace; | return workspace; | ||||
} | } | ||||
@@ -416,11 +421,13 @@ public class DefaultEmbeddor | |||||
{ | { | ||||
if( !file.exists() ) | if( !file.exists() ) | ||||
{ | { | ||||
throw new Exception( name + " (" + file + ") does not exist" ); | |||||
final String message = REZ.getString( "file-no-exist.error", name, file ); | |||||
throw new Exception( message ); | |||||
} | } | ||||
else if( !file.isDirectory() ) | else if( !file.isDirectory() ) | ||||
{ | { | ||||
throw new Exception( name + " (" + file + ") is not a directory" ); | |||||
final String message = REZ.getString( "file-not-dir.error", name, file ); | |||||
throw new Exception( message ); | |||||
} | } | ||||
} | } | ||||
@@ -464,28 +471,31 @@ public class DefaultEmbeddor | |||||
if( !clazz.isInstance( object ) ) | if( !clazz.isInstance( object ) ) | ||||
{ | { | ||||
throw new Exception( "Object " + component + " is not an instance of " + | |||||
clazz ); | |||||
final String message = REZ.getString( "bad-type.error", component, clazz.getName() ); | |||||
throw new Exception( message ); | |||||
} | } | ||||
return object; | return object; | ||||
} | } | ||||
catch( final IllegalAccessException iae ) | catch( final IllegalAccessException iae ) | ||||
{ | { | ||||
throw new Exception( "Non-public constructor for " + clazz + " " + component ); | |||||
final String message = REZ.getString( "bad-ctor.error", clazz.getName(), component ); | |||||
throw new Exception( message ); | |||||
} | } | ||||
catch( final InstantiationException ie ) | catch( final InstantiationException ie ) | ||||
{ | { | ||||
throw new Exception( "Error instantiating class for " + clazz + " " + component ); | |||||
final String message = | |||||
REZ.getString( "no-instantiate.error", clazz.getName(), component ); | |||||
throw new Exception( message ); | |||||
} | } | ||||
catch( final ClassNotFoundException cnfe ) | catch( final ClassNotFoundException cnfe ) | ||||
{ | { | ||||
throw new Exception( "Could not find the class for " + clazz + | |||||
" (" + component + ")" ); | |||||
final String message = | |||||
REZ.getString( "no-class.error", clazz.getName(), component ); | |||||
throw new Exception( message ); | |||||
} | } | ||||
} | } | ||||
private void deployFromDirectory( final Deployer deployer, | private void deployFromDirectory( final Deployer deployer, | ||||
final File directory, | final File directory, | ||||
final FilenameFilter filter ) | final FilenameFilter filter ) | ||||
@@ -522,8 +532,8 @@ public class DefaultEmbeddor | |||||
} | } | ||||
catch( final Exception e ) | catch( final Exception e ) | ||||
{ | { | ||||
throw new DeploymentException( "Unable to retrieve filename for file " + | |||||
files[ i ], e ); | |||||
final String message = REZ.getString( "bad-filename.error", files[ i ] ); | |||||
throw new DeploymentException( message, e ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -0,0 +1,7 @@ | |||||
file-no-exist.error={0} ({1}) does not exist. | |||||
file-not-dir.error={0} ({1}) is not a directory. | |||||
bad-type.error=Object {0} is not an instance of {1}. | |||||
bad-ctor.error=Non-public constructor for {0} {1}. | |||||
no-instantiate.error=Error instantiating class for {0} {1}. | |||||
no-class.error=Could not find the class for {0} ({1}). | |||||
bad-filename.error=Unable to retrieve filename for file {0}. |
@@ -7,13 +7,15 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.components.executor; | package org.apache.myrmidon.components.executor; | ||||
import java.util.HashMap; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.HashMap; | |||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
import org.apache.avalon.framework.parameters.Parameters; | |||||
import org.apache.avalon.framework.configuration.DefaultConfiguration; | import org.apache.avalon.framework.configuration.DefaultConfiguration; | ||||
import org.apache.avalon.framework.parameters.Parameters; | |||||
import org.apache.log.Logger; | import org.apache.log.Logger; | ||||
import org.apache.myrmidon.api.Task; | import org.apache.myrmidon.api.Task; | ||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
@@ -24,6 +26,9 @@ import org.apache.myrmidon.components.aspect.AspectManager; | |||||
public class AspectAwareExecutor | public class AspectAwareExecutor | ||||
extends DefaultExecutor | extends DefaultExecutor | ||||
{ | { | ||||
private static final Resources REZ = | |||||
ResourceManager.getPackageResources( AspectAwareExecutor.class ); | |||||
private final static Parameters EMPTY_PARAMETERS; | private final static Parameters EMPTY_PARAMETERS; | ||||
private final static Configuration[] EMPTY_ELEMENTS = new Configuration[ 0 ]; | private final static Configuration[] EMPTY_ELEMENTS = new Configuration[ 0 ]; | ||||
@@ -71,33 +76,33 @@ public class AspectAwareExecutor | |||||
taskModel = getAspectManager().preCreate( taskModel ); | taskModel = getAspectManager().preCreate( taskModel ); | ||||
taskModel = prepareAspects( taskModel ); | taskModel = prepareAspects( taskModel ); | ||||
getLogger().debug( "Pre-Create" ); | |||||
debug( "creating.notice" ); | |||||
final Task task = createTask( taskModel.getName(), frame ); | final Task task = createTask( taskModel.getName(), frame ); | ||||
getAspectManager().postCreate( task ); | getAspectManager().postCreate( task ); | ||||
getLogger().debug( "Pre-Loggable" ); | |||||
debug( "logger.notice" ); | |||||
final Logger logger = frame.getLogger(); | final Logger logger = frame.getLogger(); | ||||
getAspectManager().preLoggable( logger ); | getAspectManager().preLoggable( logger ); | ||||
doLoggable( task, taskModel, logger ); | doLoggable( task, taskModel, logger ); | ||||
getLogger().debug( "Contextualizing" ); | |||||
debug( "contextualizing.notice" ); | |||||
doContextualize( task, taskModel, frame.getContext() ); | doContextualize( task, taskModel, frame.getContext() ); | ||||
getLogger().debug( "Composing" ); | |||||
debug( "composing.notice" ); | |||||
doCompose( task, taskModel, frame.getComponentManager() ); | doCompose( task, taskModel, frame.getComponentManager() ); | ||||
getLogger().debug( "Configuring" ); | |||||
debug( "configuring.notice" ); | |||||
getAspectManager().preConfigure( taskModel ); | getAspectManager().preConfigure( taskModel ); | ||||
doConfigure( task, taskModel, frame.getContext() ); | doConfigure( task, taskModel, frame.getContext() ); | ||||
getLogger().debug( "Initializing" ); | |||||
debug( "initializing.notice" ); | |||||
doInitialize( task, taskModel ); | doInitialize( task, taskModel ); | ||||
getLogger().debug( "Executing" ); | |||||
debug( "executing.notice" ); | |||||
getAspectManager().preExecute(); | getAspectManager().preExecute(); | ||||
doExecute( taskModel, task ); | doExecute( taskModel, task ); | ||||
getLogger().debug( "Disposing" ); | |||||
debug( "disposing.notice" ); | |||||
getAspectManager().preDestroy(); | getAspectManager().preDestroy(); | ||||
doDispose( task, taskModel ); | doDispose( task, taskModel ); | ||||
} | } | ||||
@@ -114,7 +119,7 @@ public class AspectAwareExecutor | |||||
private final Configuration prepareAspects( final Configuration taskModel ) | private final Configuration prepareAspects( final Configuration taskModel ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
final DefaultConfiguration newTaskModel = | |||||
final DefaultConfiguration newTaskModel = | |||||
new DefaultConfiguration( taskModel.getName(), taskModel.getLocation() ); | new DefaultConfiguration( taskModel.getName(), taskModel.getLocation() ); | ||||
final HashMap parameterMap = new HashMap(); | final HashMap parameterMap = new HashMap(); | ||||
final HashMap elementMap = new HashMap(); | final HashMap elementMap = new HashMap(); | ||||
@@ -128,12 +133,12 @@ public class AspectAwareExecutor | |||||
return newTaskModel; | return newTaskModel; | ||||
} | } | ||||
private final void dispatchAspectsSettings( final HashMap parameterMap, | |||||
private final void dispatchAspectsSettings( final HashMap parameterMap, | |||||
final HashMap elementMap ) | final HashMap elementMap ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
final String[] names = getAspectManager().getNames(); | final String[] names = getAspectManager().getNames(); | ||||
for( int i = 0; i < names.length; i++ ) | for( int i = 0; i < names.length; i++ ) | ||||
{ | { | ||||
final ArrayList elementList = (ArrayList)elementMap.remove( names[ i ] ); | final ArrayList elementList = (ArrayList)elementMap.remove( names[ i ] ); | ||||
@@ -147,18 +152,18 @@ public class AspectAwareExecutor | |||||
{ | { | ||||
elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | ||||
} | } | ||||
dispatch( names[ i ], parameters, elements ); | dispatch( names[ i ], parameters, elements ); | ||||
} | } | ||||
} | } | ||||
private final void checkForUnusedSettings( final HashMap parameterMap, | |||||
private final void checkForUnusedSettings( final HashMap parameterMap, | |||||
final HashMap elementMap ) | final HashMap elementMap ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
if( 0 != parameterMap.size() ) | if( 0 != parameterMap.size() ) | ||||
{ | { | ||||
final String[] namespaces = | |||||
final String[] namespaces = | |||||
(String[])parameterMap.keySet().toArray( new String[ 0 ] ); | (String[])parameterMap.keySet().toArray( new String[ 0 ] ); | ||||
for( int i = 0; i < namespaces.length; i++ ) | for( int i = 0; i < namespaces.length; i++ ) | ||||
@@ -166,48 +171,51 @@ public class AspectAwareExecutor | |||||
final String namespace = namespaces[ i ]; | final String namespace = namespaces[ i ]; | ||||
final Parameters parameters = (Parameters)parameterMap.get( namespace ); | final Parameters parameters = (Parameters)parameterMap.get( namespace ); | ||||
final ArrayList elementList = (ArrayList)elementMap.remove( namespace ); | final ArrayList elementList = (ArrayList)elementMap.remove( namespace ); | ||||
Configuration[] elements = null; | Configuration[] elements = null; | ||||
if( null == elementList ) elements = EMPTY_ELEMENTS; | if( null == elementList ) elements = EMPTY_ELEMENTS; | ||||
else | else | ||||
{ | { | ||||
elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | ||||
} | } | ||||
unusedSetting( namespace, parameters, elements ); | unusedSetting( namespace, parameters, elements ); | ||||
} | } | ||||
} | } | ||||
if( 0 != elementMap.size() ) | if( 0 != elementMap.size() ) | ||||
{ | { | ||||
final String[] namespaces = | |||||
final String[] namespaces = | |||||
(String[])elementMap.keySet().toArray( new String[ 0 ] ); | (String[])elementMap.keySet().toArray( new String[ 0 ] ); | ||||
for( int i = 0; i < namespaces.length; i++ ) | for( int i = 0; i < namespaces.length; i++ ) | ||||
{ | { | ||||
final String namespace = namespaces[ i ]; | final String namespace = namespaces[ i ]; | ||||
final ArrayList elementList = (ArrayList)elementMap.remove( namespace ); | final ArrayList elementList = (ArrayList)elementMap.remove( namespace ); | ||||
final Configuration[] elements = | |||||
final Configuration[] elements = | |||||
(Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | ||||
unusedSetting( namespace, EMPTY_PARAMETERS, elements ); | unusedSetting( namespace, EMPTY_PARAMETERS, elements ); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
private void unusedSetting( final String namespace, | |||||
final Parameters parameters, | |||||
private void unusedSetting( final String namespace, | |||||
final Parameters parameters, | |||||
final Configuration[] elements ) | final Configuration[] elements ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
throw new TaskException( "Unused aspect settings for namespace " + namespace + | |||||
" (parameterCount=" + parameters.getNames().length + | |||||
" elementCount=" + elements.length + ")" ); | |||||
final String message = | |||||
REZ.getString( "unused-settings.error", | |||||
namespace, | |||||
Integer.toString( parameters.getNames().length ), | |||||
Integer.toString( elements.length ) ); | |||||
throw new TaskException( message ); | |||||
} | } | ||||
private void dispatch( final String namespace, | |||||
final Parameters parameters, | |||||
private void dispatch( final String namespace, | |||||
final Parameters parameters, | |||||
final Configuration[] elements ) | final Configuration[] elements ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
@@ -215,13 +223,16 @@ public class AspectAwareExecutor | |||||
if( getLogger().isDebugEnabled() ) | if( getLogger().isDebugEnabled() ) | ||||
{ | { | ||||
getLogger().debug( "Dispatching Aspect Settings to: " + namespace + | |||||
" parameterCount=" + parameters.getNames().length + | |||||
" elementCount=" + elements.length ); | |||||
final String message = | |||||
REZ.getString( "dispatch-settings.notice", | |||||
namespace, | |||||
Integer.toString( parameters.getNames().length ), | |||||
Integer.toString( elements.length ) ); | |||||
getLogger().debug( message ); | |||||
} | } | ||||
} | } | ||||
private final void processElements( final Configuration taskModel, | |||||
private final void processElements( final Configuration taskModel, | |||||
final DefaultConfiguration newTaskModel, | final DefaultConfiguration newTaskModel, | ||||
final HashMap map ) | final HashMap map ) | ||||
{ | { | ||||
@@ -230,8 +241,8 @@ public class AspectAwareExecutor | |||||
{ | { | ||||
final String name = elements[ i ].getName(); | final String name = elements[ i ].getName(); | ||||
final int index = name.indexOf( ':' ); | final int index = name.indexOf( ':' ); | ||||
if( -1 == index ) | |||||
if( -1 == index ) | |||||
{ | { | ||||
newTaskModel.addChild( elements[ i ] ); | newTaskModel.addChild( elements[ i ] ); | ||||
} | } | ||||
@@ -245,7 +256,7 @@ public class AspectAwareExecutor | |||||
} | } | ||||
} | } | ||||
private final void processAttributes( final Configuration taskModel, | |||||
private final void processAttributes( final Configuration taskModel, | |||||
final DefaultConfiguration newTaskModel, | final DefaultConfiguration newTaskModel, | ||||
final HashMap map ) | final HashMap map ) | ||||
{ | { | ||||
@@ -256,8 +267,8 @@ public class AspectAwareExecutor | |||||
final String value = taskModel.getAttribute( name, null ); | final String value = taskModel.getAttribute( name, null ); | ||||
final int index = name.indexOf( ':' ); | final int index = name.indexOf( ':' ); | ||||
if( -1 == index ) | |||||
if( -1 == index ) | |||||
{ | { | ||||
newTaskModel.setAttribute( name, value ); | newTaskModel.setAttribute( name, value ); | ||||
} | } | ||||
@@ -7,6 +7,8 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.components.executor; | package org.apache.myrmidon.components.executor; | ||||
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.Disposable; | ||||
import org.apache.avalon.framework.activity.Initializable; | import org.apache.avalon.framework.activity.Initializable; | ||||
import org.apache.avalon.framework.component.Component; | import org.apache.avalon.framework.component.Component; | ||||
@@ -34,6 +36,9 @@ public class DefaultExecutor | |||||
extends AbstractLoggable | extends AbstractLoggable | ||||
implements Executor, Composable | implements Executor, Composable | ||||
{ | { | ||||
private static final Resources REZ = | |||||
ResourceManager.getPackageResources( DefaultExecutor.class ); | |||||
private Configurer m_configurer; | private Configurer m_configurer; | ||||
/** | /** | ||||
@@ -51,30 +56,40 @@ public class DefaultExecutor | |||||
public void execute( final Configuration taskModel, final ExecutionFrame frame ) | public void execute( final Configuration taskModel, final ExecutionFrame frame ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
getLogger().debug( "Creating" ); | |||||
debug( "creating.notice" ); | |||||
final Task task = createTask( taskModel.getName(), frame ); | final Task task = createTask( taskModel.getName(), frame ); | ||||
debug( "logger.notice" ); | |||||
doLoggable( task, taskModel, frame.getLogger() ); | doLoggable( task, taskModel, frame.getLogger() ); | ||||
getLogger().debug( "Contextualizing" ); | |||||
debug( "contextualizing.notice" ); | |||||
doContextualize( task, taskModel, frame.getContext() ); | doContextualize( task, taskModel, frame.getContext() ); | ||||
getLogger().debug( "Composing" ); | |||||
debug( "composing.notice" ); | |||||
doCompose( task, taskModel, frame.getComponentManager() ); | doCompose( task, taskModel, frame.getComponentManager() ); | ||||
getLogger().debug( "Configuring" ); | |||||
debug( "configuring.notice" ); | |||||
doConfigure( task, taskModel, frame.getContext() ); | doConfigure( task, taskModel, frame.getContext() ); | ||||
getLogger().debug( "Initializing" ); | |||||
debug( "initializing.notice" ); | |||||
doInitialize( task, taskModel ); | doInitialize( task, taskModel ); | ||||
getLogger().debug( "Running" ); | |||||
debug( "executing.notice" ); | |||||
task.execute(); | task.execute(); | ||||
getLogger().debug( "Disposing" ); | |||||
debug( "disposing.notice" ); | |||||
doDispose( task, taskModel ); | doDispose( task, taskModel ); | ||||
} | } | ||||
protected final void debug( final String key ) | |||||
{ | |||||
if( getLogger().isDebugEnabled() ) | |||||
{ | |||||
final String message = REZ.getString( key ); | |||||
getLogger().debug( message ); | |||||
} | |||||
} | |||||
protected final Task createTask( final String name, final ExecutionFrame frame ) | protected final Task createTask( final String name, final ExecutionFrame frame ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
@@ -85,7 +100,8 @@ public class DefaultExecutor | |||||
} | } | ||||
catch( final TypeException te ) | catch( final TypeException te ) | ||||
{ | { | ||||
throw new TaskException( "Unable to create task " + name, te ); | |||||
final String message = REZ.getString( "no-create.error", name ); | |||||
throw new TaskException( message, te ); | |||||
} | } | ||||
} | } | ||||
@@ -97,13 +113,16 @@ public class DefaultExecutor | |||||
try { m_configurer.configure( task, taskModel, context ); } | try { m_configurer.configure( task, taskModel, context ); } | ||||
catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
{ | { | ||||
throw new TaskException( "Error configuring task " + taskModel.getName() + " at " + | |||||
taskModel.getLocation() + "(Reason: " + | |||||
throwable.getMessage() + ")", throwable ); | |||||
final String message = | |||||
REZ.getString( "config.error", | |||||
taskModel.getName(), | |||||
taskModel.getLocation(), | |||||
throwable.getMessage() ); | |||||
throw new TaskException( message, throwable ); | |||||
} | } | ||||
} | } | ||||
protected final void doCompose( final Task task, | |||||
protected final void doCompose( final Task task, | |||||
final Configuration taskModel, | final Configuration taskModel, | ||||
final ComponentManager componentManager ) | final ComponentManager componentManager ) | ||||
throws TaskException | throws TaskException | ||||
@@ -113,9 +132,12 @@ public class DefaultExecutor | |||||
try { ((Composable)task).compose( componentManager ); } | try { ((Composable)task).compose( componentManager ); } | ||||
catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
{ | { | ||||
throw new TaskException( "Error composing task " + taskModel.getName() + " at " + | |||||
taskModel.getLocation() + "(Reason: " + | |||||
throwable.getMessage() + ")", throwable ); | |||||
final String message = | |||||
REZ.getString( "compose.error", | |||||
taskModel.getName(), | |||||
taskModel.getLocation(), | |||||
throwable.getMessage() ); | |||||
throw new TaskException( message, throwable ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -134,9 +156,12 @@ public class DefaultExecutor | |||||
} | } | ||||
catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
{ | { | ||||
throw new TaskException( "Error contextualizing task " + taskModel.getName() + " at " + | |||||
taskModel.getLocation() + "(Reason: " + | |||||
throwable.getMessage() + ")", throwable ); | |||||
final String message = | |||||
REZ.getString( "compose.error", | |||||
taskModel.getName(), | |||||
taskModel.getLocation(), | |||||
throwable.getMessage() ); | |||||
throw new TaskException( message, throwable ); | |||||
} | } | ||||
} | } | ||||
@@ -148,15 +173,18 @@ public class DefaultExecutor | |||||
try { ((Disposable)task).dispose(); } | try { ((Disposable)task).dispose(); } | ||||
catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
{ | { | ||||
throw new TaskException( "Error disposing task " + taskModel.getName() + " at " + | |||||
taskModel.getLocation() + "(Reason: " + | |||||
throwable.getMessage() + ")", throwable ); | |||||
final String message = | |||||
REZ.getString( "dispose.error", | |||||
taskModel.getName(), | |||||
taskModel.getLocation(), | |||||
throwable.getMessage() ); | |||||
throw new TaskException( message, throwable ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
protected final void doLoggable( final Task task, | |||||
final Configuration taskModel, | |||||
protected final void doLoggable( final Task task, | |||||
final Configuration taskModel, | |||||
final Logger logger ) | final Logger logger ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
@@ -165,9 +193,12 @@ public class DefaultExecutor | |||||
try { ((Loggable)task).setLogger( logger ); } | try { ((Loggable)task).setLogger( logger ); } | ||||
catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
{ | { | ||||
throw new TaskException( "Error setting logger for task " + taskModel.getName() + | |||||
" at " + taskModel.getLocation() + "(Reason: " + | |||||
throwable.getMessage() + ")", throwable ); | |||||
final String message = | |||||
REZ.getString( "logger.error", | |||||
taskModel.getName(), | |||||
taskModel.getLocation(), | |||||
throwable.getMessage() ); | |||||
throw new TaskException( message, throwable ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -180,9 +211,12 @@ public class DefaultExecutor | |||||
try { ((Initializable)task).initialize(); } | try { ((Initializable)task).initialize(); } | ||||
catch( final Throwable throwable ) | catch( final Throwable throwable ) | ||||
{ | { | ||||
throw new TaskException( "Error initializing task " + taskModel.getName() + " at " + | |||||
taskModel.getLocation() + "(Reason: " + | |||||
throwable.getMessage() + ")", throwable ); | |||||
final String message = | |||||
REZ.getString( "init.error", | |||||
taskModel.getName(), | |||||
taskModel.getLocation(), | |||||
throwable.getMessage() ); | |||||
throw new TaskException( message, throwable ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -0,0 +1,19 @@ | |||||
creating.notice=Creating. | |||||
logger.notice=Setting Logger. | |||||
contextualizing.notice=Contextualizing. | |||||
composing.notice=Composing. | |||||
configuring.notice=Configuring. | |||||
initializing.notice=Initializing. | |||||
executing.notice=Executing. | |||||
disposing.notice=Disposing. | |||||
no-create.error=Unable to create task {0}. | |||||
config.error=Error configuring task {0} at {1} (Reason: {2}). | |||||
compose.error=Error composing task {0} at {1} (Reason: {2}). | |||||
context.error=Error contextualizing task {0} at {1} (Reason: {2}). | |||||
dispose.error=Error disposing task {0} at {1} (Reason: {2}). | |||||
init.error=Error initializing task {0} at {1} (Reason: {2}). | |||||
logger.error=Error setting logger for task {0} at {1} (Reason: {2}). | |||||
unused-settings.error=Unused aspect settings for namespace {0} (parameterCount={1} elementCount={2}). | |||||
dispatch-settings.notice=Dispatching Aspect Settings to namespace {0} (parameterCount={1} elementCount={2}). |
@@ -11,6 +11,8 @@ import java.io.File; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
/** | /** | ||||
* Default project implementation. | * Default project implementation. | ||||
@@ -20,6 +22,9 @@ import java.util.HashMap; | |||||
public class DefaultProject | public class DefaultProject | ||||
implements Project | implements Project | ||||
{ | { | ||||
private static final Resources REZ = | |||||
ResourceManager.getPackageResources( DefaultProject.class ); | |||||
///The imports | ///The imports | ||||
private final ArrayList m_imports = new ArrayList(); | private final ArrayList m_imports = new ArrayList(); | ||||
@@ -167,8 +172,8 @@ public class DefaultProject | |||||
{ | { | ||||
if( null != m_targets.get( name ) ) | if( null != m_targets.get( name ) ) | ||||
{ | { | ||||
throw new IllegalArgumentException( "Can not have two targets in a " + | |||||
"file with the name " + name ); | |||||
final String message = REZ.getString( "duplicate-target.error", name ); | |||||
throw new IllegalArgumentException( message ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -187,8 +192,8 @@ public class DefaultProject | |||||
{ | { | ||||
if( null != m_projects.get( name ) ) | if( null != m_projects.get( name ) ) | ||||
{ | { | ||||
throw new IllegalArgumentException( "Can not have two projects referenced in a " + | |||||
"file with the name " + name ); | |||||
final String message = REZ.getString( "duplicate-project.error", name ); | |||||
throw new IllegalArgumentException( message ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -0,0 +1,2 @@ | |||||
duplicate-project.error=Can not have two projects referenced in a file with the name {0}. | |||||
duplicate-target.error=Can not have two targets in a file with the name {0}. |
@@ -12,6 +12,8 @@ import java.util.Enumeration; | |||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import javax.xml.parsers.SAXParser; | import javax.xml.parsers.SAXParser; | ||||
import javax.xml.parsers.SAXParserFactory; | import javax.xml.parsers.SAXParserFactory; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.avalon.framework.activity.Initializable; | import org.apache.avalon.framework.activity.Initializable; | ||||
import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
import org.apache.avalon.framework.configuration.ConfigurationException; | import org.apache.avalon.framework.configuration.ConfigurationException; | ||||
@@ -28,6 +30,9 @@ import org.xml.sax.XMLReader; | |||||
public class DefaultRoleManager | public class DefaultRoleManager | ||||
implements RoleManager, Initializable | implements RoleManager, Initializable | ||||
{ | { | ||||
private static final Resources REZ = | |||||
ResourceManager.getPackageResources( DefaultRoleManager.class ); | |||||
private final static String ROLE_DESCRIPTOR = "META-INF/ant-roles.xml"; | private final static String ROLE_DESCRIPTOR = "META-INF/ant-roles.xml"; | ||||
/** Parent <code>RoleManager</code> for nested resolution */ | /** Parent <code>RoleManager</code> for nested resolution */ | ||||
@@ -152,15 +157,15 @@ public class DefaultRoleManager | |||||
final String oldRole = (String)m_names.get( name ); | final String oldRole = (String)m_names.get( name ); | ||||
if( null != oldRole && oldRole.equals( role ) ) | if( null != oldRole && oldRole.equals( role ) ) | ||||
{ | { | ||||
throw new IllegalArgumentException( "Name already mapped to another role (" + | |||||
oldRole + ")" ); | |||||
final String message = REZ.getString( "duplicate-name.error", oldRole ); | |||||
throw new IllegalArgumentException( message ); | |||||
} | } | ||||
final String oldName = (String)m_roles.get( role ); | final String oldName = (String)m_roles.get( role ); | ||||
if( null != oldName && oldName.equals( name ) ) | if( null != oldName && oldName.equals( name ) ) | ||||
{ | { | ||||
throw new IllegalArgumentException( "Role already mapped to another name (" + | |||||
oldName + ")" ); | |||||
final String message = REZ.getString( "duplicate-role.error", oldName ); | |||||
throw new IllegalArgumentException( message ); | |||||
} | } | ||||
m_names.put( name, role ); | m_names.put( name, role ); | ||||
@@ -0,0 +1,2 @@ | |||||
duplicate-name.error=Name already mapped to another role ({0}). | |||||
duplicate-role.error=Role already mapped to another name ({0}). |
@@ -10,6 +10,8 @@ package org.apache.myrmidon.components.type; | |||||
import java.net.URL; | import java.net.URL; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.net.URLClassLoader; | import java.net.URLClassLoader; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
/** | /** | ||||
* Create a type instance based on name. | * Create a type instance based on name. | ||||
@@ -20,6 +22,9 @@ import java.net.URLClassLoader; | |||||
public class DefaultTypeFactory | public class DefaultTypeFactory | ||||
implements TypeFactory | implements TypeFactory | ||||
{ | { | ||||
private static final Resources REZ = | |||||
ResourceManager.getPackageResources( DefaultTypeFactory.class ); | |||||
///A Map of shortnames to classnames | ///A Map of shortnames to classnames | ||||
private final HashMap m_classNames = new HashMap(); | private final HashMap m_classNames = new HashMap(); | ||||
@@ -77,7 +82,8 @@ public class DefaultTypeFactory | |||||
} | } | ||||
catch( final Exception e ) | catch( final Exception e ) | ||||
{ | { | ||||
throw new TypeException( "Unable to instantiate '" + name + "'", e ); | |||||
final String message = REZ.getString( "no-instantiate.error", name ); | |||||
throw new TypeException( message, e ); | |||||
} | } | ||||
} | } | ||||
@@ -88,8 +94,8 @@ public class DefaultTypeFactory | |||||
if( null == className ) | if( null == className ) | ||||
{ | { | ||||
throw new TypeException( "Malconfigured factory, no clasname for '" + | |||||
name + "'" ); | |||||
final String message = REZ.getString( "no-mapping.error", name ); | |||||
throw new TypeException( message ); | |||||
} | } | ||||
return className; | return className; | ||||
@@ -8,6 +8,8 @@ | |||||
package org.apache.myrmidon.components.type; | package org.apache.myrmidon.components.type; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
/** | /** | ||||
* The interface that is used to manage types. | * The interface that is used to manage types. | ||||
@@ -17,6 +19,9 @@ import java.util.HashMap; | |||||
public class DefaultTypeManager | public class DefaultTypeManager | ||||
implements TypeManager | implements TypeManager | ||||
{ | { | ||||
private static final Resources REZ = | |||||
ResourceManager.getPackageResources( DefaultTypeManager.class ); | |||||
///Parent type manager to inherit values from. | ///Parent type manager to inherit values from. | ||||
private final DefaultTypeManager m_parent; | private final DefaultTypeManager m_parent; | ||||
@@ -92,8 +97,8 @@ public class DefaultTypeManager | |||||
} | } | ||||
catch( final Exception e ) | catch( final Exception e ) | ||||
{ | { | ||||
throw new TypeException( "Role '" + role + "' does not specify " + | |||||
"accessible work interface" ); | |||||
final String message = REZ.getString( "no-work-interface.error", role ); | |||||
throw new TypeException( message ); | |||||
} | } | ||||
} | } | ||||
@@ -8,6 +8,8 @@ | |||||
package org.apache.myrmidon.components.type; | package org.apache.myrmidon.components.type; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
/** | /** | ||||
* This factory acts as a proxy to set of object factorys. | * This factory acts as a proxy to set of object factorys. | ||||
@@ -15,8 +17,11 @@ import java.util.HashMap; | |||||
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | ||||
*/ | */ | ||||
public class MultiSourceTypeFactory | public class MultiSourceTypeFactory | ||||
implements TypeFactory | |||||
implements TypeFactory | |||||
{ | { | ||||
private static final Resources REZ = | |||||
ResourceManager.getPackageResources( MultiSourceTypeFactory.class ); | |||||
///Parent Selector | ///Parent Selector | ||||
private final MultiSourceTypeFactory m_parent; | private final MultiSourceTypeFactory m_parent; | ||||
@@ -58,14 +63,15 @@ public class MultiSourceTypeFactory | |||||
{ | { | ||||
TypeFactory factory = getTypeFactory( name ); | TypeFactory factory = getTypeFactory( name ); | ||||
if( null == factory && null != m_parent ) | |||||
if( null == factory && null != m_parent ) | |||||
{ | { | ||||
factory = m_parent.getTypeFactory( name ); | factory = m_parent.getTypeFactory( name ); | ||||
} | } | ||||
if( null == factory ) | |||||
if( null == factory ) | |||||
{ | { | ||||
throw new TypeException( "Failed to locate factory for '" + name + "'" ); | |||||
final String message = REZ.getString( "no-factory.error", name ); | |||||
throw new TypeException( message ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -73,8 +79,8 @@ public class MultiSourceTypeFactory | |||||
if( !m_type.isInstance( object ) ) | if( !m_type.isInstance( object ) ) | ||||
{ | { | ||||
throw new TypeException( "Object '" + name + "' is not of " + | |||||
"correct Type (" + m_type.getName() + ")" ); | |||||
final String message = REZ.getString( "no-factory.error", name, m_type.getName() ); | |||||
throw new TypeException( message ); | |||||
} | } | ||||
return object; | return object; | ||||
@@ -0,0 +1,5 @@ | |||||
no-instantiate.error=Unable to instantiate ({0}). | |||||
no-mapping.error=Malconfigured factory, no clasname for ({0}). | |||||
no-factory.error=Failed to locate factory for {0}. | |||||
bad-type.error=Object {0} is not of correct Type ({1}). | |||||
no-work-interface.error=Role {0} does not specify accessible work interface. |
@@ -12,21 +12,22 @@ import java.util.ArrayList; | |||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.avalon.framework.activity.Disposable; | import org.apache.avalon.framework.activity.Disposable; | ||||
import org.apache.avalon.framework.activity.Initializable; | import org.apache.avalon.framework.activity.Initializable; | ||||
import org.apache.avalon.framework.context.ContextException; | |||||
import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
import org.apache.avalon.framework.component.Composable; | import org.apache.avalon.framework.component.Composable; | ||||
import org.apache.avalon.framework.component.DefaultComponentManager; | import org.apache.avalon.framework.component.DefaultComponentManager; | ||||
import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
import org.apache.avalon.framework.context.ContextException; | |||||
import org.apache.avalon.framework.logger.AbstractLoggable; | import org.apache.avalon.framework.logger.AbstractLoggable; | ||||
import org.apache.avalon.framework.parameters.ParameterException; | import org.apache.avalon.framework.parameters.ParameterException; | ||||
import org.apache.avalon.framework.parameters.Parameterizable; | import org.apache.avalon.framework.parameters.Parameterizable; | ||||
import org.apache.avalon.framework.parameters.Parameters; | import org.apache.avalon.framework.parameters.Parameters; | ||||
import org.apache.log.Hierarchy; | import org.apache.log.Hierarchy; | ||||
import org.apache.log.Logger; | import org.apache.log.Logger; | ||||
import org.apache.log.LogTarget; | |||||
import org.apache.myrmidon.api.DefaultTaskContext; | import org.apache.myrmidon.api.DefaultTaskContext; | ||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
@@ -52,6 +53,9 @@ public class DefaultWorkspace | |||||
extends AbstractLoggable | extends AbstractLoggable | ||||
implements Workspace, Composable, Parameterizable, Initializable | implements Workspace, Composable, Parameterizable, Initializable | ||||
{ | { | ||||
private static final Resources REZ = | |||||
ResourceManager.getPackageResources( DefaultWorkspace.class ); | |||||
private Executor m_executor; | private Executor m_executor; | ||||
private ProjectListenerSupport m_listenerSupport = new ProjectListenerSupport(); | private ProjectListenerSupport m_listenerSupport = new ProjectListenerSupport(); | ||||
private ComponentManager m_componentManager; | private ComponentManager m_componentManager; | ||||
@@ -109,7 +113,7 @@ public class DefaultWorkspace | |||||
m_hierarchy = new Hierarchy(); | m_hierarchy = new Hierarchy(); | ||||
final LogTarget target = new LogTargetToListenerAdapter( m_listenerSupport ); | |||||
final LogTargetToListenerAdapter target = new LogTargetToListenerAdapter( m_listenerSupport ); | |||||
m_hierarchy.setDefaultLogTarget( target ); | m_hierarchy.setDefaultLogTarget( target ); | ||||
} | } | ||||
@@ -158,21 +162,22 @@ public class DefaultWorkspace | |||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
//TODO: In future this will be expanded to allow | //TODO: In future this will be expanded to allow | ||||
//users to specify search path or automagically | |||||
//add entries to lib path (like user specific or | |||||
//users to specify search path or automagically | |||||
//add entries to lib path (like user specific or | |||||
//workspace specific) | //workspace specific) | ||||
final String name = libraryName.replace( '/', File.separatorChar ) + ".atl"; | final String name = libraryName.replace( '/', File.separatorChar ) + ".atl"; | ||||
final String home = System.getProperty( "myrmidon.home" ); | final String home = System.getProperty( "myrmidon.home" ); | ||||
final File homeDir = new File( home + File.separatorChar + "ext" ); | final File homeDir = new File( home + File.separatorChar + "ext" ); | ||||
final File library = new File( homeDir, name ); | final File library = new File( homeDir, name ); | ||||
if( library.exists() ) | if( library.exists() ) | ||||
{ | { | ||||
if( !library.canRead() ) | if( !library.canRead() ) | ||||
{ | { | ||||
throw new TaskException( "Unable to read library at " + library ); | |||||
final String message = REZ.getString( "no-read.error", library ); | |||||
throw new TaskException( message ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -180,7 +185,8 @@ public class DefaultWorkspace | |||||
} | } | ||||
} | } | ||||
throw new TaskException( "Unable to locate Type Library " + libraryName ); | |||||
final String message = REZ.getString( "no-library.error", libraryName ); | |||||
throw new TaskException( message ); | |||||
} | } | ||||
private void deployTypeLib( final Deployer deployer, final Project project ) | private void deployTypeLib( final Deployer deployer, final Project project ) | ||||
@@ -206,8 +212,8 @@ public class DefaultWorkspace | |||||
} | } | ||||
catch( final DeploymentException de ) | catch( final DeploymentException de ) | ||||
{ | { | ||||
throw new TaskException( "Error deploying type library " + | |||||
typeLib + " at " + file, de ); | |||||
final String message = REZ.getString( "no-deploy.error", typeLib, file ); | |||||
throw new TaskException( message, de ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -235,7 +241,8 @@ public class DefaultWorkspace | |||||
try { deployer.compose( componentManager ); } | try { deployer.compose( componentManager ); } | ||||
catch( final ComponentException ce ) | catch( final ComponentException ce ) | ||||
{ | { | ||||
throw new TaskException( "Error configuring deployer", ce ); | |||||
final String message = REZ.getString( "bad-deployer-config.error" ); | |||||
throw new TaskException( message, ce ); | |||||
} | } | ||||
//HACK: Didn't call initialize because Deployer contained in Embeddor | //HACK: Didn't call initialize because Deployer contained in Embeddor | ||||
@@ -272,7 +279,8 @@ public class DefaultWorkspace | |||||
} | } | ||||
catch( final Exception e ) | catch( final Exception e ) | ||||
{ | { | ||||
throw new TaskException( "Error setting up ExecutionFrame", e ); | |||||
final String message = REZ.getString( "bad-frame.error" ); | |||||
throw new TaskException( message, e ); | |||||
} | } | ||||
return frame; | return frame; | ||||
@@ -301,7 +309,8 @@ public class DefaultWorkspace | |||||
if( null == other ) | if( null == other ) | ||||
{ | { | ||||
//TODO: Fix this so location information included in description | //TODO: Fix this so location information included in description | ||||
throw new TaskException( "Project '" + name + "' not found." ); | |||||
final String message = REZ.getString( "no-project.error", name ); | |||||
throw new TaskException( message ); | |||||
} | } | ||||
return other; | return other; | ||||
@@ -338,7 +347,8 @@ public class DefaultWorkspace | |||||
final Target target = project.getTarget( targetName ); | final Target target = project.getTarget( targetName ); | ||||
if( null == target ) | if( null == target ) | ||||
{ | { | ||||
throw new TaskException( "Unable to find target " + targetName ); | |||||
final String message = REZ.getString( "no-target.error", targetName ); | |||||
throw new TaskException( message ); | |||||
} | } | ||||
//add target to list of targets executed | //add target to list of targets executed | ||||
@@ -385,19 +395,20 @@ public class DefaultWorkspace | |||||
{ | { | ||||
if( false == condition.evaluate( frame.getContext() ) ) | if( false == condition.evaluate( frame.getContext() ) ) | ||||
{ | { | ||||
getLogger().debug( "Skipping target " + name + | |||||
" as it does not satisfy condition" ); | |||||
final String message = REZ.getString( "skip-target.notice", name ); | |||||
getLogger().debug( message ); | |||||
return; | return; | ||||
} | } | ||||
} | } | ||||
catch( final ContextException ce ) | catch( final ContextException ce ) | ||||
{ | { | ||||
throw new TaskException( "Error evaluating Condition for target " + | |||||
name, ce ); | |||||
final String message = REZ.getString( "condition-eval.error", name ); | |||||
throw new TaskException( message, ce ); | |||||
} | } | ||||
} | } | ||||
getLogger().debug( "Executing target " + name ); | |||||
final String message = REZ.getString( "exec-target.notice", name ); | |||||
getLogger().debug( message ); | |||||
//frame.getContext().setProperty( Project.TARGET, target ); | //frame.getContext().setProperty( Project.TARGET, target ); | ||||
@@ -420,7 +431,9 @@ public class DefaultWorkspace | |||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
final String name = task.getName(); | final String name = task.getName(); | ||||
getLogger().debug( "Executing task " + name ); | |||||
final String message = REZ.getString( "exec-task.notice", name ); | |||||
getLogger().debug( message ); | |||||
//is setting name even necessary ??? | //is setting name even necessary ??? | ||||
frame.getContext().setProperty( TaskContext.NAME, name ); | frame.getContext().setProperty( TaskContext.NAME, name ); | ||||
@@ -0,0 +1,11 @@ | |||||
no-read.error=Unable to read library at {0}. | |||||
no-library.error=Unable to locate Type Library {0}. | |||||
no-deploy.error=Error deploying type library {0} at {1}. | |||||
bad-deployer-config.error=Error configuring deployer. | |||||
bad-frame.error=Error setting up ExecutionFrame. | |||||
no-project.error=Project {0} not found. | |||||
no-target.error=Target {0} not found. | |||||
skip-target.notice=Skipping target {0} as it does not satisfy condition. | |||||
condition-eval.error=Error evaluating Condition for target {0}. | |||||
exec-target.notice=Executing target {0}. | |||||
exec-task.notice=Executing task {0}. |