peer2me.message
Class SendableNodeInfo

java.lang.Object
  extended by peer2me.message.SendableNodeInfo
All Implemented Interfaces:
Serializable

public class SendableNodeInfo
extends java.lang.Object
implements Serializable

This class implements the interface Serializable and is used by the framework to send information about all the nodes in the network. This class is used as a linked list, since it also contains an instance of itself. This enables the framework to iterate through the class easily. SendableNodeInfo is used by the classes BluetoothListener and BluetoothSearcher Should only be used by the framework itself

Author:
saxlund
See Also:
Serializable

Constructor Summary
SendableNodeInfo()
          Required default constructor so that the class ObjectInputStream can instanciate the class
SendableNodeInfo(java.lang.String nodeName, java.lang.String nodeAddress, java.lang.String connectionURL, java.lang.String pingConnectionURL)
          Constructor
 
Method Summary
 void deSerialize(java.io.DataInputStream dis, java.util.Stack stack)
          Method required by the interface Serializable.
 java.lang.String getConnectionURL()
          Returns the connectionURL of the node in this class
 SendableNodeInfo getNextNode()
          Returns the next node in the linked list if there is one
 java.lang.String getNodeAddress()
          Returns the address to this node
 java.lang.String getNodeName()
          Returns the name to this node
 java.lang.String getPingConnectionUrl()
          Returns the pingConnectionURL of the node in this class
 void serialize(java.io.DataOutputStream dos, java.util.Stack stack)
          Method required by the interface Serializable.
 void setConnectionURL(java.lang.String connectionURL)
          Sets the connectionURL of the node in this class
 void setNextNode(SendableNodeInfo nextNode)
          Sets the next node in the linked list
 void setNodeAddress(java.lang.String nodeAddress)
          Sets the address of this node
 void setNodeName(java.lang.String nodeName)
          Sets the name of this node
 void setPingConnectionUrl(java.lang.String pingConnectionUrl)
          Sets the pingConnectionURL of the node in this class
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SendableNodeInfo

public SendableNodeInfo()
Required default constructor so that the class ObjectInputStream can instanciate the class


SendableNodeInfo

public SendableNodeInfo(java.lang.String nodeName,
                        java.lang.String nodeAddress,
                        java.lang.String connectionURL,
                        java.lang.String pingConnectionURL)
Constructor

Parameters:
nodeName - The name of the node
nodeAddress - The address of the node
connectionURL - The URL which another node has to use in order to connect to the given node
pingConnectionURL - The URL which another node has to use in order to ping the given node
Method Detail

getConnectionURL

public java.lang.String getConnectionURL()
Returns the connectionURL of the node in this class

Returns:
The connectionURL of the node in this class

getNodeAddress

public java.lang.String getNodeAddress()
Returns the address to this node

Returns:
The address to this node

getNodeName

public java.lang.String getNodeName()
Returns the name to this node

Returns:
The name to this node

deSerialize

public void deSerialize(java.io.DataInputStream dis,
                        java.util.Stack stack)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException,
                        java.lang.IllegalAccessException,
                        java.lang.InstantiationException
Method required by the interface Serializable. Deserializes the datainputstream to a SendableNodeInfo object.

Specified by:
deSerialize in interface Serializable
Throws:
java.io.IOException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException

serialize

public void serialize(java.io.DataOutputStream dos,
                      java.util.Stack stack)
               throws java.io.IOException
Method required by the interface Serializable. Before an instance of this class can be sent over the network, it must first be serialized. This method writes the content of this class to the dataoutputstream given in the first parameter of this method.

Specified by:
serialize in interface Serializable
Throws:
java.io.IOException

getNextNode

public SendableNodeInfo getNextNode()
Returns the next node in the linked list if there is one

Returns:
The next node. If the next node is null, then null is returned

setNextNode

public void setNextNode(SendableNodeInfo nextNode)
Sets the next node in the linked list

Parameters:
nextNode - The node that will be the next node in the list

setConnectionURL

public void setConnectionURL(java.lang.String connectionURL)
Sets the connectionURL of the node in this class

Parameters:
connectionURL - The URL that must be used to connect to the node in this class

setNodeAddress

public void setNodeAddress(java.lang.String nodeAddress)
Sets the address of this node

Parameters:
nodeAddress - The address of this node

setNodeName

public void setNodeName(java.lang.String nodeName)
Sets the name of this node

Parameters:
nodeName - The name of this node

getPingConnectionUrl

public java.lang.String getPingConnectionUrl()
Returns the pingConnectionURL of the node in this class

Returns:
The pingConnectionURL of the node in this class

setPingConnectionUrl

public void setPingConnectionUrl(java.lang.String pingConnectionUrl)
Sets the pingConnectionURL of the node in this class

Parameters:
pingConnectionUrl - of the node in this class