graphServer.graph
Class P2PGraph

java.lang.Object
  extended by graphServer.graph.P2PGraph
All Implemented Interfaces:
UDPListener

public class P2PGraph
extends java.lang.Object
implements UDPListener

P2PGraph maintains the P2PNetworkGraph and log events received from the UDP Connection.

Version:
Date: 18/07/2011
Author:
Matthew Smith

Field Summary
static long EPOCH
           
 
Constructor Summary
P2PGraph()
          Construct the P2PGraph Sets up the graph and lists/tables for storing and handling UDP Messages.
 
Method Summary
 java.lang.String createCurrentGraphDocument()
          Creates a String with the graph information at the current network time.
 java.lang.String createLogEventDocument(long time)
          Iterates over the list of log events and creates a String containing all the log events after the passed time.
 java.lang.String getCurrentGraph()
          Creates a String with the graph information at the current network time.
 java.lang.String getDebugInfo()
          Returns a String with debug information about the P2P Graph.
 java.lang.String getDocumentInfo()
          Returns a String with information on all the documents that are ever published.
 java.lang.String getLogEventsAfter(long time)
          Creates a String with all the log events after the passed time.
 java.lang.String getPeerInfo()
          Returns a String with information on all the peers who ever come online.
 java.lang.String getQueryHitInfo()
          Returns a String with information on all the query hits.
 java.lang.String getQueryInfo()
          Returns a String with information on all the queries ever placed.
 java.lang.String getQueryOutputInfo()
          Returns a String with information on all queryies placed and their Identifers Contains HTML attributes for being displayed in a browser.
 void receiveMessage(java.net.DatagramPacket receivePacket)
          Receive and handle a packet from the UDP Connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EPOCH

public static final long EPOCH
See Also:
Constant Field Values
Constructor Detail

P2PGraph

public P2PGraph()
Construct the P2PGraph Sets up the graph and lists/tables for storing and handling UDP Messages.

Method Detail

createCurrentGraphDocument

public java.lang.String createCurrentGraphDocument()
Creates a String with the graph information at the current network time. Formatted as XML for use with spiderweb visualizer.

Returns:
The XML document containing all vertices and edges of the graph, as a String.

createLogEventDocument

public java.lang.String createLogEventDocument(long time)
Iterates over the list of log events and creates a String containing all the log events after the passed time. Formatted as XML for use with spiderweb visualizer.

Parameters:
time - the time for which to get log events after.
Returns:
The XML document containing the log events, as a string.

getLogEventsAfter

public java.lang.String getLogEventsAfter(long time)
Creates a String with all the log events after the passed time. Formatted as XML for use with spiderweb visualizer.

Returns:
The XML document containing the log events, as a string.

getCurrentGraph

public java.lang.String getCurrentGraph()
Creates a String with the graph information at the current network time. Formatted as XML for use with spiderweb visualizer.

Returns:
The XML document containing the graph, as a string.

getDebugInfo

public java.lang.String getDebugInfo()
Returns a String with debug information about the P2P Graph. Contains HTML attributes for being displayed in a browser.

Returns:
HTML String with debug information.

getPeerInfo

public java.lang.String getPeerInfo()
Returns a String with information on all the peers who ever come online. Contains HTML attributes for being displayed in a browser.

Returns:
HTML String with peer information.

getQueryOutputInfo

public java.lang.String getQueryOutputInfo()
Returns a String with information on all queryies placed and their Identifers Contains HTML attributes for being displayed in a browser.

Returns:
HTML String with query output information.

getDocumentInfo

public java.lang.String getDocumentInfo()
Returns a String with information on all the documents that are ever published. Contains HTML attributes for being displayed in a browser.

Returns:
HTML String with document information.

getQueryInfo

public java.lang.String getQueryInfo()
Returns a String with information on all the queries ever placed. Contains HTML attributes for being displayed in a browser.

Returns:
HTML String with query information.

getQueryHitInfo

public java.lang.String getQueryHitInfo()
Returns a String with information on all the query hits. Contains HTML attributes for being displayed in a browser.

Returns:
HTML String with all query hit information.

receiveMessage

public void receiveMessage(java.net.DatagramPacket receivePacket)
Description copied from interface: UDPListener
Receive and handle a packet from the UDP Connection.

Specified by:
receiveMessage in interface UDPListener
Parameters:
receivePacket - The Packet received through the UDP connection.