| java.lang.Object org.cougaar.lib.aggagent.session.RemoteBlackboardSubscription
RemoteBlackboardSubscription | public class RemoteBlackboardSubscription implements SubscriptionAccess(Code) | |
A RemoteBlackboardSubscription is a mechanism that allows remote clients to
collect information from a COUGAAR Agent in much the same way as one of its
Plugins. Instances of this class behave like an IncrementalSubscription,
that is, they accumulate and incrementally report lists of blackboard
objects that have been added, removed, or modified. However, their
reporting model is not tied directly to the Cluster's event thread.
Each RemoteBlackboardSubscription is backed by an IncrementalSubscription,
which actually gets information from the blackboard.
Access to incremental information is granted during a reporting
transaction, which is started by calling open() and ended by calling
close(). An IllegalStateException may be raised if the expected protocol
is not followed.
|
Method Summary | |
public void | close() End a reporting transaction. | public Collection | getAddedCollection() This method is legal only during a reporting transaction; calling it at
another time raises an IllegalStateException. | public Collection | getChangedCollection() This method is legal only during a reporting transaction; calling it at
another time raises an IllegalStateException. | public Collection | getMembership() Obtain a Collection view of all blackboard Objects matching the predicate
of this RemoteSubscription. | public Collection | getRemovedCollection() This method is legal only during a reporting transaction; calling it at
another time raises an IllegalStateException. | public IncrementalSubscription | getSubscription() | public boolean | hasChanged() Tell whether unreported changes to the subscription have been posted. | public void | open() Begin a reporting transaction. | public void | shutDown() Unsubscribe from the Cluster's blackboard and destroy the underlying
subscription. | public void | subscriptionChanged()
Implementation of the UISubscriber interface. | protected void | unsubscribe() Destroy the underlying subscription. |
RemoteBlackboardSubscription | protected RemoteBlackboardSubscription()(Code) | | Create a new RemoteBlackboardSubscription specifying no initialization
parameters (no IncrementalSubscription is created). This may be used by
subclasses to circumvent the default usage of the BlackboardService.
|
RemoteBlackboardSubscription | public RemoteBlackboardSubscription(BlackboardService s, UnaryPredicate p)(Code) | | Create a new RemoteBlackboardSubscription to gather Objects matching the
given predicate. The BlackboardService reference allows the underlying
IncrementalSubscription to be created.
|
RemoteBlackboardSubscription | public RemoteBlackboardSubscription(BlackboardService s, UnaryPredicate p, boolean transientQuery)(Code) | | Used for transient queries. Fill added collection with the results
of a one-time query.
|
close | public void close()(Code) | | End a reporting transaction. Lists of added, changed, and removed
blackboard objects are flushed so that they may be refilled when a new
transaction is started by the open method. Calls to this method while
there is no transaction in progress have no effect.
|
getAddedCollection | public Collection getAddedCollection()(Code) | | This method is legal only during a reporting transaction; calling it at
another time raises an IllegalStateException. A Collection view of the
list of blackboard Objects added since the start of the last transaction
is returned.
|
getChangedCollection | public Collection getChangedCollection()(Code) | | This method is legal only during a reporting transaction; calling it at
another time raises an IllegalStateException. A Collection view of the
list of blackboard Objects changed since the start of the last
transaction is returned.
|
getMembership | public Collection getMembership()(Code) | | Obtain a Collection view of all blackboard Objects matching the predicate
of this RemoteSubscription. The underlying IncrementalSubscription is
queried for its contents, which are not necessarily synchronized with the
reporting model maintained by this class. Calling this method is legal
both inside and outside of reporting transactions.
|
getRemovedCollection | public Collection getRemovedCollection()(Code) | | This method is legal only during a reporting transaction; calling it at
another time raises an IllegalStateException. A Collection view of the
list of blackboard Objects removed since the start of the last
transaction is returned.
|
hasChanged | public boolean hasChanged()(Code) | | Tell whether unreported changes to the subscription have been posted.
This operation is not legal during reporting transactions.
|
open | public void open()(Code) | | Begin a reporting transaction. Lists of added, changed, and removed
blackboard objects are constructed and held constant until the end of
the transaction, as marked by a call to the close method. An
IllegalStateException is raised if this method is called while a
transaction is already in progress. Clients attempting to open a
reporting transaction should catch this Exception and refrain from any
calls to methods "getAddedCollection", "getChangedCollection",
"getRemovedCollection", and "close" until such a time as the open method
is allowed to succeed.
|
shutDown | public void shutDown()(Code) | | Unsubscribe from the Cluster's blackboard and destroy the underlying
subscription. After this method is called, the RemoteSubscription is no
longer operational (all of the client interface methods will throw
IllegalStateException).
|
subscriptionChanged | public void subscriptionChanged()(Code) | |
Implementation of the UISubscriber interface. This method is called by
the Cluster when it has posted updates to the Subscription underlying
this RemoteSubscription. The Subscription argument required by the
interface is ignored, and it is assumed that the changes are relevant to
the Subscription managed locally.
If this method should happen to be called after shutDown, it is ignored.
|
unsubscribe | protected void unsubscribe()(Code) | | Destroy the underlying subscription. Subclasses, which may perform the
operation differently, can do so by overriding this method.
|
|
|