|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Topic
Aggregates publish, subscribe, and query activity across multiple zones.
An agent typically registers with its zones at startup, creates Topic
instances for the data types it is interested in, and then joins topics to
each zone by calling join(Zone). Topics can be joined to any number
of zones. If an agent wishes to manage publish and subscribe
activity on a per-zone basis, it can do so by provisioning the zones directly
by calling Provisioner.setPublisher(Publisher),
Provisioner.setQueryResults(QueryResults), or
Provisioner.setSubscriber(Subscriber, ElementDef, SubscriptionOptions)
The ADK applies publish, subscribe, and query functionality equally to all
zones joined to a topic. Thus, if the topic provides authoritative data to
its zones (that is, it is registered with the ZIS as a Provider), it will
do so for all zones by delegating incoming queries to the Publisher
registered with this topic. Similarly, the topic will
query all zones for data objects when the query(Query) method is
called. (An exception to this is directed queries, which require that the
caller specify a zone and agent name to direct the query.)
Consult the ADK Developer Guide for more information about working with multiple zones.
| Method Summary | |
|---|---|
Query |
createQuery()
Creates a Query instance that is initialized to request the object type encapsulated by this Topic and this SIFContext. |
ElementDef |
getObjectDef()
Gets the ElementDef representing the SIF Data Object associated with this topic |
java.lang.String |
getObjectType()
Gets the name of the SIF Data Object associated with this topic |
Publisher |
getPublisher()
Gets the Publisher registered with this topic |
QueryResults |
getQueryResultsObject()
Gets the QueryResults object that is registered with this topic. |
ReportPublisher |
getReportPublisher()
Gets the ReportPublisher registered with this topic |
SIFContext |
getSIFContext()
Gets the SIFContext that this Topic is bound to. |
Subscriber |
getSubscriber()
Gets the Subscriber registered with this topic |
Zone[] |
getZones()
Gets all zones joined to this topic |
void |
join(Zone zone)
Joins a zone with this topic. |
void |
purgeQueue(boolean incoming,
boolean outgoing)
Purge all pending incoming and/or outgoing messages from this agent's queue. |
void |
query()
Query the topic by sending a SIF_Request message to all zones joined with the topic. |
void |
query(Query query)
Query the topic by sending a SIF_Request message to all zones joined with the topic |
void |
query(Query query,
int queryOptions)
Query the topic by sending a SIF_Request message to all zones joined with the topic |
void |
query(Query query,
MessagingListener listener)
Query the topic by sending a SIF_Request message to all zones joined with the topic. |
void |
query(Query query,
MessagingListener listener,
int queryOptions)
Query the topic by sending a SIF_Request message to all zones joined with the topic. |
void |
query(Query query,
MessagingListener listener,
java.lang.String destinationId,
int queryOptions)
Query the topic by sending a SIF_Request message to all zones joined with the topic. |
void |
query(Query query,
java.lang.String destinationId,
int queryOptions)
Query the topic by sending a SIF_Request message to all zones joined with the topic |
void |
setPublisher(Publisher publisher,
PublishingOptions flags)
Register a Publisher message handler to process SIF_Request messages received on the zones joined with this topic. |
void |
setQueryResults(QueryResults queryResultsObject,
QueryResultsOptions flags)
Sets the QueryResults message handler registered with this topic. |
void |
setReportPublisher(ReportPublisher publisher,
ReportPublishingOptions flags)
Register a ReportPublisher message handler to process SIF_Request messages received for SIF_ReportObject objects from the zones joined with this topic. |
void |
setSubscriber(Subscriber subscriber,
SubscriptionOptions flags)
Register a Subscriber message handler to process SIF_Event messages received on the zones joined with this topic. |
| Method Detail |
|---|
void join(Zone zone)
throws ADKException
All SIF messaging performed on this topic will be propagated to all
zones joined with the topic. For example, calling the query
method queries all of the topic's zones, and SIF_Responses received by
each zone are first dispatched to the topic's QueryResults object.
zone - A Zone created by the agent ZoneFactory
ADKException - is thrown if the zone is already joined to a
topic or if there is a SIF error during agent registration.java.lang.String getObjectType()
ElementDef getObjectDef()
SIFContext getSIFContext()
Zone[] getZones()
void setPublisher(Publisher publisher,
PublishingOptions flags)
throws ADKException
For Topics created to represent the SIF_ReportObject object type, register
a publisher message handler with the setReportPublisher
method instead.
publisher - An object that implements the Publisher interface.flags - Specify ADKFlags.PROV_PROVIDE to register the
agent as the default provider of the object type associated with this
topic. The ADK will send a SIF_Provide message to each zone joined
with the topic. Specify ADKFlags.PROV_NONE if the agent
can respond to requests for the object type but will not register as
the authoritative provider.
ADKException - Thrown
void setReportPublisher(ReportPublisher publisher,
ReportPublishingOptions flags)
This method must be called instead of setPublisher for topics
created to represent the SIF_ReportObject data type.
publisher - An object that implements the Publisher interface.flags - Specify ADKFlags.PROV_PROVIDE to register the
agent as the default provider of the object type associated with this
topic. The ADK will send a SIF_Provide message to each zone joined
with the topic. Specify ADKFlags.PROV_NONE if the agent
can respond to requests for the object type but will not register as
the authoritative provider.Publisher getPublisher()
setPublisher methodReportPublisher getReportPublisher()
setReportPublisher methodsetReportPublisher(ReportPublisher, ReportPublishingOptions)
void setSubscriber(Subscriber subscriber,
SubscriptionOptions flags)
throws ADKException
subscriber - An object that implements the Subscriber
interfaceflags - Specify ADKFlags.PROV_SUBSCRIBE to register the
agent as a subscriber of the object type. The ADK will send a
SIF_Subscribe message to each zone joined with the topic.
ADKExceptionSubscriber getSubscriber()
setSubscriber method
void setQueryResults(QueryResults queryResultsObject,
QueryResultsOptions flags)
throws ADKException
Topic.query methods.
queryResultsObject - An QueryResults message handlerflags - The QueryResultsOptions that should be used for this agent, or Null
to accept defaults
ADKExceptionquery(Query),
getQueryResultsObject()QueryResults getQueryResultsObject()
setQueryResults
method, or null if no message handler is registered with this topic.Query createQuery()
It is good practice that this factory method be used when creating Query instances for Topics. If a Query object is created outside of this method, it may still work, but if created incorrectly (using the wrong ElementDef or SIFContext), This topic will not be able to process the results of the Query.
Query instance that has been set to represent a
SIF_Request for the SIFDataObject type represented by this topic
void query()
throws ADKException
createQuery() to get a Query instance, add query
Conditions by calling Query.addCondition(ElementDef, ComparisonOperators, String),
and then call query(Query)
ADKException
void query(Query query)
throws ADKException
query - A Query object that encapsulates the elements to query and
the optional field restrictions placed on the results
ADKException
void query(Query query,
MessagingListener listener)
throws ADKException
query method also notifies a
MessagingListener of any SIF_Request messaging that takes place.
query - A Query object that encapsulates the elements to query and
the optional field restrictions placed on the resultslistener - A MessagingListener that will be notified when the
SIF_Request message is sent to the zone. Any other MessagingListeners
registered with the zone will also be called.
ADKException
void query(Query query,
int queryOptions)
throws ADKException
query - A Query object that encapsulates the elements to query and
the optional field restrictions placed on the resultsqueryOptions - Reserved for future use
ADKException
void query(Query query,
MessagingListener listener,
int queryOptions)
throws ADKException
query method also notifies a
MessagingListener of any SIF_Request activity that takes place.
query - A Query object that encapsulates the elements to query and
the optional field restrictions placed on the resultsqueryOptions - Reserved for future uselistener - A MessagingListener that will be notified when the
SIF_Request message is sent to the zone. Any other MessagingListeners
registered with the zone will also be called.
ADKException
void query(Query query,
java.lang.String destinationId,
int queryOptions)
throws ADKException
query - A Query object that encapsulates the elements to query and
the optional field restrictions placed on the resultsdestinationId - The SourceId of the agent to which the SIF_Request
message should be delivered. When null, the message is delivered to
the object provider as defined by the SIF ZonequeryOptions - Reserved for future use
ADKException
void query(Query query,
MessagingListener listener,
java.lang.String destinationId,
int queryOptions)
throws ADKException
query method also notifies
a MessagingListener of any SIF_Request messaging that takes place.
query - A Query object that encapsulates the elements to query and
the optional field restrictions placed on the results.listener - A MessagingListener that will be notified when the
SIF_Request message is sent to the zone. Any other MessagingListeners
registered with the zone will also be called.destinationId - The SourceId of the agent to which the SIF_Request
message should be delivered. When null, the message is delivered to
the object provider as defined by the SIF Zone.queryOptions - Reserved for future use.
ADKException
void purgeQueue(boolean incoming,
boolean outgoing)
throws ADKException
incoming - true to purge incoming messagesoutgoing - true to purge outgoing messages (e.g. pending SIF_Events)
when the Agent Local Queue is enabled
ADKException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||