ti.chimera
Class Plugin.RegistrySubscriberResource

java.lang.Object
  extended byti.chimera.Resource
      extended byti.chimera.Plugin.RegistrySubscriberResource
All Implemented Interfaces:
NodeCreationSubscriber, NodeDeletionSubscriber, NodeSubscriber
Enclosing class:
Plugin

public abstract class Plugin.RegistrySubscriberResource
extends Resource
implements NodeSubscriber, NodeCreationSubscriber, NodeDeletionSubscriber

A registry resource handles installing/uninstalling various registry subscribers when the plugin becomes active/inactive. To use, this class should be subclassed, and one or more of the following methods overriden: publish, nodeCreated, or nodeDeleted.


Nested Class Summary
 
Nested classes inherited from class ti.chimera.registry.NodeSubscriber
NodeSubscriber.ScriptFunctionNodeSubscriber
 
Nested classes inherited from class ti.chimera.registry.NodeCreationSubscriber
NodeCreationSubscriber.ScriptFunctionNodeCreationSubscriber
 
Nested classes inherited from class ti.chimera.registry.NodeDeletionSubscriber
NodeDeletionSubscriber.ScriptFunctionNodeDeletionSubscriber
 
Constructor Summary
Plugin.RegistrySubscriberResource(java.lang.String path, NodeContract contract, boolean managed)
          Create a RegistrySubscriberResource, which automatically handles subscribing/unsubscribing from registry nodes.
 
Method Summary
 void install()
          install the subscriber
 void nodeCreated(Node node)
          Called when the node is created (ie.
 void nodeDeleted(Node node)
          Called when the node is deleted (ie.
 void publish(Node node, java.lang.Object value)
          Called to publish the new node value to the subscriber.
 java.lang.String toString()
          For debugging.
 void uninstall()
          uninstall the subscriber
 
Methods inherited from class ti.chimera.Resource
isManaged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Plugin.RegistrySubscriberResource

public Plugin.RegistrySubscriberResource(java.lang.String path,
                                         NodeContract contract,
                                         boolean managed)
Create a RegistrySubscriberResource, which automatically handles subscribing/unsubscribing from registry nodes.

Parameters:
path - the path to (un)subscribe to/from
contract - the node-contract, or null; used for subscribeToValue
managed - is this a managed resource
Method Detail

publish

public void publish(Node node,
                    java.lang.Object value)
Called to publish the new node value to the subscriber.

Specified by:
publish in interface NodeSubscriber
Parameters:
node - the node doing the publishing
value - the node's new value

nodeCreated

public void nodeCreated(Node node)
Called when the node is created (ie. added to it's parent)

Specified by:
nodeCreated in interface NodeCreationSubscriber
Parameters:
node - the node created

nodeDeleted

public void nodeDeleted(Node node)
Called when the node is deleted (ie. removed from it's parent)

Specified by:
nodeDeleted in interface NodeDeletionSubscriber
Parameters:
node - the node deleted

install

public void install()
install the subscriber

Specified by:
install in class Resource
See Also:
Resource.uninstall()

uninstall

public void uninstall()
uninstall the subscriber

Specified by:
uninstall in class Resource
See Also:
Resource.install()

toString

public java.lang.String toString()
For debugging.

Returns:
a string