001    /**
002     *
003     * Copyright 2003-2004 The Apache Software Foundation
004     *
005     *  Licensed under the Apache License, Version 2.0 (the "License");
006     *  you may not use this file except in compliance with the License.
007     *  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    
018    package org.apache.geronimo.kernel;
019    
020    import org.apache.geronimo.gbean.AbstractName;
021    
022    import java.util.Set;
023    
024    /**
025     * DependencyManager is the record keeper of the dependencies in Geronimo.  The DependencyManager
026     * does not enforce any dependencies, it is simply a place where components can register their intent
027     * to be dependent on another component.
028     * <p/>
029     * The DependencyManager uses the nomenclature of parent-child where a child is dependent on a parent.
030     * The names parent and child have no other meaning are just a convience to make the code readable.
031     *
032     * @version $Rev: 384141 $ $Date: 2006-03-07 23:30:08 -0800 (Tue, 07 Mar 2006) $
033     */
034    public interface DependencyManager {
035        /**
036         * Closes the dependency manager releasing all resources
037         */
038        public void close();
039    
040        /**
041         * Declares a dependency from a child to a parent.
042         *
043         * @param child the dependent component
044         * @param parent the component the child is depending on
045         */
046        public void addDependency(AbstractName child, AbstractName parent);
047    
048        /**
049         * Removes a dependency from a child to a parent
050         *
051         * @param child the dependnet component
052         * @param parent the component that the child wil no longer depend on
053         */
054        public void removeDependency(AbstractName child, AbstractName parent);
055    
056        /**
057         * Removes all dependencies for a child
058         *
059         * @param child the component that will no longer depend on anything
060         */
061        public void removeAllDependencies(AbstractName child);
062    
063        /**
064         * Adds dependencies from the child to every parent in the parents set
065         *
066         * @param child the dependent component
067         * @param parents the set of components the child is depending on
068         */
069        public void addDependencies(AbstractName child, Set parents);
070    
071        /**
072         * Gets the set of parents that the child is depending on
073         *
074         * @param child the dependent component
075         * @return a collection containing all of the components the child depends on; will never be null
076         */
077        public Set getParents(AbstractName child);
078    
079        /**
080         * Gets all of the MBeans that have a dependency on the specified startParent.
081         *
082         * @param parent the component the returned childen set depend on
083         * @return a collection containing all of the components that depend on the parent; will never be null
084         */
085        public Set getChildren(AbstractName parent);
086    
087    }