livespace.osgi
Class Dependency

java.lang.Object
  extended by livespace.osgi.Dependency
Direct Known Subclasses:
Dependencies, ServiceDependency, SingleEntityDependency, SystemPropertyDependency

public abstract class Dependency
extends Object

Base for class representing dependency constraints.

Author:
Matthew Phillips

Field Summary
 Delegates notReadyListeners
          Delegates that are invoked when this dependency stops being ready.
 Delegates readyListeners
          Delegates that are invoked when this dependency becomes ready.
 
Constructor Summary
Dependency()
           
 
Method Summary
abstract  boolean isReady()
          True if the dependency is ready to be used.
protected  void setReady(boolean newValue)
          Force the ready state to change and fires an event if needed.
abstract  void start()
          Start the dependency looking for its required resources.
abstract  void stop()
          Stop the dependency looking for its required resources.
 void updateReady()
          Update the ready flag with the current value of isReady()
abstract  Object value()
          Convenience method to get the resource acquired by this dependency.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

readyListeners

public final Delegates readyListeners
Delegates that are invoked when this dependency becomes ready.


notReadyListeners

public final Delegates notReadyListeners
Delegates that are invoked when this dependency stops being ready.

Constructor Detail

Dependency

public Dependency()
Method Detail

updateReady

public void updateReady()
Update the ready flag with the current value of isReady()

See Also:
isReady(), setReady(boolean)

setReady

protected void setReady(boolean newValue)
Force the ready state to change and fires an event if needed. Clients should try to use updateReady() instead.


isReady

public abstract boolean isReady()
True if the dependency is ready to be used.


start

public abstract void start()
                    throws Exception
Start the dependency looking for its required resources. The ready state will change when it is (which may be immediately as part of this call).

Throws:
Exception

stop

public abstract void stop()
                   throws Exception
Stop the dependency looking for its required resources. The ready state may change, perhaps immediately as part of this call.

Throws:
Exception

value

public abstract Object value()
                      throws UnsupportedOperationException
Convenience method to get the resource acquired by this dependency. Null if dependency is not ready.

Throws:
UnsupportedOperationException - if this call is not supported.


Copyright © 2008 Commonwealth of Australia