cgl.narada.node
Class BrokerNode

java.lang.Object
  extended by cgl.narada.node.BrokerNode
All Implemented Interfaces:
BrokerSystemEventListener, NodeDebugFlags

public class BrokerNode
extends Object
implements BrokerSystemEventListener, NodeDebugFlags

The Narada Broker instance. The properties for this broker are specified in the configuration file.


Nested Class Summary
static class BrokerNode.BrokerProcess
           
 
Field Summary
static String aboutThisBroker
           
static String belongsToGroup
           
 
Fields inherited from interface cgl.narada.node.NodeDebugFlags
BrokerNode_Debug, BrokerPropertiesReader_Debug, ClientNode_Debug, ServerNode_Debug
 
Constructor Summary
BrokerNode(Properties props)
           
 
Method Summary
 void closeLink(String linkID)
          Delete the link specified by the linkID parameter.
 String connectTo(Properties props, String transport)
          Older version of connectTo Function
 String connectTo(String host, String portNum, String medium, int level)
          Creates a link to the specified broker.
 void disableMonitoringService()
           
 void enableMonitoringService()
           
 BrokerInformationDocument getBrokerInformation()
           
 Properties getBrokerProperties()
           
 String[] getLinks()
          Get all the links on this broker Node
 void handleEvent(Object arg0)
           
static void main(String[] args)
           
 boolean requestGatewayAddress(String client, int gatewayLevel)
          Tell the broker to request a gateway address from the specified broker
 boolean requestNodeAddress(String client, String s_level)
          Tell the broker to request a node address from the specified client
 void sendTo(String client, byte[] data)
           
 void setBrokerSystemEventGenerator(BrokerSystemEventGenerator evGen)
           
 boolean shutdown()
          Shuts down the broker and cleans up all resources
 void startMonitoringService()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

aboutThisBroker

public static String aboutThisBroker

belongsToGroup

public static String belongsToGroup
Constructor Detail

BrokerNode

public BrokerNode(Properties props)
Method Detail

getBrokerInformation

public final BrokerInformationDocument getBrokerInformation()
Returns:
Returns the brokerInformation.

handleEvent

public void handleEvent(Object arg0)
Specified by:
handleEvent in interface BrokerSystemEventListener

setBrokerSystemEventGenerator

public final void setBrokerSystemEventGenerator(BrokerSystemEventGenerator evGen)

connectTo

public String connectTo(String host,
                        String portNum,
                        String medium,
                        int level)
Creates a link to the specified broker. Helps to generate a broker network topology.

Parameters:
host - The host on which the target boker resides
portNum - The port number to which a connection is requested
medium - The transport protocol to be used. Valid values are
  • 't' - tcp
  • 'p' - ptcp
  • 'u' - udp
  • 'nio' - niotcp
  • 'http' or 'ssl' <- Requires to set the 4th parameter confFileName
opt_confFileName - May be blank unless the medium is http or ssl
Returns:
A String representing the linkId of the created link if successful, NULL otherwise

connectTo

public String connectTo(Properties props,
                        String transport)
                 throws TransportException
Older version of connectTo Function

Parameters:
props -
transport -
Returns:
Throws:
TransportException

requestNodeAddress

public boolean requestNodeAddress(String client,
                                  String s_level)
Tell the broker to request a node address from the specified client

Parameters:
client - - The link id of the connection on which the request is to be sent
s_level - - address level
Returns:
- True if the Request was carried out successfully

requestGatewayAddress

public boolean requestGatewayAddress(String client,
                                     int gatewayLevel)
Tell the broker to request a gateway address from the specified broker

Parameters:
client - - The link id of the connection on which the request is to be sent
s_level - - address level
Returns:
- True if the Request was carried out successfully

getLinks

public String[] getLinks()
Get all the links on this broker Node

Returns:
An Array of Strings containing the names of various links on this broker

closeLink

public void closeLink(String linkID)
Delete the link specified by the linkID parameter. If a link does not exist, Nothing happens.

Parameters:
linkID - - Specifies the link to delete

shutdown

public boolean shutdown()
Shuts down the broker and cleans up all resources


sendTo

public void sendTo(String client,
                   byte[] data)

startMonitoringService

public void startMonitoringService()
                            throws TransportException
Throws:
TransportException

enableMonitoringService

public void enableMonitoringService()
                             throws TransportException
Throws:
TransportException

disableMonitoringService

public void disableMonitoringService()

getBrokerProperties

public final Properties getBrokerProperties()
Returns:
Returns the brokerProperties.

main

public static void main(String[] args)


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