cgl.narada.discovery.topics
Class Entity

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

public class Entity
extends Object
implements NBEventListener

Entity can be used to create topics Created on Apr 11, 2005


Field Summary
static String NEW_TOPIC_PLACEHOLDER
           
 
Constructor Summary
Entity(int clientEntityId, String configFile, String id, Certificate cred, PrivateKey priv, PublicKey rootCAPubKey, String brokerHost, String brokerPort, String brokerConnProtocol)
           
 
Method Summary
 void close()
           
 boolean createTopic(String creatorInfo, Calendar lifetime, String topicInfo, int synopsisType, String topicSynopsis, Vector authorizedUsers, int timeout)
          Utility function to create a topic.
 SignedTopicAdvertisement getSignedTopicAdvertisement(String topicSynopsis)
          Returns the signed topic advertisement corresponding to the specified topic synopsis
 String getTopicUUID(String topicSynopsis)
          Returns the topic's UUID corresponding to the specified topic synopsis
static void main(String[] args)
           
 void onEvent(NBEvent nbEvent)
          Process recieved events
 boolean selectTDN()
          Selects a TDN from the list of available TDN's.
 void send(String topicName, byte[] request)
          Publishes the specified request(bytes) on the specifed topic
 boolean sendTDNDiscoveryRequest(int timeout)
          Broadcasts a TDN discovery request on a predefined topic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEW_TOPIC_PLACEHOLDER

public static final String NEW_TOPIC_PLACEHOLDER
See Also:
Constant Field Values
Constructor Detail

Entity

public Entity(int clientEntityId,
              String configFile,
              String id,
              Certificate cred,
              PrivateKey priv,
              PublicKey rootCAPubKey,
              String brokerHost,
              String brokerPort,
              String brokerConnProtocol)
Parameters:
clientEntityId - - An int reflecting the id of this client (in this JVM)
configFile - - Path to ServiceConfiguration.txt file
id - - Id of this Entity (alias used to identify the key in the keystore)
brokerHost - - Host to connect to
brokerPort - - Port
brokerConnProtocol - - Protocol to use
Method Detail

sendTDNDiscoveryRequest

public boolean sendTDNDiscoveryRequest(int timeout)
Broadcasts a TDN discovery request on a predefined topic.

Parameters:
timeout - TODO
Returns:
TRUE if there is atleast 1 TDN, FALSE otherwise

close

public void close()

createTopic

public boolean createTopic(String creatorInfo,
                           Calendar lifetime,
                           String topicInfo,
                           int synopsisType,
                           String topicSynopsis,
                           Vector authorizedUsers,
                           int timeout)
Utility function to create a topic. This function waits until a topic creation response was recieved or a timeout occurred

Parameters:
creatorInfo -
lifetime -
topicInfo -
synopsisType -
topicSynopsis -

getTopicUUID

public String getTopicUUID(String topicSynopsis)
Returns the topic's UUID corresponding to the specified topic synopsis

Parameters:
topicSynopsis -
Returns:
UUID of the specified topic, NULL if the topic sysnopsis was not found

getSignedTopicAdvertisement

public SignedTopicAdvertisement getSignedTopicAdvertisement(String topicSynopsis)
Returns the signed topic advertisement corresponding to the specified topic synopsis

Parameters:
topicSynopsis -
Returns:
Signed topic advertisement of the specified topic, NULL if the topic sysnopsis was not found

selectTDN

public boolean selectTDN()
Selects a TDN from the list of available TDN's. Currently this simply selects the first TDN. A better policy needs to be implemented

Returns:
TRUE if a TDN was selected, FALSE 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)

onEvent

public void onEvent(NBEvent nbEvent)
Process recieved events

Specified by:
onEvent in interface NBEventListener
See Also:
NBEventListener.onEvent(cgl.narada.event.NBEvent)

main

public static void main(String[] args)


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