| org.cougaar.core.service.BlackboardService
BlackboardService | public interface BlackboardService extends Service(Code) | | This service provides transactional publish/subscribe access to
the local agent's blackboard.
Most developers should extend
org.cougaar.core.plugin.ComponentPlugin to handle threading and
opening/closing transactions.
|
Method Summary | |
void | closeTransaction() Close a transaction opened by openTransaction() or a
successful tryOpenTransaction(), flushing the change
tracking (delta) lists of any open subscriptions. | void | closeTransaction(boolean resetp) Close a transaction opened by openTransaction() or a
successful tryOpenTransaction(). | void | closeTransactionDontReset() Close a transaction opened by openTransaction() or a successful
tryOpenTransaction(), but don't reset subscription changes or
clear delta lists. | boolean | didRehydrate() | Persistence | getPersistence() | int | getPublishAddedCount() | int | getPublishChangedCount() | int | getPublishRemovedCount() | Subscriber | getSubscriber() | int | getSubscriptionCount() | int | getSubscriptionSize() | boolean | haveCollectionsChanged() | boolean | isTransactionOpen() Check to see if a transaction is open and owned by the current thread. | void | openTransaction() Open a transaction by grabbing the transaction lock and updating
the subscriptions. | void | persistNow() Take a persistence snapshot now. | void | publishAdd(Object o) | void | publishChange(Object o) | void | publishChange(Object o, Collection changes) mark an element of the Plan as changed.
Behavior is not defined if the object is not a member of the plan.
There is no need to call this if the object was added or removed,
only if the contents of the object itself has been changed.
The changes parameter describes a set of changes made to the
object beyond those tracked automatically by the object class
(see the object class documentation for a description of which
types of changes are tracked). | void | publishRemove(Object o) | Collection | query(UnaryPredicate isMember) Issue a query against the logplan. | SubscriptionWatcher | registerInterest(SubscriptionWatcher w) | SubscriptionWatcher | registerInterest() | void | setShouldBePersisted(boolean value) indicate that this blackboard service information should (or should not)
be persisted. | boolean | shouldBePersisted() | void | signalClientActivity() called when the client (Plugin) requests that it be waked again. | Subscription | subscribe(UnaryPredicate isMember) Request a subscription to all objects for which
isMember.execute(object) is true. | Subscription | subscribe(UnaryPredicate isMember, Collection realCollection) like subscribe(UnaryPredicate), but allows specification of
some other type of Collection object as the internal representation
of the collection. | Subscription | subscribe(UnaryPredicate isMember, boolean isIncremental) | Subscription | subscribe(UnaryPredicate isMember, Collection realCollection, boolean isIncremental) Alias for getSubscriber().subscribe(UnaryPredicate, Collection, boolean);
Parameters: isMember - a predicate to execute to ascertainmembership in the collection of the subscription. Parameters: realCollection - a container to hold the contents of the subscription. Parameters: isIncremental - should be true if an incremental subscription is desired.An incremental subscription provides access to the incremental changes to the subscription. | Subscription | subscribe(Subscription subscription) Primary subscribe method, which registers a new subscription. | boolean | tryOpenTransaction() Attempt to open a transaction by attempting to grab the
transaction lock and updating the collections (iff we got the
lock). | void | unregisterInterest(SubscriptionWatcher w) | void | unsubscribe(Subscription subscription) Cancels the given Subscription which must have been returned by a
previous invocation of subscribe(). |
closeTransaction | void closeTransaction() throws SubscriberException(Code) | | Close a transaction opened by openTransaction() or a
successful tryOpenTransaction(), flushing the change
tracking (delta) lists of any open subscriptions.
exception: SubscriberException - IFF we did not own the transactionlock. |
closeTransaction | void closeTransaction(boolean resetp) throws SubscriberException(Code) | | Close a transaction opened by openTransaction() or a
successful tryOpenTransaction().
Parameters: resetp - IFF true, all subscriptions will havetheir resetChanges() method called to clear any delta lists, etc. exception: SubscriberException - IFF we did not own the transactionlock.BlackboardService.closeTransactionDontReset closeTransactionDontReset |
closeTransactionDontReset | void closeTransactionDontReset()(Code) | | Close a transaction opened by openTransaction() or a successful
tryOpenTransaction(), but don't reset subscription changes or
clear delta lists. In effect, defers changes tracked until next
transaction.
exception: SubscriberException - IFF we did not own the transactionlock. |
didRehydrate | boolean didRehydrate()(Code) | | is this BlackboardService the result of a rehydration of a persistence
snapshot?
|
getPersistence | Persistence getPersistence()(Code) | | Hook to allow access to Blackboard persistence mechanism
|
getPublishAddedCount | int getPublishAddedCount()(Code) | | |
getPublishChangedCount | int getPublishChangedCount()(Code) | | |
getPublishRemovedCount | int getPublishRemovedCount()(Code) | | |
getSubscriptionCount | int getSubscriptionCount()(Code) | | |
getSubscriptionSize | int getSubscriptionSize()(Code) | | |
haveCollectionsChanged | boolean haveCollectionsChanged()(Code) | | true iff collection contents have changed since the last transaction. |
isTransactionOpen | boolean isTransactionOpen()(Code) | | Check to see if a transaction is open and owned by the current thread.
There is no method to check to see if the subscribe has a transaction
open which is owned by a different thread, since that would not be a safe
operation.
true IFF the current thread already has an open transaction. |
openTransaction | void openTransaction()(Code) | | Open a transaction by grabbing the transaction lock and updating
the subscriptions. This method blocks waiting for the
transaction lock.
|
persistNow | void persistNow() throws PersistenceNotEnabledException(Code) | | Take a persistence snapshot now. If called from inside a
transaction (the usual case for a plugin), the transaction will
be closed and reopened. This means that a plugin must first
process all of its existing envelopes before calling
persistNow() and then process a potential new set of
envelopes after re-opening the transaction. Otherwise, the
changes will be lost.
exception: PersistenceNotEnabledException - |
publishChange | void publishChange(Object o, Collection changes)(Code) | | mark an element of the Plan as changed.
Behavior is not defined if the object is not a member of the plan.
There is no need to call this if the object was added or removed,
only if the contents of the object itself has been changed.
The changes parameter describes a set of changes made to the
object beyond those tracked automatically by the object class
(see the object class documentation for a description of which
types of changes are tracked). Any additional changes are
merged in after automatically collected reports.
Parameters: changes - a set of ChangeReport instances or null. |
query | Collection query(UnaryPredicate isMember)(Code) | | Issue a query against the logplan. Similar in function to
opening a new subscription, getting the results and immediately
closing the subscription, but can be implemented much more efficiently.
Note: the initial implementation actually does exactly this.
|
setShouldBePersisted | void setShouldBePersisted(boolean value)(Code) | | indicate that this blackboard service information should (or should not)
be persisted.
|
shouldBePersisted | boolean shouldBePersisted()(Code) | | the current value of the persistence setting |
signalClientActivity | void signalClientActivity()(Code) | | called when the client (Plugin) requests that it be waked again.
by default, just calls wakeSubscriptionWatchers, but subclasses
may be more circumspect.
|
subscribe | Subscription subscribe(UnaryPredicate isMember)(Code) | | Request a subscription to all objects for which
isMember.execute(object) is true. The returned Collection
is a transactionally-safe set of these objects which is
guaranteed not to change out from under you during run()
execution.
subscribe() may be called any time after
load() completes.
|
subscribe | Subscription subscribe(UnaryPredicate isMember, Collection realCollection)(Code) | | like subscribe(UnaryPredicate), but allows specification of
some other type of Collection object as the internal representation
of the collection.
Alias for getSubscriber().subscribe(UnaryPredicate, Collection);
|
subscribe | Subscription subscribe(UnaryPredicate isMember, Collection realCollection, boolean isIncremental)(Code) | | Alias for getSubscriber().subscribe(UnaryPredicate, Collection, boolean);
Parameters: isMember - a predicate to execute to ascertainmembership in the collection of the subscription. Parameters: realCollection - a container to hold the contents of the subscription. Parameters: isIncremental - should be true if an incremental subscription is desired.An incremental subscription provides access to the incremental changes to the subscription. the Subsciption. See Also: org.cougaar.core.blackboard.Subscriber.subscribe See Also: org.cougaar.core.blackboard.Subscription |
tryOpenTransaction | boolean tryOpenTransaction()(Code) | | Attempt to open a transaction by attempting to grab the
transaction lock and updating the collections (iff we got the
lock).
This is equivalent to the old (misnamed) tryLockSubscriber method
in PluginWrapper.
true IFF a transaction was opened. |
|
|