cgl.narada.topology.viewer
Class Node

java.lang.Object
  extended by cgl.narada.topology.viewer.Node
Direct Known Subclasses:
Cluster, SCluster, SSCluster, VirtualNode

public class Node
extends Object

This class represents a node(broker node) in the system. It stores and operates on all the information required for a node.


Field Summary
 List clients
           
static int INVALID_VALUE
           
 int nodeId
           
 Position nodeLocation
           
 int parentClusterId
           
 int parentSClusterId
           
 int parentSSClusterId
           
 
Constructor Summary
Node()
          Empty Constructor.
Node(int nodeId, int pClusterId, int pSClusterId, int pSSClusterId)
          Constructor, initializes the components constituting the node Address
 
Method Summary
 void addClient(int clientId, String clientType)
          Adds a client to the broker node.
 void addTopic(int clientId, String topic)
          Adds a topic requested by the specified client to the broker node.
 boolean canFitOnPanel(int limitX1, int limitY1, int limitX2, int limitY2)
          Depending upon the location of the node and screen limits, returns true if whole or part of the node is visible on the screen otherwise returns false.
 void deleteAllClients()
          Deletes all the clients associated with this broker node.
 void deleteAllTopics(int clientId)
          Deletes all the topics requested by a specified client.
 void deleteClient(int clientId)
          Deletes the specified client associated with the broker node.
 void deleteTopic(int clientId, String topic)
          Deletes the specified topic from the specified client associated with the broker node.
 void drawNode(Graphics g, int limitX1, int limitY1, int limitX2, int limitY2)
          Draws a filled circle representing this node on the screen.
 List getAllClients()
          Gets all the Subscription objects associated with all the clients for this node.
 Subscription getClient(int clientId)
          Gets a Subscription object corresponding to the specified client id.
 String getNodeAddress()
          Returns String representation of node address (eg.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_VALUE

public static int INVALID_VALUE

nodeId

public int nodeId

parentClusterId

public int parentClusterId

parentSClusterId

public int parentSClusterId

parentSSClusterId

public int parentSSClusterId

clients

public List clients

nodeLocation

public Position nodeLocation
Constructor Detail

Node

public Node()
Empty Constructor.


Node

public Node(int nodeId,
            int pClusterId,
            int pSClusterId,
            int pSSClusterId)
Constructor, initializes the components constituting the node Address

Parameters:
nodeId - id of a node.
pClusterId - id of a cluster containg the node.
pSClusterId - id of a super cluster containg the node.
pSSClusterId - id of a super super cluster containg the node.
Method Detail

canFitOnPanel

public boolean canFitOnPanel(int limitX1,
                             int limitY1,
                             int limitX2,
                             int limitY2)
Depending upon the location of the node and screen limits, returns true if whole or part of the node is visible on the screen otherwise returns false.

Parameters:
limitX1 - lower limit for X-coordinate
limitY1 - lower limit for Y-coordinate
limitX2 - upper limit for X-coordinate
limitY2 - upper limit for Y-coordinate
Returns:
true if whole or part of the node is visible on the screen otherwise returns false.

drawNode

public void drawNode(Graphics g,
                     int limitX1,
                     int limitY1,
                     int limitX2,
                     int limitY2)
Draws a filled circle representing this node on the screen. Color and Position of the node is decided by the nodeLocation object.

Parameters:
g - Graphics object for image drawing.
limitX1 - lower limit for X-coordinate
limitY1 - lower limit for Y-coordinate
limitX2 - upper limit for X-coordinate
limitY2 - upper limit for Y-coordinate

getClient

public Subscription getClient(int clientId)
Gets a Subscription object corresponding to the specified client id.

Parameters:
clientId - id of a client
Returns:
Subscription object associated with the client id.

getAllClients

public List getAllClients()
Gets all the Subscription objects associated with all the clients for this node.

Returns:
List of Subscription objects.

addClient

public void addClient(int clientId,
                      String clientType)
Adds a client to the broker node.

Parameters:
clientId - id of a client.
clientType - type of a client.

addTopic

public void addTopic(int clientId,
                     String topic)
              throws TopologyException
Adds a topic requested by the specified client to the broker node.

Parameters:
clientId - id of a client for which topic needs to be added.
topic - String representation of the topic to be added
Throws:
TopologyException

deleteTopic

public void deleteTopic(int clientId,
                        String topic)
                 throws TopologyException
Deletes the specified topic from the specified client associated with the broker node.

Parameters:
clientId - id of the client whose topic is being deleted.
topic - to be deleted.
Throws:
TopologyException - if the specified client is not found with this broker node.

deleteAllTopics

public void deleteAllTopics(int clientId)
                     throws TopologyException
Deletes all the topics requested by a specified client.

Parameters:
clientId - id of a client whose topics are being deleted.
Throws:
TopologyException - if the specified client is not found with this broker node.

deleteClient

public void deleteClient(int clientId)
                  throws TopologyException
Deletes the specified client associated with the broker node.

Parameters:
clientId - id of a client being deleted.
Throws:
TopologyException - if the specified client is not found.

deleteAllClients

public void deleteAllClients()
Deletes all the clients associated with this broker node.


getNodeAddress

public String getNodeAddress()
Returns String representation of node address (eg. 1.2.3.4)

Returns:
String representation of node address.


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