org.apache.geronimo.kernel
Class DependencyManager

java.lang.Object
  extended byorg.apache.geronimo.kernel.DependencyManager
All Implemented Interfaces:
EventListener, javax.management.NotificationListener

public class DependencyManager
extends Object
implements javax.management.NotificationListener

DependencyManager is the record keeper of the dependencies in Geronimo. The DependencyManager does not enforce any dependencies, it is simply a place where components can register their intent to be dependent on another component. Since a JMX Component can pretty much do whatever it wants a component must watch the components it depends on to assure that they are following the J2EE-Management state machine.

The DependencyManager uses the nomenclature of parent-child where a child is dependent on a parent. The names parent and child have no other meaning are just a convience to make the code readable.

Version:
$Revision: 1.1 $ $Date: 2004/06/05 20:33:40 $

Constructor Summary
DependencyManager(javax.management.MBeanServer mbeanServer)
           
 
Method Summary
 void addDependencies(javax.management.ObjectName child, Set parents)
          Adds dependencies from the child to every parent in the parents set
 void addDependency(javax.management.ObjectName child, javax.management.ObjectName parent)
          Declares a dependency from a child to a parent.
 void addStartHolds(javax.management.ObjectName objectName, Collection holds)
          Adds a hold on a collection of object name patterns.
 javax.management.ObjectName checkBlocker(javax.management.ObjectName objectName)
          Gets the object name of the mbean blocking the start specified mbean.
 void close()
           
 Set getChildren(javax.management.ObjectName parent)
          Gets all of the MBeans that have a dependency on the specified startParent.
 Set getParents(javax.management.ObjectName child)
          Gets the set of parents that the child is depending on
 void handleNotification(javax.management.Notification n, Object handback)
           
 void removeAllDependencies(javax.management.ObjectName child)
          Removes all dependencies for a child
 void removeAllStartHolds(javax.management.ObjectName objectName)
          Removes all of the holds owned by a component.
 void removeDependency(javax.management.ObjectName child, javax.management.ObjectName parent)
          Removes a dependency from a child to a parent
 void removeStartHolds(javax.management.ObjectName objectName, Collection holds)
          Removes a collection of holds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DependencyManager

public DependencyManager(javax.management.MBeanServer mbeanServer)
                  throws Exception
Method Detail

close

public void close()

addDependency

public void addDependency(javax.management.ObjectName child,
                          javax.management.ObjectName parent)
Declares a dependency from a child to a parent.

Parameters:
child - the dependent component
parent - the component the child is depending on

removeDependency

public void removeDependency(javax.management.ObjectName child,
                             javax.management.ObjectName parent)
Removes a dependency from a child to a parent

Parameters:
child - the dependnet component
parent - the component that the child wil no longer depend on

removeAllDependencies

public void removeAllDependencies(javax.management.ObjectName child)
Removes all dependencies for a child

Parameters:
child - the component that will no longer depend on anything

addDependencies

public void addDependencies(javax.management.ObjectName child,
                            Set parents)
Adds dependencies from the child to every parent in the parents set

Parameters:
child - the dependent component
parents - the set of components the child is depending on

getParents

public Set getParents(javax.management.ObjectName child)
Gets the set of parents that the child is depending on

Parameters:
child - the dependent component
Returns:
a collection containing all of the components the child depends on; will never be null

getChildren

public Set getChildren(javax.management.ObjectName parent)
Gets all of the MBeans that have a dependency on the specified startParent.

Parameters:
parent - the component the returned childen set depend on
Returns:
a collection containing all of the components that depend on the parent; will never be null

addStartHolds

public void addStartHolds(javax.management.ObjectName objectName,
                          Collection holds)
Adds a hold on a collection of object name patterns. If the name of a component matches an object name pattern in the collection, the component should not start.

Parameters:
objectName - the name of the component placing the holds
holds - a collection of object name patterns which should not start

removeStartHolds

public void removeStartHolds(javax.management.ObjectName objectName,
                             Collection holds)
Removes a collection of holds.

Parameters:
objectName - the object name of the components owning the holds
holds - a collection of the holds to remove

removeAllStartHolds

public void removeAllStartHolds(javax.management.ObjectName objectName)
Removes all of the holds owned by a component.

Parameters:
objectName - the object name of the component that will no longer have any holds

checkBlocker

public javax.management.ObjectName checkBlocker(javax.management.ObjectName objectName)
Gets the object name of the mbean blocking the start specified mbean.

Parameters:
objectName - the mbean to check for blockers
Returns:
the mbean blocking the specified mbean, or null if there are no blockers

handleNotification

public void handleNotification(javax.management.Notification n,
                               Object handback)
Specified by:
handleNotification in interface javax.management.NotificationListener


Copyright © 2003-2005 Apache Software Foundation. All Rights Reserved.