cgl.narada.discovery.topics
Class TopicDiscoveryClient

java.lang.Object
  extended by cgl.narada.discovery.topics.TopicDiscoveryClient
All Implemented Interfaces:
NBEventListener

public class TopicDiscoveryClient
extends Object
implements NBEventListener

Topic Discovery Client can be used to discover topic UUIDs by querying TDN
Created on Apr 8, 2005


Constructor Summary
TopicDiscoveryClient(int clientEntityId, String configFile, Certificate _creds, PrivateKey _priv, String host, String port, String protocol)
          Creates a TopicDiscoveryClient for discovering topics
Assumes that the host/port/protocol of the broker have been previously determined (using for e.g.
 
Method Summary
 void close()
           
 SignedTopicAdvertisement[] discover(int queryType, String query, String TDN_ID, int maxResponses)
          Utility function to discover a topic.
static void main(String[] args)
           
 void onEvent(NBEvent nbEvent)
          Upon the receipt of an event which has satisfied all the constraints, if any were provided, that needed to be satisfied prior to delivery
 void send(String topicName, byte[] request)
          Publishes the specified request(bytes) on the specifed topic
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopicDiscoveryClient

public TopicDiscoveryClient(int clientEntityId,
                            String configFile,
                            Certificate _creds,
                            PrivateKey _priv,
                            String host,
                            String port,
                            String protocol)
Creates a TopicDiscoveryClient for discovering topics
Assumes that the host/port/protocol of the broker have been previously determined (using for e.g. the broker discovery mechanisms)

Parameters:
clientEntityId - clientId to use
configFile - Path to ServiceConfiguration.txt file
_creds - Client certificate
_priv - Client's private key
host - The host where a broker is running
port - The port to which to connect to
protocol - Protocol to use
Method Detail

discover

public SignedTopicAdvertisement[] discover(int queryType,
                                           String query,
                                           String TDN_ID,
                                           int maxResponses)
Utility function to discover a topic. This function waits until a topic discovery response was recieved or a timeout occurred

Parameters:
queryType - - Type of query (String, INT, TaG-value etc...
query - - The query for discovering topics
TDN_ID - - IF NULL, broadcast the query on TOPIC_DISCOVERY topic, else can specify a specific TDN to target this query
Returns:
An array of TopicAdvertisement objects if TDNs could match the request, Empty array otherwise

send

public void send(String topicName,
                 byte[] request)
Publishes the specified request(bytes) on the specifed topic

Parameters:
topicName - - The topic to which the request must be published
request - - The request to be published (in bytes)

close

public void close()

onEvent

public void onEvent(NBEvent nbEvent)
Description copied from interface: NBEventListener
Upon the receipt of an event which has satisfied all the constraints, if any were provided, that needed to be satisfied prior to delivery

Specified by:
onEvent in interface NBEventListener

main

public static void main(String[] args)


For comments and suggestions please send e-mail to The NaradaBrokering Project