donaldp 2002/08/19 05:39:38
Modified: containerkit/src/java/org/apache/excalibur/containerkit/store
ComponentStore.java
Log:
Upgrade store to handle notion of child and parent stores.
Revision Changes Path
1.2 +72 -3
jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/store/ComponentStore.java
Index: ComponentStore.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/store/ComponentStore.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ComponentStore.java 19 Aug 2002 12:12:35 -0000 1.1
+++ ComponentStore.java 19 Aug 2002 12:39:38 -0000 1.2
@@ -7,10 +7,11 @@
*/
package org.apache.excalibur.containerkit.store;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-import java.util.Collection;
-import java.util.ArrayList;
import org.apache.excalibur.containerkit.kernel.ComponentEntry;
/**
@@ -22,10 +23,78 @@
public class ComponentStore
{
/**
+ * Parent {@link ComponentStore}. Components in parent
+ * {@link ComponentStore} are potential Providers for services
+ * if no component in current {@link ComponentStore} satisfies
+ * dependency.
+ */
+ private final ComponentStore m_parent;
+ /**
+ * The child {@link ComponentStore} objects.
+ * Possible consumers of services in this assembly.
+ */
+ private final ArrayList m_children = new ArrayList();
+ /**
* The set of components in assembly.
* Used when searching for providers/consumers.
*/
private final Map m_components = new HashMap();
+
+ /**
+ * Create a root ComponentStore without any parent
+ * ComponentStore.
+ */
+ public ComponentStore()
+ {
+ this( null );
+ }
+
+ /**
+ * Return the parent ComponentStore (may be null).
+ */
+ public ComponentStore getParent()
+ {
+ return m_parent;
+ }
+
+ /**
+ * Create a root ComponentStore with specified parent
+ * ComponentStore.
+ */
+ public ComponentStore( final ComponentStore parent )
+ {
+ m_parent = parent;
+ }
+
+ /**
+ * Add child {@link ComponentStore}.
+ *
+ * @param child the child {@link ComponentStore}.
+ */
+ public void addChildStore( final ComponentStore child )
+ {
+ m_children.add( child );
+ }
+
+ /**
+ * Return the list of child {@link ComponentStore}s.
+ *
+ * @return the list of child {@link ComponentStore}s.
+ */
+ public List getChildStores()
+ {
+ return m_children;
+ }
+
+ /**
+ * Remove child {@link ComponentStore}.
+ *
+ * @param child the child {@link ComponentStore}.
+ */
+ public void removeChildStore( final ComponentStore child )
+ {
+ m_children.remove( child );
+ }
/**
* Add a component to store.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>