mcconnell 2002/07/07 16:20:45
Modified: assembly/src/java/org/apache/excalibur/merlin/kernel
DefaultContainer.java
Log:
general improvements and rationalization of consumer/provider relationship tracking
Revision Changes Path
1.8 +24 -23
jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultContainer.java
Index: DefaultContainer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultContainer.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DefaultContainer.java 7 Jul 2002 04:28:31 -0000 1.7
+++ DefaultContainer.java 7 Jul 2002 23:20:45 -0000 1.8
@@ -62,22 +62,24 @@
import org.apache.excalibur.meta.info.ServiceDesignator;
import org.apache.excalibur.meta.data.Profile;
import org.apache.excalibur.meta.verifier.VerifyException;
+import org.apache.excalibur.merlin.registry.Registry;
import org.apache.log.Hierarchy;
import org.apache.log.Priority;
import org.apache.log.output.io.StreamTarget;
-import org.apache.excalibur.merlin.registry.DefaultRegistry;
import org.apache.excalibur.merlin.registry.UnresolvedProviderException;
import org.apache.excalibur.merlin.kernel.Map;
/**
* Default container implementation that manages a registry of componet providers
and
* a registry of child containers.
+ * <p><b>UML</b></p>
+ * <p><image src="doc-files/DefaultContainer.gif" border="0"/></p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
-public class DefaultContainer extends DefaultRegistry implements Container
+public class DefaultContainer extends Registry implements Container
{
//=======================================================================
// state
@@ -114,16 +116,21 @@
*/
public void contextualize( Context context ) throws ContextException
{
- super.contextualize( context );
m_classloader = (ContainerClassLoader) context.get( CLASSLOADER_KEY );
- m_map = (Map) context.get( MAP_KEY );
try
{
m_parent = (Container) context.get( CONTAINER_KEY );
+ m_map = (Map) context.get( MAP_KEY );
+ super.contextualize( context );
}
catch( ContextException e )
{
// root container
+ DefaultContext c = new DefaultContext( context );
+ m_map = new Map();
+ c.put( MAP_KEY, m_map );
+ c.makeReadOnly();
+ super.contextualize( c );
}
}
@@ -181,23 +188,6 @@
}
}
- //=======================================================================
- // Container
- //=======================================================================
-
- /**
- * Return the profile of an installed component matching a dependency.
- * @param dependency a consumer component dependency declaration
- * @return the supplier profile
- * @exception UnresolvedProviderException if no provider available
- */
- //public Profile getProvider( DependencyDescriptor dependency )
- // throws UnresolvedProviderException
- //{
- // throw new UnresolvedProviderException( "not implemented", dependency );
- //}
-
-
//======================================================================
// Manageable
//======================================================================
@@ -236,6 +226,15 @@
}
//=======================================================================
+ // DefaultContainer
+ //=======================================================================
+
+ public Container[] getContainers()
+ {
+ return (Container[]) m_containers.toArray( new Container[0] );
+ }
+
+ //=======================================================================
// private
//=======================================================================
@@ -253,7 +252,9 @@
DefaultContext context = new DefaultContext();
context.put( CLASSLOADER_KEY, loader );
context.put( CONTAINER_KEY, this );
- context.put( MAP_KEY, new Map( m_map ) );
+ Map map = new Map( m_map );
+ m_map.addChild( map );
+ context.put( MAP_KEY, map );
DefaultContainer container = new DefaultContainer();
container.enableLogging( logger );
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>