adammurdoch 02/04/09 00:21:13
Modified:
proposal/myrmidon/src/java/org/apache/myrmidon/components/classloader
DefaultClassLoaderManager.java
proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor
DefaultEmbeddor.java
proposal/myrmidon/src/java/org/apache/myrmidon/components/extensions
DefaultExtensionManager.java
proposal/myrmidon/src/java/org/apache/myrmidon/components/service
InstantiatingServiceManager.java
proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace
DefaultWorkspace.java
proposal/myrmidon/src/java/org/apache/myrmidon/framework/factories
ExecManagerFactory.java
proposal/myrmidon/src/java/org/apache/myrmidon/frontends
CLIMain.java EmbeddedAnt.java Resources.properties
proposal/myrmidon/src/test/org/apache/myrmidon/components
AbstractComponentTest.java
proposal/myrmidon/src/test/org/apache/myrmidon/components/classloader/test
DefaultClassLoaderManagerTestCase.java
proposal/myrmidon/src/test/org/apache/myrmidon/components/embeddor/test
DefaultEmbeddorTest.java
proposal/myrmidon/src/test/org/apache/myrmidon/components/service/test
InstantiatingServiceManagerTestCase.java
LifecycleValidator.java
Log:
Changed container config from Parameters to Context, to allow Objects to
be used in the config:
* All services that used to implement Parameterizable now implement
Contextualizable.
* Changed 'myrmidon.home' to a File, and the paths to File[].
* DefaultEmbeddor now deploys Antlibs from all directories in
'myrmidon.lib.path',
rather than just a single dir. Can't specify alternative service
implementations (temporarily broken).
* Added 'myrmidon.antlib.path', which DefaultWorkspace uses to search for
<import>-ed
antlibs.
* Replaced --task-lib-dir with --antlib-path, which appends directories to
'myrmidon.antlib.path'
* Added --ext-path, which appends directories to 'myrmidon.ext.path'.
* DefaultClassLoaderManager now uses the container config to locate the shared
classloader, rather than using the context classloader.
Revision Changes Path
1.7 +10 -8
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/classloader/DefaultClassLoaderManager.java
Index: DefaultClassLoaderManager.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/classloader/DefaultClassLoaderManager.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DefaultClassLoaderManager.java 7 Apr 2002 09:51:09 -0000 1.6
+++ DefaultClassLoaderManager.java 9 Apr 2002 07:21:12 -0000 1.7
@@ -12,16 +12,19 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.HashSet;
-import java.util.jar.Manifest;
import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import org.apache.aut.nativelib.PathUtil;
import org.apache.avalon.excalibur.extension.Extension;
import org.apache.avalon.excalibur.extension.OptionalPackage;
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.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
@@ -30,17 +33,16 @@
import org.apache.myrmidon.interfaces.classloader.ClassLoaderManager;
import org.apache.myrmidon.interfaces.deployer.DeploymentException;
import org.apache.myrmidon.interfaces.extensions.ExtensionManager;
-import org.apache.aut.nativelib.PathUtil;
/**
* A default implementation of a ClassLoader manager.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
- * @version $Revision: 1.6 $ $Date: 2002/04/07 09:51:09 $
+ * @version $Revision: 1.7 $ $Date: 2002/04/09 07:21:12 $
*/
public class DefaultClassLoaderManager
extends AbstractLogEnabled
- implements ClassLoaderManager, Serviceable, Initializable
+ implements ClassLoaderManager, Serviceable, Contextualizable
{
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultClassLoaderManager.class
);
@@ -62,11 +64,11 @@
m_commonClassLoader = commonClassLoader;
}
- public void initialize() throws Exception
+ public void contextualize( final Context context ) throws
ContextException
{
if( null == m_commonClassLoader )
{
- m_commonClassLoader =
Thread.currentThread().getContextClassLoader();
+ m_commonClassLoader = (ClassLoader)context.get(
"myrmidon.shared.classloader" );
}
}
1.45 +33 -23
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java
Index: DefaultEmbeddor.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- DefaultEmbeddor.java 9 Apr 2002 02:26:34 -0000 1.44
+++ DefaultEmbeddor.java 9 Apr 2002 07:21:12 -0000 1.45
@@ -19,6 +19,9 @@
import org.apache.avalon.excalibur.io.ExtensionFileFilter;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.avalon.framework.CascadingException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Startable;
@@ -58,11 +61,11 @@
* Instantiate this to embed inside other applications.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Revision: 1.44 $ $Date: 2002/04/09 02:26:34 $
+ * @version $Revision: 1.45 $ $Date: 2002/04/09 07:21:12 $
*/
public class DefaultEmbeddor
extends AbstractLogEnabled
- implements Embeddor, Parameterizable, Initializable, Startable,
Disposable
+ implements Embeddor, Contextualizable, Initializable, Startable,
Disposable
{
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultEmbeddor.class );
@@ -76,17 +79,15 @@
private List m_components = new ArrayList();
private DefaultServiceManager m_serviceManager = new
DefaultServiceManager();
- private Parameters m_parameters;
+ private Context m_context;
/**
* Setup basic properties of engine.
* Called before init() and can be used to specify alternate components
in system.
- *
- * @param parameters the parameters.
*/
- public void parameterize( final Parameters parameters )
+ public void contextualize( final Context context ) throws
ContextException
{
- m_parameters = parameters;
+ m_context = context;
}
/**
@@ -137,7 +138,7 @@
{
final Workspace workspace =
(Workspace)createService( Workspace.class, PREFIX +
"workspace.DefaultWorkspace" );
- setupObject( workspace, m_workspaceServiceManager, m_parameters );
+ setupObject( workspace, m_workspaceServiceManager, null );
// Create the property store
final PropertyStore propStore = createBaseStore( properties );
@@ -185,7 +186,7 @@
final ServiceManager projServiceManager
= (ServiceManager)createService( ServiceManager.class,
PREFIX +
"service.InstantiatingServiceManager" );
- setupObject( projServiceManager, m_serviceManager, m_parameters );
+ setupObject( projServiceManager, m_serviceManager, null );
m_components.add( projServiceManager );
// setup a service manager to be used by workspaces
@@ -204,8 +205,8 @@
// Deploy all type libraries in the lib directory
final ExtensionFileFilter filter = new ExtensionFileFilter( ".atl" );
- final File taskLibDir = new File( m_parameters.getParameter(
"myrmidon.lib.path" ) );
- deployFromDirectory( m_deployer, taskLibDir, filter );
+ final File[] taskLibDirs = (File[])m_context.get(
"myrmidon.lib.path" );
+ deployFromDirectories( m_deployer, taskLibDirs, filter );
}
/**
@@ -236,7 +237,7 @@
m_components = null;
m_deployer = null;
m_serviceManager = null;
- m_parameters = null;
+ m_context = null;
}
/**
@@ -266,7 +267,7 @@
for( Iterator iterator = m_components.iterator();
iterator.hasNext(); )
{
final Object component = iterator.next();
- setupObject( component, m_serviceManager, m_parameters );
+ setupObject( component, m_serviceManager, null );
}
}
@@ -294,8 +295,8 @@
private Object createService( final Class roleType, final String
defaultImpl )
throws Exception
{
- final String role = roleType.getName();
- final String className = m_parameters.getParameter( role,
defaultImpl );
+ // TODO - need to be able to provide different implementations
+ final String className = defaultImpl;
try
{
@@ -341,12 +342,17 @@
{
setupLogger( object );
+ if(object instanceof Contextualizable )
+ {
+ ( (Contextualizable)object ).contextualize( m_context );
+
+ }
if( object instanceof Serviceable )
{
( (Serviceable)object ).service( serviceManager );
}
- if( object instanceof Parameterizable )
+ if( parameters != null && object instanceof Parameterizable )
{
( (Parameterizable)object ).parameterize( parameters );
}
@@ -360,16 +366,20 @@
/**
* Deploys all type libraries in a directory.
*/
- private void deployFromDirectory( final Deployer deployer,
- final File directory,
- final FilenameFilter filter )
+ private void deployFromDirectories( final Deployer deployer,
+ final File[] directories,
+ final FilenameFilter filter )
throws DeploymentException
{
- final File[] files = directory.listFiles( filter );
-
- if( null != files )
+ for( int i = 0; i < directories.length; i++ )
{
- deployFiles( deployer, files );
+ File directory = directories[i ];
+ final File[] files = directory.listFiles( filter );
+
+ if( null != files )
+ {
+ deployFiles( deployer, files );
+ }
}
}
1.9 +9 -19
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/extensions/DefaultExtensionManager.java
Index: DefaultExtensionManager.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/extensions/DefaultExtensionManager.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultExtensionManager.java 3 Apr 2002 10:58:19 -0000 1.8
+++ DefaultExtensionManager.java 9 Apr 2002 07:21:12 -0000 1.9
@@ -13,25 +13,24 @@
import org.apache.avalon.excalibur.extension.OptionalPackage;
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.parameters.ParameterException;
-import org.apache.avalon.framework.parameters.Parameterizable;
-import org.apache.avalon.framework.parameters.Parameters;
import org.apache.myrmidon.interfaces.extensions.ExtensionManager;
/**
* PhoenixPackageRepository
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Revision: 1.8 $ $Date: 2002/04/03 10:58:19 $
+ * @version $Revision: 1.9 $ $Date: 2002/04/09 07:21:12 $
*/
public class DefaultExtensionManager
extends DefaultPackageRepository
- implements LogEnabled, Parameterizable, Initializable, Disposable,
ExtensionManager
+ implements LogEnabled, Contextualizable, Initializable, Disposable,
ExtensionManager
{
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultExtensionManager.class );
@@ -50,7 +49,7 @@
File.separator + "lib" + File.separator + "tools.jar";
private Logger m_logger;
- private String m_path;
+ private File[] m_path;
public DefaultExtensionManager()
{
@@ -67,24 +66,15 @@
m_logger = logger;
}
- public void parameterize( final Parameters parameters )
- throws ParameterException
+ public void contextualize( final Context context ) throws
ContextException
{
- m_path = parameters.getParameter( "myrmidon.ext.path" );
+ m_path = (File[])context.get( "myrmidon.ext.path" );
}
public void initialize()
throws Exception
{
- final String[] pathElements = StringUtil.split( m_path,
File.pathSeparator );
- final File[] dirs = new File[ pathElements.length ];
- for( int i = 0; i < dirs.length; i++ )
- {
- dirs[ i ] = new File( pathElements[ i ] );
- }
-
- setPath( dirs );
-
+ setPath( m_path );
scanPath();
// Add the JVM's tools.jar as an extension
1.5 +21 -4
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/service/InstantiatingServiceManager.java
Index: InstantiatingServiceManager.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/service/InstantiatingServiceManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- InstantiatingServiceManager.java 1 Apr 2002 09:56:26 -0000 1.4
+++ InstantiatingServiceManager.java 9 Apr 2002 07:21:12 -0000 1.5
@@ -23,6 +23,9 @@
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
import org.apache.myrmidon.interfaces.role.RoleInfo;
import org.apache.myrmidon.interfaces.role.RoleManager;
import org.apache.myrmidon.interfaces.service.ServiceFactory;
@@ -37,17 +40,20 @@
* and running the service instances through the service lifecycle:
* <ul>
* <li>log enable
+ * <li>contextualise
* <li>service
* <li>parameterise
* <li>initialise
+ * <li>use
+ * <li>dispose
* </ul>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
- * @version $Revision: 1.4 $ $Date: 2002/04/01 09:56:26 $
+ * @version $Revision: 1.5 $ $Date: 2002/04/09 07:21:12 $
*/
public class InstantiatingServiceManager
extends AbstractLogEnabled
- implements ServiceManager, Parameterizable, Serviceable, Disposable
+ implements ServiceManager, Contextualizable, Parameterizable,
Serviceable, Disposable
{
private static final Resources REZ =
ResourceManager.getPackageResources(
InstantiatingServiceManager.class );
@@ -64,8 +70,14 @@
private ServiceManager m_serviceManager;
private Parameters m_parameters;
private TypeManager m_typeManager;
+ private Context m_context;
- public void parameterize( Parameters parameters ) throws
ParameterException
+ public void contextualize( final Context context ) throws
ContextException
+ {
+ m_context = context;
+ }
+
+ public void parameterize( final Parameters parameters ) throws
ParameterException
{
m_parameters = parameters;
}
@@ -211,12 +223,17 @@
{
setupLogger( object );
+ if( m_context != null && object instanceof Contextualizable )
+ {
+ ( (Contextualizable)object ).contextualize( m_context );
+ }
+
if( object instanceof Serviceable )
{
( (Serviceable)object ).service( m_serviceManager );
}
- if( object instanceof Parameterizable )
+ if( m_parameters != null && object instanceof Parameterizable )
{
( (Parameterizable)object ).parameterize( m_parameters );
}
1.41 +23 -22
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java
Index: DefaultWorkspace.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- DefaultWorkspace.java 9 Apr 2002 02:26:35 -0000 1.40
+++ DefaultWorkspace.java 9 Apr 2002 07:21:12 -0000 1.41
@@ -12,11 +12,11 @@
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.parameters.ParameterException;
-import org.apache.avalon.framework.parameters.Parameterizable;
-import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.service.DefaultServiceManager;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.myrmidon.api.TaskContext;
@@ -40,11 +40,11 @@
* This is the default implementation of Workspace.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Revision: 1.40 $ $Date: 2002/04/09 02:26:35 $
+ * @version $Revision: 1.41 $ $Date: 2002/04/09 07:21:12 $
*/
public class DefaultWorkspace
extends AbstractLogEnabled
- implements Workspace, ExecutionContainer, Parameterizable
+ implements Workspace, ExecutionContainer, Contextualizable
{
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultWorkspace.class );
@@ -52,10 +52,10 @@
private Executor m_executor;
private ProjectListenerSupport m_listenerSupport = new
ProjectListenerSupport();
private ServiceManager m_serviceManager;
- private Parameters m_parameters;
private PropertyStore m_baseStore;
private TypeManager m_typeManager;
private Deployer m_deployer;
+ private Context m_context;
/** A map from Project object -> ProjectEntry for that project. */
private HashMap m_entries = new HashMap();
@@ -92,10 +92,9 @@
m_deployer = (Deployer)m_serviceManager.lookup( Deployer.ROLE );
}
- public void parameterize( final Parameters parameters )
- throws ParameterException
+ public void contextualize( final Context context ) throws
ContextException
{
- m_parameters = parameters;
+ m_context = context;
}
/**
@@ -127,21 +126,23 @@
//workspace specific)
final String name = libraryName.replace( '/', File.separatorChar ) +
".atl";
- final String home = m_parameters.getParameter( "myrmidon.home" );
- final File homeDir = new File( home + File.separatorChar + "ext" );
-
- final File library = new File( homeDir, name );
-
- if( library.exists() )
+ final File[] extPath = (File[])m_context.get( "myrmidon.antlib.path"
);
+ for( int i = 0; i < extPath.length; i++ )
{
- if( !library.canRead() )
- {
- final String message = REZ.getString( "no-read.error",
library );
- throw new TaskException( message );
- }
- else
+ final File extDir = extPath[ i ];
+ final File library = new File( extDir, name );
+
+ if( library.exists() )
{
- return library;
+ if( !library.canRead() )
+ {
+ final String message = REZ.getString( "no-read.error",
library );
+ throw new TaskException( message );
+ }
+ else
+ {
+ return library;
+ }
}
}
1.4 +9 -33
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/factories/ExecManagerFactory.java
Index: ExecManagerFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/factories/ExecManagerFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ExecManagerFactory.java 29 Mar 2002 12:56:04 -0000 1.3
+++ ExecManagerFactory.java 9 Apr 2002 07:21:12 -0000 1.4
@@ -8,13 +8,10 @@
package org.apache.myrmidon.framework.factories;
import java.io.File;
-import org.apache.aut.nativelib.ExecException;
import org.apache.aut.nativelib.impl.DefaultExecManager;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
-import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.framework.parameters.Parameterizable;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.parameters.ParameterException;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
import org.apache.myrmidon.interfaces.service.AntServiceException;
import org.apache.myrmidon.interfaces.service.ServiceFactory;
@@ -22,20 +19,16 @@
* A Factory responsible for creating the ExecManager service.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Revision: 1.3 $ $Date: 2002/03/29 12:56:04 $
+ * @version $Revision: 1.4 $ $Date: 2002/04/09 07:21:12 $
*/
public class ExecManagerFactory
- implements ServiceFactory, Parameterizable
+ implements ServiceFactory, Contextualizable
{
- private static final Resources REZ =
- ResourceManager.getPackageResources( ExecManagerFactory.class );
+ private File m_homeDir;
- private Parameters m_parameters;
-
- public void parameterize( final Parameters parameters )
- throws ParameterException
+ public void contextualize( final Context context ) throws
ContextException
{
- m_parameters = parameters;
+ m_homeDir = (File)context.get( "myrmidon.home" );
}
/**
@@ -46,28 +39,11 @@
{
try
{
- final File home = getHomeDirectory();
- return new DefaultExecManager( home );
+ return new DefaultExecManager( m_homeDir );
}
catch( final Exception ee )
{
throw new AntServiceException( ee.getMessage(), ee );
}
- }
-
- /**
- * Utility method to retrieve home directory.
- */
- private File getHomeDirectory()
- throws Exception
- {
- final String home = m_parameters.getParameter( "myrmidon.home" );
- if( null == home )
- {
- final String message = REZ.getString( "missing-home-dir.error" );
- throw new AntServiceException( message );
- }
-
- return new File( home );
}
}
1.39 +17 -9
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java
Index: CLIMain.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- CLIMain.java 7 Apr 2002 06:51:40 -0000 1.38
+++ CLIMain.java 9 Apr 2002 07:21:12 -0000 1.39
@@ -32,7 +32,7 @@
* to run project.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Revision: 1.38 $ $Date: 2002/04/07 06:51:40 $
+ * @version $Revision: 1.39 $ $Date: 2002/04/09 07:21:12 $
*/
public class CLIMain
{
@@ -51,18 +51,19 @@
private static final int VERSION_OPT = 1;
private static final int LISTENER_OPT = 2;
private static final int TASKLIB_DIR_OPT = 5;
- private static final int INCREMENTAL_OPT = 6;
- private static final int HOME_DIR_OPT = 7;
- private static final int DRY_RUN_OPT = 8;
- private static final int DEBUG_OPT = 9;
- private static final int TYPE_OPT = 10;
+ private static final int EXTLIB_DIR_OPT = 6;
+ private static final int INCREMENTAL_OPT = 7;
+ private static final int HOME_DIR_OPT = 8;
+ private static final int DRY_RUN_OPT = 9;
+ private static final int DEBUG_OPT = 10;
+ private static final int TYPE_OPT = 11;
//incompatable options for info options
private static final int[] INFO_OPT_INCOMPAT = new int[]
{
HELP_OPT, QUIET_OPT, VERBOSE_OPT, FILE_OPT,
LOG_LEVEL_OPT, BUILDER_PARAM_OPT, NO_PREFIX_OPT,
- VERSION_OPT, LISTENER_OPT, TASKLIB_DIR_OPT,
+ VERSION_OPT, LISTENER_OPT, TASKLIB_DIR_OPT, EXTLIB_DIR_OPT,
INCREMENTAL_OPT, HOME_DIR_OPT, DRY_RUN_OPT, TYPE_OPT
};
@@ -191,10 +192,14 @@
VERSION_OPT,
REZ.getString( "version.opt" ),
INFO_OPT_INCOMPAT ),
- new CLOptionDescriptor( "task-lib-dir",
+ new CLOptionDescriptor( "antlib-path",
CLOptionDescriptor.ARGUMENT_REQUIRED,
TASKLIB_DIR_OPT,
REZ.getString( "tasklib.opt" ) ),
+ new CLOptionDescriptor( "ext-path",
+ CLOptionDescriptor.ARGUMENT_REQUIRED,
+ EXTLIB_DIR_OPT,
+ REZ.getString( "extlib.opt" ) ),
new CLOptionDescriptor( "incremental",
CLOptionDescriptor.ARGUMENT_DISALLOWED,
INCREMENTAL_OPT,
@@ -257,7 +262,10 @@
m_embedded.setEmbeddorProperty( "myrmidon.home",
option.getArgument() );
break;
case TASKLIB_DIR_OPT:
- m_embedded.setEmbeddorProperty( "myrmidon.lib.path",
option.getArgument() );
+ m_embedded.setEmbeddorProperty( "myrmidon.antlib.path",
option.getArgument() );
+ break;
+ case EXTLIB_DIR_OPT:
+ m_embedded.setEmbeddorProperty( "myrmidon.ext.path",
option.getArgument() );
break;
case LOG_LEVEL_OPT:
1.9 +70 -32
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/EmbeddedAnt.java
Index: EmbeddedAnt.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/EmbeddedAnt.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- EmbeddedAnt.java 9 Apr 2002 02:26:35 -0000 1.8
+++ EmbeddedAnt.java 9 Apr 2002 07:21:12 -0000 1.9
@@ -14,11 +14,14 @@
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.excalibur.io.FileUtil;
+import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Startable;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.parameters.Parameterizable;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.interfaces.embeddor.Embeddor;
@@ -37,7 +40,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Revision: 1.8 $ $Date: 2002/04/09 02:26:35 $
+ * @version $Revision: 1.9 $ $Date: 2002/04/09 07:21:12 $
*/
public class EmbeddedAnt
extends AbstractLogEnabled
@@ -48,13 +51,14 @@
private static final String DEFAULT_EMBEDDOR_CLASS =
"org.apache.myrmidon.components.embeddor.DefaultEmbeddor";
+ private final ArrayList m_listeners = new ArrayList();
+ private final Parameters m_builderProps = new Parameters();
+ private final Map m_embeddorParameters = new HashMap();
+ private final Map m_workspaceProperties = new HashMap();
+
private String m_projectFile = "build.ant";
private Project m_project;
private String m_listenerName = "default";
- private ArrayList m_listeners = new ArrayList();
- private Parameters m_builderProps = new Parameters();
- private Parameters m_embeddorParameters = new Parameters();
- private Map m_workspaceProperties = new HashMap();
private ClassLoader m_sharedClassLoader;
private Embeddor m_embeddor;
private File m_homeDir;
@@ -63,8 +67,8 @@
/**
* Sets the Myrmidon home directory. Default is to use the current
* directory.
- *
- * @todo Autodetect myrmidon home, rather than using current directory
+ *
+ * @todo Autodetect myrmidon home, rather than using current directory
* as the default (which is a dud default).
*/
public void setHomeDirectory( final File homeDir )
@@ -144,8 +148,7 @@
*/
public void setEmbeddorProperty( final String name, final Object value )
{
- // TODO - Make properties Objects, not Strings
- m_embeddorParameters.setParameter( name, value.toString() );
+ m_embeddorParameters.put( name, value.toString() );
}
/**
@@ -163,15 +166,16 @@
*/
public void executeTargets( final String[] targets ) throws Exception
{
+ Map embeddorParameters = new HashMap( m_embeddorParameters );
+ setupPaths( embeddorParameters );
+
if( m_sharedClassLoader != null )
{
- Thread.currentThread().setContextClassLoader(
m_sharedClassLoader );
+ embeddorParameters.put( "myrmidon.shared.classloader",
m_sharedClassLoader );
}
- checkHomeDir();
-
// Prepare the embeddor, and project model
- final Embeddor embeddor = prepareEmbeddor();
+ final Embeddor embeddor = prepareEmbeddor( embeddorParameters );
final Project project = prepareProjectModel( embeddor );
// Create a new workspace
@@ -233,16 +237,16 @@
/**
* Make sure myrmidon home directory has been specified, and is a
- * directory.
+ * directory. Set the paths that the embeddor expects.
*/
- private void checkHomeDir() throws Exception
+ private void setupPaths( Map parameters ) throws Exception
{
if( m_homeDir == null )
{
m_homeDir = new File( "." ).getAbsoluteFile();
}
checkDirectory( m_homeDir, "home-dir.name" );
- m_embeddorParameters.setParameter( "myrmidon.home",
m_homeDir.getAbsolutePath() );
+ parameters.put( "myrmidon.home", m_homeDir );
if( getLogger().isInfoEnabled() )
{
@@ -250,28 +254,36 @@
getLogger().info( message );
}
- String path = m_embeddorParameters.getParameter(
"myrmidon.lib.path", "lib" );
- File dir = resolveDirectory( m_homeDir, path, "task-lib-dir.name" );
- m_embeddorParameters.setParameter( "myrmidon.lib.path",
dir.getAbsolutePath() );
-
- path = m_embeddorParameters.getParameter( "myrmidon.ext.path", "ext"
);
- dir = resolveDirectory( m_homeDir, path, "ext-dir.name" );
- m_embeddorParameters.setParameter( "myrmidon.ext.path",
dir.getAbsolutePath() );
+ // Build the lib path
+ String path = (String)parameters.get( "myrmidon.lib.path" );
+ File[] dirs = buildPath( m_homeDir, path, "lib", "lib-dir.name" );
+ parameters.put( "myrmidon.lib.path", dirs );
+
+ // Build the antlib search path
+ path = (String)parameters.get( "myrmidon.antlib.path" );
+ dirs = buildPath( m_homeDir, path, "ext", "task-lib-dir.name" );
+ parameters.put( "myrmidon.antlib.path", dirs );
+
+ // Build the extension search path
+ path = (String)parameters.get( "myrmidon.ext.path" );
+ dirs = buildPath( m_homeDir, path, "ext", "ext-dir.name" );
+ parameters.put( "myrmidon.ext.path", dirs );
}
/**
* Prepares and returns the embeddor to use.
*/
- private Embeddor prepareEmbeddor()
+ private Embeddor prepareEmbeddor( final Map parameters )
throws Exception
{
if( m_embeddor == null )
{
m_embeddor = createEmbeddor();
setupLogger( m_embeddor );
- if( m_embeddor instanceof Parameterizable )
+ if( m_embeddor instanceof Contextualizable )
{
- ( (Parameterizable)m_embeddor ).parameterize(
m_embeddorParameters );
+ final Context context = new DefaultContext( parameters );
+ ( (Contextualizable)m_embeddor ).contextualize( context );
}
if( m_embeddor instanceof Initializable )
{
@@ -310,7 +322,7 @@
final int count = m_listeners.size();
for( int i = 0; i < count; i++ )
{
- final ProjectListener listener =
(ProjectListener)m_listeners.get(i );
+ final ProjectListener listener =
(ProjectListener)m_listeners.get( i );
workspace.addProjectListener( listener );
}
}
@@ -352,12 +364,38 @@
/**
* Resolve a directory relative to another base directory.
*/
- private File resolveDirectory( final File baseDir, final String dir,
final String name )
+ private File[] buildPath( final File baseDir,
+ final String path,
+ final String defaultPath,
+ final String name )
throws Exception
{
- final File file = FileUtil.resolveFile( baseDir, dir );
- checkDirectory( file, name );
- return file;
+ // Build the canonical list of files
+ final ArrayList files = new ArrayList();
+
+ // Add the default path
+ files.add( FileUtil.resolveFile( baseDir, defaultPath ) );
+
+ // Add the additional path
+ if( path != null )
+ {
+ final String[] split = StringUtil.split( path,
File.pathSeparator );
+ for( int i = 0; i < split.length; i++ )
+ {
+ final String s = split[ i ];
+ final File file = new File( s ).getAbsoluteFile();
+ files.add( file );
+ }
+ }
+
+ // Check each one
+ for( int i = 0; i < files.size(); i++ )
+ {
+ File file = (File)files.get( i );
+ checkDirectory( file, name );
+ }
+
+ return (File[])files.toArray( new File[ files.size() ] );
}
/**
1.10 +5 -3
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/Resources.properties
Index: Resources.properties
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/Resources.properties,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Resources.properties 7 Apr 2002 06:51:40 -0000 1.9
+++ Resources.properties 9 Apr 2002 07:21:12 -0000 1.10
@@ -9,7 +9,8 @@
listener.opt=Specify the listener for log events.
noprefix.opt=Do not prefix output with the task name. Equivalent to
--listener noprefix.
version.opt=Display version.
-tasklib.opt=Specify the task lib directory to scan for .atl files.
+tasklib.opt=Specify the path to use to search for antlib libraries.
+extlib.opt=Specify the path to use to search for optional packages.
incremental.opt=Run in incremental mode.
home.opt=Specify Ant home directory.
define.opt=Define a property (ie -Dfoo=var).
@@ -29,5 +30,6 @@
homedir.notice=Ant Home Directory: {0}
buildfile.notice=Ant Build File: {0}
home-dir.name=Ant home directory
-task-lib-dir.name=Task library directory
-ext-dir.name=Extension library directory
+lib-dir.name=Library directory
+task-lib-dir.name=Antlib directory
+ext-dir.name=Extension directory
1.22 +21 -18
jakarta-ant/proposal/myrmidon/src/test/org/apache/myrmidon/components/AbstractComponentTest.java
Index: AbstractComponentTest.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/test/org/apache/myrmidon/components/AbstractComponentTest.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- AbstractComponentTest.java 3 Apr 2002 10:58:20 -0000 1.21
+++ AbstractComponentTest.java 9 Apr 2002 07:21:12 -0000 1.22
@@ -7,19 +7,22 @@
*/
package org.apache.myrmidon.components;
+import java.io.File;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.io.File;
+import java.util.Map;
import org.apache.aut.converter.Converter;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.DefaultServiceManager;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.parameters.Parameterizable;
-import org.apache.avalon.framework.activity.Initializable;
import org.apache.myrmidon.AbstractMyrmidonTest;
import org.apache.myrmidon.components.classloader.DefaultClassLoaderManager;
import org.apache.myrmidon.components.configurer.DefaultConfigurer;
@@ -124,26 +127,26 @@
}
}
- // Compose the components
+ // Contextualise the components
+ final Context context = new DefaultContext( getParameters() );
for( Iterator iterator = components.iterator();
iterator.hasNext(); )
{
Object obj = iterator.next();
- if( obj instanceof Serviceable )
+ if( obj instanceof Contextualizable )
{
- final Serviceable serviceable = (Serviceable)obj;
- serviceable.service( m_serviceManager );
+ final Contextualizable contextualizable =
(Contextualizable)obj;
+ contextualizable.contextualize( context );
}
}
- // Parameterise the components
- final Parameters parameters = getParameters();
+ // Compose the components
for( Iterator iterator = components.iterator();
iterator.hasNext(); )
{
Object obj = iterator.next();
- if( obj instanceof Parameterizable )
+ if( obj instanceof Serviceable )
{
- final Parameterizable parameterizable =
(Parameterizable)obj;
- parameterizable.parameterize( parameters );
+ final Serviceable serviceable = (Serviceable)obj;
+ serviceable.service( m_serviceManager );
}
}
@@ -173,12 +176,12 @@
* Creates the parameters for the test. Sub-classes can override this
* method to set-up the parameters.
*/
- protected Parameters getParameters()
+ protected Map getParameters()
{
- final Parameters parameters = new Parameters();
- final String homeDir = getInstallDirectory().getAbsolutePath();
- parameters.setParameter( "myrmidon.home", homeDir );
- parameters.setParameter( "myrmidon.ext.path", homeDir +
File.separatorChar + "ext" );
+ final Map parameters = new HashMap();
+ final File homeDir = getInstallDirectory();
+ parameters.put( "myrmidon.home", homeDir );
+ parameters.put( "myrmidon.ext.path", new File[] { new File (
homeDir, "ext" ) } );
return parameters;
}
1.3 +7 -7
jakarta-ant/proposal/myrmidon/src/test/org/apache/myrmidon/components/classloader/test/DefaultClassLoaderManagerTestCase.java
Index: DefaultClassLoaderManagerTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/test/org/apache/myrmidon/components/classloader/test/DefaultClassLoaderManagerTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultClassLoaderManagerTestCase.java 7 Apr 2002 02:27:58 -0000
1.2
+++ DefaultClassLoaderManagerTestCase.java 9 Apr 2002 07:21:12 -0000
1.3
@@ -11,18 +11,18 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Enumeration;
+import java.util.Map;
+import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.myrmidon.components.AbstractComponentTest;
import org.apache.myrmidon.components.classloader.DefaultClassLoaderManager;
-import org.apache.myrmidon.interfaces.classloader.ClassLoaderManager;
import org.apache.myrmidon.interfaces.classloader.ClassLoaderException;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.excalibur.i18n.Resources;
+import org.apache.myrmidon.interfaces.classloader.ClassLoaderManager;
/**
* Test cases for the DefaultClassLoaderManager.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
- * @version $Revision: 1.2 $ $Date: 2002/04/07 02:27:58 $
+ * @version $Revision: 1.3 $ $Date: 2002/04/09 07:21:12 $
*/
public class DefaultClassLoaderManagerTestCase
extends AbstractComponentTest
@@ -87,10 +87,10 @@
* Creates the parameters for the test. Sub-classes can override this
* method to set-up the parameters.
*/
- protected Parameters getParameters()
+ protected Map getParameters()
{
- final Parameters parameters = super.getParameters();
- parameters.setParameter( "myrmidon.ext.path", getTestDirectory(
"ext" ).getAbsolutePath() );
+ final Map parameters = super.getParameters();
+ parameters.put( "myrmidon.ext.path", new File[] { getTestDirectory(
"ext" ) } );
return parameters;
}
1.4 +5 -6
jakarta-ant/proposal/myrmidon/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java
Index: DefaultEmbeddorTest.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultEmbeddorTest.java 9 Apr 2002 02:26:34 -0000 1.3
+++ DefaultEmbeddorTest.java 9 Apr 2002 07:21:13 -0000 1.4
@@ -9,7 +9,7 @@
import java.io.File;
import java.util.HashMap;
-import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.logger.Logger;
import org.apache.myrmidon.AbstractProjectTest;
import org.apache.myrmidon.LogMessageTracker;
@@ -24,7 +24,7 @@
* Test cases for the default embeddor.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
- * @version $Revision: 1.3 $ $Date: 2002/04/09 02:26:34 $
+ * @version $Revision: 1.4 $ $Date: 2002/04/09 07:21:13 $
*/
public class DefaultEmbeddorTest
extends AbstractProjectTest
@@ -62,10 +62,9 @@
m_embeddor = new DefaultEmbeddor();
m_embeddor.enableLogging( logger );
- final Parameters params = new Parameters();
- final File instDir = getInstallDirectory();
- params.setParameter( "myrmidon.home", instDir.getAbsolutePath()
);
- m_embeddor.parameterize( params );
+ final DefaultContext context = new DefaultContext();
+ context.put( "myrmidon.home", getInstallDirectory() );
+ m_embeddor.contextualize( context );
m_embeddor.initialize();
m_embeddor.start();
}
1.2 +12 -5
jakarta-ant/proposal/myrmidon/src/test/org/apache/myrmidon/components/service/test/InstantiatingServiceManagerTestCase.java
Index: InstantiatingServiceManagerTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/test/org/apache/myrmidon/components/service/test/InstantiatingServiceManagerTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InstantiatingServiceManagerTestCase.java 17 Mar 2002 08:07:10 -0000
1.1
+++ InstantiatingServiceManagerTestCase.java 9 Apr 2002 07:21:13 -0000
1.2
@@ -7,10 +7,10 @@
*/
package org.apache.myrmidon.components.service.test;
-import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.context.DefaultContext;
import org.apache.myrmidon.components.AbstractComponentTest;
import org.apache.myrmidon.components.service.InstantiatingServiceManager;
import org.apache.myrmidon.interfaces.role.RoleInfo;
@@ -23,7 +23,7 @@
* Test cases for the default service manager.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
- * @version $Revision: 1.1 $ $Date: 2002/03/17 08:07:10 $
+ * @version $Revision: 1.2 $ $Date: 2002/04/09 07:21:13 $
*/
public class InstantiatingServiceManagerTestCase
extends AbstractComponentTest
@@ -31,7 +31,6 @@
private final static Resources REZ = getResourcesForTested(
InstantiatingServiceManagerTestCase.class );
private InstantiatingServiceManager m_serviceManager;
- private Parameters m_parameters = new Parameters();
public InstantiatingServiceManagerTestCase( final String name )
{
@@ -47,8 +46,9 @@
// Set-up the service manager
m_serviceManager = new InstantiatingServiceManager();
m_serviceManager.enableLogging( getLogger() );
+ m_serviceManager.contextualize( new DefaultContext() );
m_serviceManager.service( getServiceManager() );
- m_serviceManager.parameterize( m_parameters );
+ m_serviceManager.parameterize( new Parameters() );
}
/**
@@ -101,7 +101,14 @@
assertTrue( service.getClass() == TestServiceImpl2.class );
// Assert the service has been setup correctly
- service.doWork();
+ LifecycleValidator validate = (LifecycleValidator)service;
+ validate.assertSetup();
+
+ // Cleanup
+ m_serviceManager.dispose();
+
+ // Assert the service has been shutdown correctly
+ validate.assertDisposed();
}
/**
1.2 +28 -5
jakarta-ant/proposal/myrmidon/src/test/org/apache/myrmidon/components/service/test/LifecycleValidator.java
Index: LifecycleValidator.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/test/org/apache/myrmidon/components/service/test/LifecycleValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LifecycleValidator.java 17 Mar 2002 08:07:10 -0000 1.1
+++ LifecycleValidator.java 9 Apr 2002 07:21:13 -0000 1.2
@@ -9,6 +9,7 @@
import junit.framework.Assert;
import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.parameters.ParameterException;
@@ -17,16 +18,19 @@
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
/**
* A basic class that asserts that the object is correctly set-up.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
- * @version $Revision: 1.1 $ $Date: 2002/03/17 08:07:10 $
+ * @version $Revision: 1.2 $ $Date: 2002/04/09 07:21:13 $
*/
public class LifecycleValidator
extends Assert
- implements LogEnabled, Serviceable, Parameterizable, Initializable
+ implements LogEnabled, Contextualizable, Serviceable, Parameterizable,
Initializable, Disposable
{
private String m_state = STATE_NOT_INIT;
@@ -34,7 +38,9 @@
private final static String STATE_LOG_ENABLED = "log-enabled";
private final static String STATE_SERVICED = "serviced";
private final static String STATE_PARAMETERISED = "parameterised";
- protected final static String STATE_INITIALISED = "initialised";
+ private final static String STATE_INITIALISED = "initialised";
+ private final static String STATE_CONTEXTUALISED = "contextualised";
+ private final static String STATE_DISPOSED = "disposed";
public void enableLogging( final Logger logger )
{
@@ -42,13 +48,19 @@
m_state = STATE_LOG_ENABLED;
}
- public void service( final ServiceManager serviceManager ) throws
ServiceException
+ public void contextualize( final Context context ) throws
ContextException
{
assertEquals( STATE_LOG_ENABLED, m_state );
+ m_state = STATE_CONTEXTUALISED;
+ }
+
+ public void service( final ServiceManager serviceManager ) throws
ServiceException
+ {
+ assertEquals( STATE_CONTEXTUALISED, m_state );
m_state = STATE_SERVICED;
}
- public void parameterize( Parameters parameters ) throws
ParameterException
+ public void parameterize( final Parameters parameters ) throws
ParameterException
{
assertEquals( STATE_SERVICED, m_state );
m_state = STATE_PARAMETERISED;
@@ -60,8 +72,19 @@
m_state = STATE_INITIALISED;
}
+ public void dispose()
+ {
+ assertEquals( STATE_INITIALISED, m_state );
+ m_state = STATE_DISPOSED;
+ }
+
protected void assertSetup()
{
assertEquals( STATE_INITIALISED, m_state );
+ }
+
+ protected void assertDisposed()
+ {
+ assertEquals( STATE_DISPOSED, m_state );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>