Java Doc for Subscriber.java in  » Science » Cougaar12_4 » org » cougaar » core » blackboard » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » Cougaar12_4 » org.cougaar.core.blackboard 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.cougaar.core.blackboard.Subscriber

All known Subclasses:   org.cougaar.core.blackboard.Blackboard,
Subscriber
public class Subscriber (Code)
The standard implementation of the org.cougaar.core.service.BlackboardService .


Field Summary
final protected  Listsubscriptions
     our set of active subscriptions.

Constructor Summary
protected  Subscriber()
    
public  Subscriber(BlackboardClient client, Distributor distributor)
     Create a subscriber that provides subscription services to a client and send outgoing messages to a Distributor.
public  Subscriber(BlackboardClient client, Distributor distributor, String subscriberName)
    

Method Summary
public static  booleanabortTransaction()
    
protected  EnvelopeTuplebulkAddObject(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  EnvelopeTuplebulkAddObject(Enumeration en)
     Safer version of bulkAddObject(Collection).
protected  EnvelopeTuplebulkAddObject(Iterator en)
    
final  voidcheckTransactionOK(String methodname, Object arg)
    
final  voidcheckTransactionOK(String methodname)
    
final protected  voidcheckUnpostedChangeReports()
    
protected  voidclaimObject(Object o)
    
protected  EnvelopeTupleclientAddedObject(Object o)
     called whenever the client adds an object to a collection to notify the rest of the world of the change.
protected  EnvelopeTupleclientChangedObject(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  EnvelopeTupleclientRemovedObject(Object o)
     called whenever the client removes an object from a collection to notify the rest of the world of the change.
final public  voidcloseTransaction(boolean resetSubscriptions)
     Close a transaction opened by openTransaction() or a successful tryOpenTransaction().
final public  voidcloseTransaction()
     Close a transaction opened by openTransaction() or a successful tryOpenTransaction().
final public  voidcloseTransactionDontReset()
     Close a transaction opened by openTransaction() or a successful tryOpenTransaction(), but don't reset subscription changes or clear delta lists.
protected  EnvelopecreateEnvelope()
    
public  booleandidRehydrate()
    
protected  EnvelopeflushOutbox()
    
public  BlackboardClientgetClient()
     return the client of the the subscriber.
public  StringgetName()
    
public  ListgetPendingEnvelopes()
    
public  PersistencegetPersistence()
    
public  intgetPublishAddedCount()
    
public  intgetPublishChangedCount()
    
public  intgetPublishRemovedCount()
    
public  SubscribergetSubscriber()
    
public  intgetSubscriptionCount()
    
public  intgetSubscriptionSize()
    
public  ListgetTransactionEnvelopes()
    
public  booleanhaveCollectionsChanged()
     can be called by anyone who can open a transaction to decide what to do.
public  booleanisBusy()
    
final public  booleanisInTransaction()
    
final public  booleanisMyTransaction()
    
public  booleanisQuiescent()
    
 booleanisReadyToPersist()
    
final protected  booleanisTimestamped()
    
final public  booleanisTransactionOpen()
    
protected  TransactionnewTransaction()
     Overridable by extending classes to specify more featureful Transaction semantics.
final public  voidopenTransaction()
     Open a transaction by grabbing the transaction lock and updating the subscriptions.
public  voidpersistNow()
    
protected  EnvelopeprivateGetPublishedChanges()
     Report changes that the plugin published.
protected  booleanprivateUpdateSubscriptions()
     Move inboxes into subscriptions.
final public  voidpublishAdd(Object o)
     Add an object to the blackboard.
final public  voidpublishChange(Object o)
     Convenience function for publishChange(o, null).
final public  voidpublishChange(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  voidpublishRemove(Object o)
     Remove an object from the blackboard.
final public  Collectionquery(UnaryPredicate isMember)
    
public  voidreceiveEnvelopes(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  SubscriptionWatcherregisterInterest(SubscriptionWatcher w)
    
final public  SubscriptionWatcherregisterInterest()
     Allow a thread of a subscriber to register an interest in the subscriber's collections.
protected  voidresetSubscriptionChanges()
    
public  voidsetClientDistributor(BlackboardClient client, Distributor newDistributor)
    
public  voidsetName(String newName)
    
public  voidsetReadyToPersist()
    
public  voidsetShouldBePersisted(boolean shouldBePersisted)
    
final protected  longsetTransactionOpenTime()
    
public  booleanshouldBePersisted()
    
public  voidsignalClientActivity()
     called when the client (Plugin) requests that it be waked again.
public  voidsignalExternalActivity()
     called when external activity changes the subscriber's collections.
public  voidsignalInternalActivity()
     called when internal activity actually changes the subscriber's collections.
final protected  voidstartTransaction()
    
final protected  voidstopTransaction()
    
public  Subscriptionsubscribe(UnaryPredicate isMember)
     Subscribe to a collection service with isMember, default inner collection and supporting incremental change queries.
public  Subscriptionsubscribe(UnaryPredicate isMember, boolean isIncremental)
     Subscribe to a collection service with isMember, default inner collection and specifying if you want incremental change query support.
public  Subscriptionsubscribe(UnaryPredicate isMember, Collection realCollection)
     Subscribe to a collection service with isMember, specifying inner collection and supporting incremental change queries.
public  Subscriptionsubscribe(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  Subscriptionsubscribe(Subscription subscription)
     Primary subscribe method.
public  StringtoString()
    
final public  booleantryOpenTransaction()
     Attempt to open a transaction by attempting to grab the transaction lock and updating the collections (iff we got the lock).
protected  voidunclaimObject(Object o)
    
final public  voidunregisterInterest(SubscriptionWatcher w)
     Allow a thread to unregister an interest registered by registerInterest.
public  voidunsubscribe(Subscription subscription)
     Stop subscribing to a previously obtained Subscription.
public  booleanwasClientActivity()
    
public  booleanwasExternalActivity()
    
public  booleanwasInternalActivity()
    

Field Detail
subscriptions
final protected List subscriptions(Code)
our set of active subscriptions. Access must be synchronized on self.




Constructor Detail
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.



Subscriber
public Subscriber(BlackboardClient client, Distributor distributor, String subscriberName)(Code)




Method Detail
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.



bulkAddObject
protected EnvelopeTuple bulkAddObject(Iterator en)(Code)



checkTransactionOK
final void checkTransactionOK(String methodname, Object arg)(Code)



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)



flushOutbox
protected Envelope flushOutbox()(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.



getName
public String getName()(Code)



getPendingEnvelopes
public List getPendingEnvelopes()(Code)



getPersistence
public Persistence getPersistence()(Code)



getPublishAddedCount
public int getPublishAddedCount()(Code)



getPublishChangedCount
public int getPublishChangedCount()(Code)



getPublishRemovedCount
public int getPublishRemovedCount()(Code)



getSubscriber
public Subscriber getSubscriber()(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.



persistNow
public void persistNow() throws PersistenceNotEnabledException(Code)



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)(Code)
Convenience function for publishChange(o, null).
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




query
final public Collection query(UnaryPredicate isMember)(Code)
lightweight query of Blackboard



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(SubscriptionWatcher w)(Code)



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)



setClientDistributor
public void setClientDistributor(BlackboardClient client, Distributor newDistributor)(Code)



setName
public void setName(String newName)(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)(Code)
Subscribe to a collection service with isMember, default inner collection and supporting incremental change queries.
See Also:   Blackboard.PEDANTIC



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)(Code)
Subscribe to a collection service with isMember, specifying inner collection and supporting incremental change queries.
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



subscribe
final public Subscription subscribe(Subscription subscription)(Code)
Primary subscribe method. Register a new subscription.



toString
public String toString()(Code)



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)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.