livespace.services.osgi
Class SingleEntityDependency

java.lang.Object
  extended by livespace.osgi.Dependency
      extended by livespace.services.osgi.SingleEntityDependency
All Implemented Interfaces:
PropertyListener, EventListener
Direct Known Subclasses:
ParticularEntityDependency

public class SingleEntityDependency
extends Dependency
implements PropertyListener

A dependency on a single Livespace entity being available.

Author:
Matthew Phillips

Field Summary
protected  EntityClient client
           
protected  Dependencies dependencies
           
protected  String entityType
           
 
Fields inherited from class livespace.osgi.Dependency
notReadyListeners, readyListeners
 
Constructor Summary
SingleEntityDependency(org.osgi.framework.BundleContext context, String entityType)
          Create a new dependency on an entity of a given type being available in the local room.
 
Method Summary
protected  void elvinOrRoomNotReady()
          If either the elvin or room service is not available then dispose the client and call Dependency.updateReady()
 boolean isReady()
          True if the dependency is ready to be used.
 void propertyValueChanged(PropertyEvent e)
           
 void start()
          Start the dependency looking for its required resources.
 void stop()
          Stop the dependency looking for its required resources.
 Object value()
          Convenience method to get the resource acquired by this dependency.
 
Methods inherited from class livespace.osgi.Dependency
setReady, updateReady
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entityType

protected String entityType

client

protected EntityClient client

dependencies

protected Dependencies dependencies
Constructor Detail

SingleEntityDependency

public SingleEntityDependency(org.osgi.framework.BundleContext context,
                              String entityType)
Create a new dependency on an entity of a given type being available in the local room.

Method Detail

start

public void start()
           throws Exception
Description copied from class: Dependency
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).

Specified by:
start in class Dependency
Throws:
Exception

stop

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

Specified by:
stop in class Dependency
Throws:
Exception

value

public Object value()
Description copied from class: Dependency
Convenience method to get the resource acquired by this dependency. Null if dependency is not ready.

Specified by:
value in class Dependency

isReady

public boolean isReady()
Description copied from class: Dependency
True if the dependency is ready to be used.

Specified by:
isReady in class Dependency

elvinOrRoomNotReady

protected void elvinOrRoomNotReady()
If either the elvin or room service is not available then dispose the client and call Dependency.updateReady()


propertyValueChanged

public void propertyValueChanged(PropertyEvent e)
Specified by:
propertyValueChanged in interface PropertyListener


Copyright © 2008 Commonwealth of Australia