mcconnell 2002/11/22 15:42:37
Modified: assembly/src/java/org/apache/excalibur/assembly/appliance
ApplianceManager.java DefaultApplianceManager.java
assembly/src/java/org/apache/excalibur/assembly/profile
DefaultProfileManager.java ProfileManager.java
assembly/src/java/org/apache/excalibur/assembly/service
DefaultServiceManager.java ServiceManager.java
assembly/src/java/org/apache/excalibur/assembly/type
DefaultTypeManager.java TypeManager.java
Log:
Updates to excalibur.assembly including change from inheritence to delegation
model and introduction of component model of all managers.
Revision Changes Path
1.2 +2 -2
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/appliance/ApplianceManager.java
Index: ApplianceManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/appliance/ApplianceManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ApplianceManager.java 19 Nov 2002 12:25:47 -0000 1.1
+++ ApplianceManager.java 22 Nov 2002 23:42:37 -0000 1.2
@@ -66,7 +66,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
-public interface ApplianceManager extends ProfileManager
+public interface ApplianceManager
{
/**
* Return the set of appliance istances capable of supporting the supplied
dependency.
1.2 +99 -12
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/appliance/DefaultApplianceManager.java
Index: DefaultApplianceManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/appliance/DefaultApplianceManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultApplianceManager.java 19 Nov 2002 12:27:48 -0000 1.1
+++ DefaultApplianceManager.java 22 Nov 2002 23:42:37 -0000 1.2
@@ -60,15 +60,17 @@
import java.util.Iterator;
import java.util.ArrayList;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
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.activity.Initializable;
import org.apache.excalibur.meta.info.Type;
import org.apache.excalibur.meta.model.Profile;
import org.apache.excalibur.assembly.appliance.builder.ApplianceBuilder;
-import org.apache.excalibur.assembly.profile.DefaultProfileManager;
+import org.apache.excalibur.assembly.profile.ProfileManager;
import org.apache.excalibur.meta.info.DependencyDescriptor;
import org.apache.excalibur.meta.info.StageDescriptor;
import org.apache.excalibur.meta.info.ReferenceDescriptor;
@@ -80,8 +82,8 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
-public final class DefaultApplianceManager extends DefaultProfileManager
- implements ApplianceManager
+public final class DefaultApplianceManager extends AbstractLogEnabled
+ implements ApplianceManager, Contextualizable, Initializable
{
//==================================================================
@@ -129,6 +131,16 @@
//==================================================================
/**
+ * Flag indicating if contextualization has been performed.
+ */
+ private boolean m_contextualized = false;
+
+ /**
+ * Flag indicating if initalization has been performed.
+ */
+ private boolean m_initialized = false;
+
+ /**
* The parent appliance manager.
*/
private ApplianceManager m_parent;
@@ -136,22 +148,97 @@
/**
* The classloader.
*/
- private ClassLoader m_loader;
+ private ClassLoader m_classloader;
/**
* Table of component profiles keyed by profile name.
*/
private final Map m_appliances = new Hashtable();
- //==================================================================
- // constructor
- //==================================================================
+ /**
+ * The profile manager.
+ */
+ private ProfileManager m_profiles;
+
+ //==============================================================
+ // Contextualizable
+ //==============================================================
- public DefaultApplianceManager( ApplianceManager parent, ClassLoader
classloader )
+ /**
+ * <p>Application of a runtime context to this component.
+ * Context entries that may be supplied to an appliance manager are detailed in
the
+ * following table.</p>
+ * <table>
+ * <tr>
+ * <td>key</td><td>type</td><td>default</td>
+ * </tr>
+ * <tr>
+ * <td>avalon:type.classloader</td>
+ * <td>java.lang.ClassLoader</td>
+ * <td>The context classloader will be used by default if not value is
supplied.</td>
+ * </tr>
+ * <tr>
+ * <td>assembly:parent</td>
+ * <td>{@link org.apache.excalibur.assembly.appliance.ApplianceManager}</td>
+ * <td>In no value suppled, this appliance manager will be considered as a
root manager.</td>
+ * </tr>
+ * <tr>
+ * <td>assembly:profiles</td>
+ * <td>{@link org.apache.excalibur.assembly.profile.ProfileManager}</td>
+ * <td>Required entry - the profile manager.</td>
+ * </tr>
+ * </table>
+ * @param context the runtime context
+ */
+ public void contextualize( Context context ) throws ContextException
{
- super( parent, classloader );
- m_parent = parent;
- m_loader = classloader;
+ m_profiles = (ProfileManager) context.get("assembly.profiles");
+
+ try
+ {
+ m_parent = (ApplianceManager) context.get( "assembly:parent" );
+ }
+ catch( ContextException e )
+ {
+ m_parent = null;
+ }
+
+ try
+ {
+ m_classloader = (ClassLoader) context.get( "assembly:classloader" );
+ }
+ catch( ContextException e )
+ {
+ m_classloader = Thread.currentThread().getContextClassLoader();
+ }
+
+ m_contextualized = true;
+ }
+
+ //==============================================================
+ // Initializable
+ //==============================================================
+
+ /**
+ * Initialization fo the component by the container. The implementation
+ * validates a logger has been assigned and that the context phase has
+ * been executed, following which it flags initialization as complete and
+ * marks the component as ready to serve requests.
+ *
+ * @exception Exception if the manager has not been suppied with a context
+ */
+ public void initialize() throws Exception
+ {
+ if( !m_contextualized )
+ {
+ throw new IllegalStateException("contextualize");
+ }
+ if( getLogger() == null )
+ {
+ throw new IllegalStateException("logger");
+ }
+
+ m_initialized = true;
}
//==================================================================
1.2 +90 -28
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/profile/DefaultProfileManager.java
Index: DefaultProfileManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/profile/DefaultProfileManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultProfileManager.java 19 Nov 2002 12:24:17 -0000 1.1
+++ DefaultProfileManager.java 22 Nov 2002 23:42:37 -0000 1.2
@@ -63,8 +63,12 @@
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
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.activity.Initializable;
import org.apache.excalibur.assembly.type.TypeException;
-import org.apache.excalibur.assembly.type.DefaultTypeManager;
+import org.apache.excalibur.assembly.type.TypeManager;
import org.apache.excalibur.assembly.type.UnknownTypeException;
import org.apache.excalibur.assembly.type.DuplicateTypeException;
import org.apache.excalibur.configuration.ConfigurationUtil;
@@ -84,7 +88,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
-public class DefaultProfileManager extends DefaultTypeManager implements
ProfileManager
+public class DefaultProfileManager extends AbstractLogEnabled implements
Contextualizable, Initializable
{
//==============================================================
// static
@@ -154,14 +158,29 @@
//==============================================================
/**
+ * Flag indicating if contextualization has been performed.
+ */
+ private boolean m_contextualized = false;
+
+ /**
+ * Flag indicating if initalization has been performed.
+ */
+ private boolean m_initialized = false;
+
+ /**
* The classloader supplied to the manager.
*/
- private final ClassLoader m_classloader;
+ private ClassLoader m_classloader;
/**
* The parent profile manager (may be null)
*/
- private final ProfileManager m_parent;
+ private ProfileManager m_parent;
+
+ /**
+ * The type manager (supplied via context).
+ */
+ private TypeManager m_types;
/**
* Table of component profiles keyed by profile name.
@@ -169,41 +188,84 @@
private final Map m_profiles = new Hashtable();
//==============================================================
- // constructor
+ // Contextualizable
//==============================================================
/**
- * Creation of a new {@link ProfileManager} based on a supplied parent
- * and classloader.
- * @param parent the parent profile manager (may be null)
- * @param classloader the classloader
+ * <p>Application of a runtime context to this component.
+ * Context entries that may be supplied to a type manager are detailed in the
+ * following table.</p>
+ * <table>
+ * <tr>
+ * <td>key</td><td>type</td><td>default</td>
+ * </tr>
+ * <tr>
+ * <td>avalon:type.classloader</td>
+ * <td>java.lang.ClassLoader</td>
+ * <td>The context classloader will be used by default if not value is
supplied.</td>
+ * </tr>
+ * <tr>
+ * <td>assembly:parent</td>
+ * <td>{@link org.apache.excalibur.assembly.type.TypeManager}</td>
+ * <td>In no value suppled, this type manager will be considered as a root
manager.</td>
+ * </tr>
+ * <tr>
+ * <td>assembly:services</td>
+ * <td>{@link org.apache.excalibur.assembly.service.ServiceManager}</td>
+ * <td>Required entry - the service manager.</td>
+ * </tr>
+ * </table>
+ * @param context the runtime context
*/
- public DefaultProfileManager( ProfileManager parent, ClassLoader classloader )
+ public void contextualize( Context context ) throws ContextException
{
- super( parent, classloader );
- m_parent = parent;
- m_classloader = classloader;
+ m_types = (TypeManager) context.get("assembly.types");
+
+ try
+ {
+ m_parent = (ProfileManager) context.get( "assembly:parent" );
+ }
+ catch( ContextException e )
+ {
+ m_parent = null;
+ }
+
+ try
+ {
+ m_classloader = (ClassLoader) context.get( "assembly:classloader" );
+ }
+ catch( ContextException e )
+ {
+ m_classloader = Thread.currentThread().getContextClassLoader();
+ }
+
+ m_contextualized = true;
}
- /**
- * Add a profile to the manager.
- * @param profile the component profile to add to the manager
- * @exception DuplicateProfileException if the profile of the same name is
- * already registered with the manager
- */
- public void addProfile( Profile profile ) throws DuplicateProfileException
+ //==============================================================
+ // Initializable
+ //==============================================================
+
+ /**
+ * Initialization fo the component by the container. The implementation
+ * validates a logger has been assigned and that the context phase has
+ * been executed, following which it flags initialization as complete and
+ * marks the component as ready to serve requests.
+ *
+ * @exception Exception if the manager has not been suppied with a context
+ */
+ public void initialize() throws Exception
{
- if( profile == null )
+ if( !m_contextualized )
{
- throw new NullPointerException( "profile" );
+ throw new IllegalStateException("contextualize");
}
-
- if( m_profiles.get( profile.getName() ) != null )
+ if( getLogger() == null )
{
- throw new DuplicateProfileException( profile.getName() );
+ throw new IllegalStateException("logger");
}
- m_profiles.put( profile.getName(), profile );
+ m_initialized = true;
}
//==============================================================
@@ -223,7 +285,7 @@
// check that the type is registered
//
- Type local = getType( type.getInfo().getClassname() );
+ Type local = m_types.getType( type.getInfo().getClassname() );
if( !type.equals( type ) )
{
final String error = "Supplied type is not equal to the type known by
the manager.";
1.3 +2 -2
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/profile/ProfileManager.java
Index: ProfileManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/profile/ProfileManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProfileManager.java 19 Nov 2002 12:24:17 -0000 1.2
+++ ProfileManager.java 22 Nov 2002 23:42:37 -0000 1.3
@@ -71,7 +71,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
-public interface ProfileManager extends TypeManager
+public interface ProfileManager
{
/**
1.3 +90 -17
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/service/DefaultServiceManager.java
Index: DefaultServiceManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/service/DefaultServiceManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultServiceManager.java 19 Nov 2002 12:22:03 -0000 1.2
+++ DefaultServiceManager.java 22 Nov 2002 23:42:37 -0000 1.3
@@ -64,6 +64,10 @@
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
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.activity.Initializable;
import org.apache.excalibur.meta.info.Service;
import org.apache.excalibur.meta.info.builder.ServiceBuilder;
import org.apache.excalibur.meta.info.builder.ServiceCreator;
@@ -80,21 +84,31 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
-public class DefaultServiceManager extends AbstractLogEnabled implements
ServiceManager
+public class DefaultServiceManager extends AbstractLogEnabled implements
ServiceManager, Contextualizable, Initializable
{
//==============================================================
// state
//==============================================================
/**
+ * Flag indicating if contextualization has been performed.
+ */
+ private boolean m_contextualized = false;
+
+ /**
+ * Flag indicating if initalization has been performed.
+ */
+ private boolean m_initialized = false;
+
+ /**
* The classloader supplied to the manager.
*/
- private final ClassLoader m_classloader;
+ private ClassLoader m_classloader;
/**
* The parent service manager (may be null)
*/
- private final ServiceManager m_parent;
+ private ServiceManager m_parent;
/**
* The service builder.
@@ -107,23 +121,82 @@
private Hashtable m_services = new Hashtable();
//==============================================================
- // constructor
+ // Contextualizable
+ //==============================================================
+
+ /**
+ * <p>Application of a runtime context to this component.
+ * Context entries that may be supplied to a type manager are detailed in the
+ * following table.</p>
+ * <table>
+ * <tr>
+ * <td>key</td><td>type</td><td>default</td>
+ * </tr>
+ * <tr>
+ * <td>avalon:type.classloader</td>
+ * <td>java.lang.ClassLoader</td>
+ * <td>The context classloader will be used by default if not value is
supplied.</td>
+ * </tr>
+ * <tr>
+ * <td>assembly:parent</td>
+ * <td>org.apache.excalibur.assembly.service.ServiceManager</td>
+ * <td>In no value suppled, this service manager will be considered as a
root manager.</td>
+ * </tr>
+ * </table>
+ * @param context the runtime context
+ */
+ public void contextualize( Context context )
+ {
+ if( context == null )
+ {
+ throw new NullPointerException("context");
+ }
+
+ try
+ {
+ m_parent = (ServiceManager) context.get( "assembly:parent" );
+ }
+ catch( ContextException e )
+ {
+ m_parent = null;
+ }
+
+ try
+ {
+ m_classloader = (ClassLoader) context.get( "assembly:classloader" );
+ }
+ catch( ContextException e )
+ {
+ m_classloader = Thread.currentThread().getContextClassLoader();
+ }
+
+ m_contextualized = true;
+ }
+
+ //==============================================================
+ // Initializable
//==============================================================
/**
- * Creation of a new {@link ServiceManager} based on a supplied parent
- * and classloader.
- * @param parent the parent service manager (may be null)
- * @param classloader the classloader
+ * Initialization fo the component by the container. The implementation
+ * validates a logger has been assigned and that the context phase has
+ * been executed, following which it flags initialization as complete and
+ * marks the component as ready to serve requests.
+ *
+ * @exception Exception if the manager has not been suppied with a context
*/
- public DefaultServiceManager( ServiceManager parent, ClassLoader classloader )
+ public void initialize() throws Exception
{
- if( classloader == null )
+ if( !m_contextualized )
{
- throw new NullPointerException("classloader");
+ throw new IllegalStateException("contextualize");
}
- m_parent = parent;
- m_classloader = classloader;
+ if( getLogger() == null )
+ {
+ throw new IllegalStateException("logger");
+ }
+
+ m_initialized = true;
}
//==============================================================
@@ -225,12 +298,12 @@
}
/**
- * Install the set of services associated with the supplied path.
+ * Add a services associated with the supplied path.
*
* @param path the service class name
- * @return the set of service defintions
+ * @return the service defintions
*/
- public Service installService( String path ) throws ServiceException
+ public Service addService( String path ) throws ServiceException
{
final String classname = path.replace( '/', '.' );
1.2 +2 -2
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/service/ServiceManager.java
Index: ServiceManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/service/ServiceManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceManager.java 19 Nov 2002 03:14:09 -0000 1.1
+++ ServiceManager.java 22 Nov 2002 23:42:37 -0000 1.2
@@ -60,7 +60,7 @@
import org.apache.excalibur.meta.info.Service;
/**
- * A type manager implemetation provides support for the creation,
+ * A service manager implementation provides support for the creation,
* storage and retrival of service defintions.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
1.5 +124 -21
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/type/DefaultTypeManager.java
Index: DefaultTypeManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/type/DefaultTypeManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultTypeManager.java 19 Nov 2002 12:21:18 -0000 1.4
+++ DefaultTypeManager.java 22 Nov 2002 23:42:37 -0000 1.5
@@ -58,11 +58,16 @@
import java.util.Map;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.Enumeration;
import java.util.ArrayList;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
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.activity.Initializable;
import org.apache.excalibur.meta.info.Type;
import org.apache.excalibur.meta.info.builder.TypeBuilder;
import org.apache.excalibur.meta.info.builder.TypeCreator;
@@ -71,7 +76,7 @@
import org.apache.excalibur.meta.info.ServiceDescriptor;
import org.apache.excalibur.meta.info.StageDescriptor;
import org.apache.excalibur.meta.verifier.ComponentVerifier;
-import org.apache.excalibur.assembly.service.DefaultServiceManager;
+import org.apache.excalibur.assembly.service.ServiceManager;
/**
* A type manager implemetation provides support for the creation,
@@ -80,7 +85,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
-public class DefaultTypeManager extends DefaultServiceManager implements TypeManager
+public class DefaultTypeManager extends AbstractLogEnabled implements TypeManager,
Contextualizable, Initializable
{
//==============================================================
// static
@@ -141,7 +146,7 @@
{
final String error =
"Unexpected error while attempting to build a type from the
classname: " + classname;
- throw new TypeException( error, e );
+ throw new TypeException( error, e );
}
}
@@ -150,14 +155,29 @@
//==============================================================
/**
+ * Flag indicating if contextualization has been performed.
+ */
+ private boolean m_contextualized = false;
+
+ /**
+ * Flag indicating if initalization has been performed.
+ */
+ private boolean m_initialized = false;
+
+ /**
* The classloader supplied to the manager.
*/
- private final ClassLoader m_classloader;
+ private ClassLoader m_classloader;
/**
* The parent type manager (may be null)
*/
- private final TypeManager m_parent;
+ private TypeManager m_parent;
+
+ /**
+ * The parent type manager (may be null)
+ */
+ private ServiceManager m_services;
/**
* Table of component types keyed by implementation classname.
@@ -165,24 +185,84 @@
private final Hashtable m_types = new Hashtable();
//==============================================================
- // constructor
+ // Contextualizable
//==============================================================
/**
- * Creation of a new {@link TypeManager} based on a supplied parent
- * and classloader.
- * @param parent the parent type manager (may be null)
- * @param classloader the classloader
+ * <p>Application of a runtime context to this component.
+ * Context entries that may be supplied to a type manager are detailed in the
+ * following table.</p>
+ * <table>
+ * <tr>
+ * <td>key</td><td>type</td><td>default</td>
+ * </tr>
+ * <tr>
+ * <td>avalon:type.classloader</td>
+ * <td>java.lang.ClassLoader</td>
+ * <td>The context classloader will be used by default if not value is
supplied.</td>
+ * </tr>
+ * <tr>
+ * <td>assembly:parent</td>
+ * <td>{@link org.apache.excalibur.assembly.type.TypeManager}</td>
+ * <td>In no value suppled, this type manager will be considered as a root
manager.</td>
+ * </tr>
+ * <tr>
+ * <td>assembly:services</td>
+ * <td>{@link org.apache.excalibur.assembly.service.ServiceManager}</td>
+ * <td>Required entry - the service manager.</td>
+ * </tr>
+ * </table>
+ * @param context the runtime context
*/
- public DefaultTypeManager( TypeManager parent, ClassLoader classloader )
+ public void contextualize( Context context ) throws ContextException
{
- super( parent, classloader );
- if( classloader == null )
+ m_services = (ServiceManager) context.get("assembly:services");
+
+ try
{
- throw new NullPointerException("classloader");
+ m_parent = (TypeManager) context.get( "assembly:parent" );
}
- m_parent = parent;
- m_classloader = classloader;
+ catch( ContextException e )
+ {
+ m_parent = null;
+ }
+
+ try
+ {
+ m_classloader = (ClassLoader) context.get( "assembly:classloader" );
+ }
+ catch( ContextException e )
+ {
+ m_classloader = Thread.currentThread().getContextClassLoader();
+ }
+
+ m_contextualized = true;
+ }
+
+ //==============================================================
+ // Initializable
+ //==============================================================
+
+ /**
+ * Initialization fo the component by the container. The implementation
+ * validates a logger has been assigned and that the context phase has
+ * been executed, following which it flags initialization as complete and
+ * marks the component as ready to serve requests.
+ *
+ * @exception Exception if the manager has not been suppied with a context
+ */
+ public void initialize() throws Exception
+ {
+ if( !m_contextualized )
+ {
+ throw new IllegalStateException("contextualize");
+ }
+ if( getLogger() == null )
+ {
+ throw new IllegalStateException("logger");
+ }
+
+ m_initialized = true;
}
//==============================================================
@@ -202,7 +282,13 @@
throw new NullPointerException("type");
}
+ if( !m_initialized )
+ {
+ throw new IllegalStateException("initialization");
+ }
+
final String classname = type.getInfo().getClassname();
+
try
{
type = getType( classname );
@@ -243,6 +329,11 @@
{
throw new NullPointerException("clazz");
}
+ if( !m_initialized )
+ {
+ throw new IllegalStateException("initialization");
+ }
+
return getType( clazz.getName() );
}
@@ -258,6 +349,11 @@
{
throw new NullPointerException("classname");
}
+ if( !m_initialized )
+ {
+ throw new IllegalStateException("initialization");
+ }
+
Type type = (Type) m_types.get( classname );
if( type == null )
@@ -286,6 +382,10 @@
{
throw new NullPointerException("dependency");
}
+ if( !m_initialized )
+ {
+ throw new IllegalStateException("initialization");
+ }
ArrayList list = new ArrayList();
if( m_parent != null )
@@ -298,17 +398,16 @@
}
ReferenceDescriptor reference = dependency.getReference();
- Iterator iterator = m_types.entrySet().iterator();
- while( iterator.hasNext() )
+ Enumeration enum = m_types.elements();
+ while( enum.hasMoreElements() )
{
- Type type = (Type) iterator.next();
+ Type type = (Type) enum.nextElement();
Object service = type.getService( reference );
if( service != null )
{
list.add( type );
}
}
-
return (Type[]) list.toArray( new Type[0] );
}
@@ -322,6 +421,10 @@
if( stage == null )
{
throw new NullPointerException("stage");
+ }
+ if( !m_initialized )
+ {
+ throw new IllegalStateException("initialization");
}
ArrayList list = new ArrayList();
1.4 +2 -2
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/type/TypeManager.java
Index: TypeManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/assembly/type/TypeManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TypeManager.java 19 Nov 2002 12:21:18 -0000 1.3
+++ TypeManager.java 22 Nov 2002 23:42:37 -0000 1.4
@@ -69,7 +69,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
-public interface TypeManager extends ServiceManager
+public interface TypeManager
{
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>