| java.lang.Object org.cougaar.core.blackboard.Subscriber
All known Subclasses: org.cougaar.core.blackboard.Blackboard,
Method Summary | |
public static boolean | abortTransaction() | protected EnvelopeTuple | bulkAddObject(Collection c) A extension subscriber may call this method to execute bulkAdd transactions.
This is protected because it is of very limited to other than persistance plugins.
Note that Blackboard does something like
this by hand constructing an entire special-purpose envelope. | protected EnvelopeTuple | bulkAddObject(Enumeration en) Safer version of bulkAddObject(Collection). | protected EnvelopeTuple | bulkAddObject(Iterator en) | final void | checkTransactionOK(String methodname, Object arg) | final void | checkTransactionOK(String methodname) | final protected void | checkUnpostedChangeReports() | protected void | claimObject(Object o) | protected EnvelopeTuple | clientAddedObject(Object o) called whenever the client adds an object to a collection
to notify the rest of the world of the change. | protected EnvelopeTuple | clientChangedObject(Object o, List changes) called whenever the client changes an object in a collection
to notify the rest of the world of the change. | protected EnvelopeTuple | clientRemovedObject(Object o) called whenever the client removes an object from a collection
to notify the rest of the world of the change. | final public void | closeTransaction(boolean resetSubscriptions) Close a transaction opened by openTransaction() or a
successful tryOpenTransaction(). | final public void | closeTransaction() Close a transaction opened by openTransaction() or a
successful tryOpenTransaction(). | final public void | closeTransactionDontReset() Close a transaction opened by openTransaction() or a successful
tryOpenTransaction(), but don't reset subscription changes or
clear delta lists. | protected Envelope | createEnvelope() | public boolean | didRehydrate() | protected Envelope | flushOutbox() | public BlackboardClient | getClient() return the client of the the subscriber. | public String | getName() | public List | getPendingEnvelopes() | public Persistence | getPersistence() | public int | getPublishAddedCount() | public int | getPublishChangedCount() | public int | getPublishRemovedCount() | public Subscriber | getSubscriber() | public int | getSubscriptionCount() | public int | getSubscriptionSize() | public List | getTransactionEnvelopes() | public boolean | haveCollectionsChanged() can be called by anyone who can open a transaction to decide what to do. | public boolean | isBusy() | final public boolean | isInTransaction() | final public boolean | isMyTransaction() | public boolean | isQuiescent() | boolean | isReadyToPersist() | final protected boolean | isTimestamped() | final public boolean | isTransactionOpen() | protected Transaction | newTransaction() Overridable by extending classes to specify more featureful
Transaction semantics. | final public void | openTransaction() Open a transaction by grabbing the transaction lock and updating
the subscriptions. | public void | persistNow() | protected Envelope | privateGetPublishedChanges() Report changes that the plugin published. | protected boolean | privateUpdateSubscriptions() Move inboxes into subscriptions. | final public void | publishAdd(Object o) Add an object to the blackboard. | final public void | publishChange(Object o) Convenience function for publishChange(o, null). | final public void | publishChange(Object o, Collection changes) Mark an object on the blackboard as changed.
Behavior is not defined if the object is not on the blackboard.
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). | final public void | publishRemove(Object o) Remove an object from the blackboard. | final public Collection | query(UnaryPredicate isMember) | public void | receiveEnvelopes(List envelopes, boolean envelopeQuiescenceRequired) Called by non-client methods to add an envelope to our inboxes.
This is complicated because we wish to avoid holding envelopes
when there is no possibility of their ever being used (no
subscriptions). | final public SubscriptionWatcher | registerInterest(SubscriptionWatcher w) | final public SubscriptionWatcher | registerInterest() Allow a thread of a subscriber to register an interest in the
subscriber's collections. | protected void | resetSubscriptionChanges() | public void | setClientDistributor(BlackboardClient client, Distributor newDistributor) | public void | setName(String newName) | public void | setReadyToPersist() | public void | setShouldBePersisted(boolean shouldBePersisted) | final protected long | setTransactionOpenTime() | public boolean | shouldBePersisted() | public void | signalClientActivity() called when the client (Plugin) requests that it be waked again. | public void | signalExternalActivity() called when external activity changes the subscriber's collections. | public void | signalInternalActivity() called when internal activity actually changes the subscriber's
collections. | final protected void | startTransaction() | final protected void | stopTransaction() | public Subscription | subscribe(UnaryPredicate isMember) Subscribe to a collection service with isMember, default inner
collection and supporting incremental change queries. | public Subscription | subscribe(UnaryPredicate isMember, boolean isIncremental) Subscribe to a collection service with isMember, default inner
collection and specifying if you want incremental change query support. | public Subscription | subscribe(UnaryPredicate isMember, Collection realCollection) Subscribe to a collection service with isMember, specifying inner
collection and supporting incremental change queries. | public Subscription | subscribe(UnaryPredicate isMember, Collection realCollection, boolean isIncremental) Subscribe to a collection service.
Tells the Distributor about its interest, but should not block,
even if there are lots of "back issues" to transmit.
This is the full form.
Parameters: isMember - The defining predicate for the slice of the blackboard. Parameters: realCollection - The real container wrapped by the returned value. Parameters: isIncremental - IFF true, returns a container that supports deltalists. | final public Subscription | subscribe(Subscription subscription) Primary subscribe method. | public String | toString() | final public boolean | tryOpenTransaction() Attempt to open a transaction by attempting to grab the
transaction lock and updating the collections (iff we got the
lock). | protected void | unclaimObject(Object o) | final public void | unregisterInterest(SubscriptionWatcher w) Allow a thread to unregister an interest registered by
registerInterest. | public void | unsubscribe(Subscription subscription) Stop subscribing to a previously obtained Subscription. | public boolean | wasClientActivity() | public boolean | wasExternalActivity() | public boolean | wasInternalActivity() |
subscriptions | final protected List subscriptions(Code) | | our set of active subscriptions. Access must be synchronized on self.
|
Subscriber | protected Subscriber()(Code) | | |
Subscriber | public Subscriber(BlackboardClient client, Distributor distributor)(Code) | | Create a subscriber that provides subscription services
to a client and send outgoing messages to a Distributor.
Plugin clients will use this API.
|
abortTransaction | public static boolean abortTransaction()(Code) | | |
bulkAddObject | protected EnvelopeTuple bulkAddObject(Collection c)(Code) | | A extension subscriber may call this method to execute bulkAdd transactions.
This is protected because it is of very limited to other than persistance plugins.
Note that Blackboard does something like
this by hand constructing an entire special-purpose envelope. This, however, is
for use in-band, in-transaction.
The Collection passed MUST be immutable, since there may be many consumers,
each running at different times.
|
bulkAddObject | protected EnvelopeTuple bulkAddObject(Enumeration en)(Code) | | Safer version of bulkAddObject(Collection).
Creates a Collection from the Enumeration and passes it into
the envelope.
|
checkTransactionOK | final void checkTransactionOK(String methodname)(Code) | | |
checkUnpostedChangeReports | final protected void checkUnpostedChangeReports()(Code) | | |
claimObject | protected void claimObject(Object o)(Code) | | utility to claim an object as ours
|
clientAddedObject | protected EnvelopeTuple clientAddedObject(Object o)(Code) | | called whenever the client adds an object to a collection
to notify the rest of the world of the change.
Actual Changes to the collection only happen via this api.
|
clientChangedObject | protected EnvelopeTuple clientChangedObject(Object o, List changes)(Code) | | called whenever the client changes an object in a collection
to notify the rest of the world of the change.
Actual Changes to the collection only happen via this api.
|
clientRemovedObject | protected EnvelopeTuple clientRemovedObject(Object o)(Code) | | called whenever the client removes an object from a collection
to notify the rest of the world of the change.
Actual Changes to the collection only happen via this api.
|
closeTransaction | final public void closeTransaction(boolean resetSubscriptions) throws SubscriberException(Code) | | Close a transaction opened by openTransaction() or a
successful tryOpenTransaction().
Parameters: resetSubscriptions - IFF true, all subscriptions will havetheir resetChanges() method called to clear any delta lists, etc. exception: SubscriberException - IFF we did not own the transactionlock.Subscriber.closeTransactionDontReset closeTransactionDontReset |
closeTransaction | final public void closeTransaction()(Code) | | Close a transaction opened by openTransaction() or a
successful tryOpenTransaction().
Will reset all subscription change tracking facilities.
To avoid this, use closeTransactionDontReset() instead.
exception: SubscriberException - IFF we did not own the transactionlock. |
closeTransactionDontReset | final public void closeTransactionDontReset()(Code) | | Close a transaction opened by openTransaction() or a successful
tryOpenTransaction(), but don't reset subscription changes or
clear delta lists.
exception: SubscriberException - IFF we did not own the transactionlock. |
createEnvelope | protected Envelope createEnvelope()(Code) | | factory method for creating Envelopes of the correct type
|
didRehydrate | public boolean didRehydrate()(Code) | | |
getClient | public BlackboardClient getClient()(Code) | | return the client of the the subscriber.
May be overridden by subclasses in case they are really
delegating to some other object.
|
getPendingEnvelopes | public List getPendingEnvelopes()(Code) | | |
getPublishAddedCount | public int getPublishAddedCount()(Code) | | |
getPublishChangedCount | public int getPublishChangedCount()(Code) | | |
getPublishRemovedCount | public int getPublishRemovedCount()(Code) | | |
getSubscriptionCount | public int getSubscriptionCount()(Code) | | |
getSubscriptionSize | public int getSubscriptionSize()(Code) | | |
getTransactionEnvelopes | public List getTransactionEnvelopes()(Code) | | Accessors to persist our inbox state
|
haveCollectionsChanged | public boolean haveCollectionsChanged()(Code) | | can be called by anyone who can open a transaction to decide what to do.
returned value is only valid/useful inside an open transaction.
|
isBusy | public boolean isBusy()(Code) | | |
isInTransaction | final public boolean isInTransaction()(Code) | | Does someone have an open transaction?
|
isMyTransaction | final public boolean isMyTransaction()(Code) | | Do I have an open transaction?
This really translates to "Is is safe to make changes to my
collections?"
|
isQuiescent | public boolean isQuiescent()(Code) | | |
isReadyToPersist | boolean isReadyToPersist()(Code) | | |
isTimestamped | final protected boolean isTimestamped()(Code) | | |
isTransactionOpen | final public boolean isTransactionOpen()(Code) | | check to see if we've already got an open transaction
|
newTransaction | protected Transaction newTransaction()(Code) | | Overridable by extending classes to specify more featureful
Transaction semantics.
|
openTransaction | final public void openTransaction()(Code) | | Open a transaction by grabbing the transaction lock and updating
the subscriptions. This method blocks waiting for the
transaction lock.
|
privateGetPublishedChanges | protected Envelope privateGetPublishedChanges()(Code) | | Report changes that the plugin published.
These changes are represented by the outbox.
|
privateUpdateSubscriptions | protected boolean privateUpdateSubscriptions()(Code) | | Move inboxes into subscriptions.
|
publishAdd | final public void publishAdd(Object o)(Code) | | Add an object to the blackboard.
Behavior is not defined if the object was already on the blackboard.
See Also: Blackboard.PEDANTIC |
publishChange | final public void publishChange(Object o, Collection changes)(Code) | | Mark an object on the blackboard as changed.
Behavior is not defined if the object is not on the blackboard.
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. See Also: Blackboard.PEDANTIC |
publishRemove | final public void publishRemove(Object o)(Code) | | Remove an object from the blackboard.
Behavior is not defined if the object was not already on the blackboard.
See Also: Blackboard.PEDANTIC |
receiveEnvelopes | public void receiveEnvelopes(List envelopes, boolean envelopeQuiescenceRequired)(Code) | | Called by non-client methods to add an envelope to our inboxes.
This is complicated because we wish to avoid holding envelopes
when there is no possibility of their ever being used (no
subscriptions). A simple test of the number of subscriptions is
insufficient because, if a transaction is open, new subscriptions
may be created that, in later transactions, need to receive the
envelopes. So the test includes a test of transactions being
open. We use transactionLock.tryGetBusyFlag() because we can't
block and the fact that the lock is busy, is a sufficient
indication that we must put the new envelopes into the inbox. It
may turn out that the inbox did not need to be stuffed (because
there will not be any subscriptions), but this is handled when
the transaction is closed where the inbox is emptied if there are
no subscriptions.
|
registerInterest | final public SubscriptionWatcher registerInterest()(Code) | | Allow a thread of a subscriber to register an interest in the
subscriber's collections. Mainly used to allow threads to monitor
changes in collections - that is, the fact of change, not the details.
The level of support here is like the old wake and interestSemaphore
code. The client of a subscriber need not register explicitly, as
it is done at initialization time.
|
resetSubscriptionChanges | protected void resetSubscriptionChanges()(Code) | | |
setReadyToPersist | public void setReadyToPersist()(Code) | | |
setShouldBePersisted | public void setShouldBePersisted(boolean shouldBePersisted)(Code) | | |
setTransactionOpenTime | final protected long setTransactionOpenTime()(Code) | | |
shouldBePersisted | public boolean shouldBePersisted()(Code) | | |
signalClientActivity | public 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.
|
signalExternalActivity | public void signalExternalActivity()(Code) | | called when external activity changes the subscriber's collections.
by default, just calls wakeSubscriptionWatchers, but subclasses
may be more circumspect.
|
signalInternalActivity | public void signalInternalActivity()(Code) | | called when internal activity actually changes the subscriber's
collections.
by default, just calls wakeSubscriptionWatchers, but subclasses
may be more circumspect.
|
startTransaction | final protected void startTransaction()(Code) | | |
stopTransaction | final protected void stopTransaction()(Code) | | |
subscribe | public Subscription subscribe(UnaryPredicate isMember, boolean isIncremental)(Code) | | Subscribe to a collection service with isMember, default inner
collection and specifying if you want incremental change query support.
See Also: Blackboard.PEDANTIC |
subscribe | public Subscription subscribe(UnaryPredicate isMember, Collection realCollection, boolean isIncremental)(Code) | | Subscribe to a collection service.
Tells the Distributor about its interest, but should not block,
even if there are lots of "back issues" to transmit.
This is the full form.
Parameters: isMember - The defining predicate for the slice of the blackboard. Parameters: realCollection - The real container wrapped by the returned value. Parameters: isIncremental - IFF true, returns a container that supports deltalists. The resulting Subscription See Also: IncrementalSubscription See Also: Blackboard.PEDANTIC |
tryOpenTransaction | final public 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. |
unclaimObject | protected void unclaimObject(Object o)(Code) | | utility to release a claim on an object
|
unregisterInterest | final public void unregisterInterest(SubscriptionWatcher w) throws SubscriberException(Code) | | Allow a thread to unregister an interest registered by
registerInterest. Should be done if a subordinate (watching)
thread exits, or a plugin unloads.
|
unsubscribe | public void unsubscribe(Subscription subscription)(Code) | | Stop subscribing to a previously obtained Subscription. The
Subscription must have been returned from a previous call to
subscribe.
Parameters: subscription - the Subscription that is to be cancelled. |
wasClientActivity | public boolean wasClientActivity()(Code) | | |
wasExternalActivity | public boolean wasExternalActivity()(Code) | | |
wasInternalActivity | public boolean wasInternalActivity()(Code) | | |
|
|