main.planetSh
Class PlanetshMap

java.lang.Object
  extended by main.planetSh.PlanetshMap
All Implemented Interfaces:
NodeEdgeMap

public class PlanetshMap
extends java.lang.Object
implements NodeEdgeMap

Gets the node infos of a planetlab slice.

Author:
Leo Bosnjak

Field Summary
private static long CACHE_TIME
          The maximum cache time for the NODES_FILE.
private  java.util.ArrayList<Edge> edges
           
private static java.lang.String GEOCITIES_FILE
          The path to the GeoLiteCity database -> property of Maxmind This product includes GeoLite data created by MaxMind, available from http://maxmind.com/
private  java.util.ArrayList<DrawableLabel> labels
           
private  java.util.ArrayList<Node> nodes
           
private static java.lang.String NODES_FILE
          The path to the file to which the list of all the PlanetLab nodes will be cached.
private  PlanetLabMgr planetLabApi
           
private  PlanetLabXmlRpcCaller planetSh
           
private  ScenarioConfig scenarioConfig
           
 
Constructor Summary
PlanetshMap(PlanetLabMgr planetLabApi, ScenarioConfig config)
          Constructs a PlanetshMap Object: - loads the Nodes from a cached file or from PlanetLab - assigns colors to nodes according to their proxy-groups - draws the edges between the group-nodes
 
Method Summary
static Node findNodeOfProxy(java.util.ArrayList<Node> nodes, X2XProxy proxy)
          looks in the node-array for a node with same hostname as proxy
 java.util.ArrayList<Edge> getEdges()
          Returns an ArrayList of Edges that represent pairs PlanetLab of computers and properties of interactions between them.
 java.util.ArrayList<DrawableLabel> getLabels()
          Returns an ArrayList of DrawableLabels that represent text-labels that can be drawn on the map.
 java.util.ArrayList<Node> getNodes()
          Returns an ArrayList of Nodes that represent PlanetLab computers and their properties.
 PlanetLabXmlRpcCaller getPlanetLabCaller()
           
 java.lang.String toString()
          Returns a string representation of the NodeEdgeMap.
private  void updateNodeCache(java.io.File nodesFile)
          Gets all nodes from the PlanetLab-API and caches them in the nodesFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nodes

private java.util.ArrayList<Node> nodes

edges

private java.util.ArrayList<Edge> edges

labels

private java.util.ArrayList<DrawableLabel> labels

GEOCITIES_FILE

private static final java.lang.String GEOCITIES_FILE
The path to the GeoLiteCity database -> property of Maxmind This product includes GeoLite data created by MaxMind, available from http://maxmind.com/

See Also:
Constant Field Values

NODES_FILE

private static final java.lang.String NODES_FILE
The path to the file to which the list of all the PlanetLab nodes will be cached.

See Also:
Constant Field Values

CACHE_TIME

private static final long CACHE_TIME
The maximum cache time for the NODES_FILE.
If the file is older than this value, the program will ask to update it using the PlanetLab Central API.
The default value is set to 14 days, the value itself is counted in miliseconds.

See Also:
Constant Field Values

planetSh

private PlanetLabXmlRpcCaller planetSh

planetLabApi

private PlanetLabMgr planetLabApi

scenarioConfig

private ScenarioConfig scenarioConfig
Constructor Detail

PlanetshMap

public PlanetshMap(PlanetLabMgr planetLabApi,
                   ScenarioConfig config)
            throws java.lang.Exception
Constructs a PlanetshMap Object: - loads the Nodes from a cached file or from PlanetLab - assigns colors to nodes according to their proxy-groups - draws the edges between the group-nodes

Parameters:
planetLabApi -
config -
Throws:
java.lang.Exception
Method Detail

updateNodeCache

private void updateNodeCache(java.io.File nodesFile)
                      throws java.lang.Exception
Gets all nodes from the PlanetLab-API and caches them in the nodesFile

Parameters:
nodesFile -
Throws:
java.lang.Exception

findNodeOfProxy

public static Node findNodeOfProxy(java.util.ArrayList<Node> nodes,
                                   X2XProxy proxy)
looks in the node-array for a node with same hostname as proxy

Parameters:
proxy - - proxy to look for in node-array
Returns:
null if no node matches, the mathching node otherwise

getNodes

public java.util.ArrayList<Node> getNodes()
Description copied from interface: NodeEdgeMap
Returns an ArrayList of Nodes that represent PlanetLab computers and their properties.

Specified by:
getNodes in interface NodeEdgeMap

getEdges

public java.util.ArrayList<Edge> getEdges()
Description copied from interface: NodeEdgeMap
Returns an ArrayList of Edges that represent pairs PlanetLab of computers and properties of interactions between them.

Specified by:
getEdges in interface NodeEdgeMap

getLabels

public java.util.ArrayList<DrawableLabel> getLabels()
Description copied from interface: NodeEdgeMap
Returns an ArrayList of DrawableLabels that represent text-labels that can be drawn on the map.

Specified by:
getLabels in interface NodeEdgeMap

toString

public java.lang.String toString()
Returns a string representation of the NodeEdgeMap.

Overrides:
toString in class java.lang.Object

getPlanetLabCaller

public PlanetLabXmlRpcCaller getPlanetLabCaller()
Returns:
the planetSh