View Javadoc

1   /**
2    *
3    * Copyright 2003-2004 The Apache Software Foundation
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   */
17  
18  package org.apache.geronimo.kernel;
19  
20  import org.apache.geronimo.gbean.AbstractName;
21  
22  import java.util.Set;
23  
24  /**
25   * DependencyManager is the record keeper of the dependencies in Geronimo.  The DependencyManager
26   * does not enforce any dependencies, it is simply a place where components can register their intent
27   * to be dependent on another component.
28   * <p/>
29   * The DependencyManager uses the nomenclature of parent-child where a child is dependent on a parent.
30   * The names parent and child have no other meaning are just a convience to make the code readable.
31   *
32   * @version $Rev: 384141 $ $Date: 2006-03-07 23:30:08 -0800 (Tue, 07 Mar 2006) $
33   */
34  public interface DependencyManager {
35      /**
36       * Closes the dependency manager releasing all resources
37       */
38      public void close();
39  
40      /**
41       * Declares a dependency from a child to a parent.
42       *
43       * @param child the dependent component
44       * @param parent the component the child is depending on
45       */
46      public void addDependency(AbstractName child, AbstractName parent);
47  
48      /**
49       * Removes a dependency from a child to a parent
50       *
51       * @param child the dependnet component
52       * @param parent the component that the child wil no longer depend on
53       */
54      public void removeDependency(AbstractName child, AbstractName parent);
55  
56      /**
57       * Removes all dependencies for a child
58       *
59       * @param child the component that will no longer depend on anything
60       */
61      public void removeAllDependencies(AbstractName child);
62  
63      /**
64       * Adds dependencies from the child to every parent in the parents set
65       *
66       * @param child the dependent component
67       * @param parents the set of components the child is depending on
68       */
69      public void addDependencies(AbstractName child, Set parents);
70  
71      /**
72       * Gets the set of parents that the child is depending on
73       *
74       * @param child the dependent component
75       * @return a collection containing all of the components the child depends on; will never be null
76       */
77      public Set getParents(AbstractName child);
78  
79      /**
80       * Gets all of the MBeans that have a dependency on the specified startParent.
81       *
82       * @param parent the component the returned childen set depend on
83       * @return a collection containing all of the components that depend on the parent; will never be null
84       */
85      public Set getChildren(AbstractName parent);
86  
87  }