main.planetSh
Class PlanetshVisualizer

java.lang.Object
  extended by main.Visualizer
      extended by main.planetSh.PlanetshVisualizer

public class PlanetshVisualizer
extends Visualizer

The PlanetshVisualizer class reads in an inputfile and runs the GenerateMap that is passed in to create the map object.

Author:
Leo Bosnjak

Field Summary
private  java.lang.String description
           
private  DrawingParameters edgeParameters
           
private  InputFileParser fileParser
           
private  GenerateMap generateMap
           
private  ImageParameters imageParameters
           
private  NodeEdgeMap map
           
private  boolean mapCreated
           
private  java.lang.String mapViewFileName
           
private  DrawingParameters nodeParameters
           
private  PlanetLabMgr planetLabApi
           
private  ScenarioConfig scenarioConfig
           
 
Fields inherited from class main.Visualizer
CONFIG_FILE_EXT, CONFIGS_DIR, PICTURES_DIR, VIEWS_DIR
 
Constructor Summary
PlanetshVisualizer(java.lang.String inputFileName, GenerateMap generateMap, PlanetLabMgr planetLabApi, ScenarioConfig config)
          Initializes the PlanetshVisualizer, which manages the specified map generator to generate a map.
 
Method Summary
 void createMap()
          does nothing
static java.util.Vector<java.lang.String> getAvailableViews(boolean withFileExt)
          Lists all available view files in the VIEWS_DIR and returns their names.
 GenerateMap getGenerateMap()
           
 NodeEdgeMap getMap()
           
 java.lang.String getMapViewFileName(boolean withFileExt)
           
 boolean isMapCreated()
           
 void loadGenerateMapParameters(java.lang.String inputFileName)
          Loads the contents of the inputFileName.
private  void reassignNodesAndEdges()
          uses the scenario-config data to generate the edges and to assign node colors
 void setMapCreated(boolean mapCreated)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapCreated

private boolean mapCreated

fileParser

private InputFileParser fileParser

nodeParameters

private DrawingParameters nodeParameters

edgeParameters

private DrawingParameters edgeParameters

imageParameters

private ImageParameters imageParameters

map

private NodeEdgeMap map

description

private java.lang.String description

planetLabApi

private PlanetLabMgr planetLabApi

scenarioConfig

private ScenarioConfig scenarioConfig

generateMap

private GenerateMap generateMap

mapViewFileName

private java.lang.String mapViewFileName
Constructor Detail

PlanetshVisualizer

public PlanetshVisualizer(java.lang.String inputFileName,
                          GenerateMap generateMap,
                          PlanetLabMgr planetLabApi,
                          ScenarioConfig config)
                   throws java.io.FileNotFoundException,
                          java.io.IOException,
                          java.text.ParseException,
                          java.lang.Exception
Initializes the PlanetshVisualizer, which manages the specified map generator to generate a map.

Parameters:
inputFileName - a String that is the input file's name
generateMap - a GenerateMap that specifies how to draw the map
Throws:
java.io.IOException - if there's an error opening or reading a file
java.io.FileNotFoundException - if a file is not found
java.text.ParseException - if a parse error occurs
java.lang.Exception
See Also:
Visualizer
Method Detail

getAvailableViews

public static java.util.Vector<java.lang.String> getAvailableViews(boolean withFileExt)
Lists all available view files in the VIEWS_DIR and returns their names.

Parameters:
withFileExt - - if true, the names will contain the file extensions, otherwise the names will be returned without file extension.
Returns:
Vector - the available view-files (with or without extension)

loadGenerateMapParameters

public void loadGenerateMapParameters(java.lang.String inputFileName)
                               throws java.io.FileNotFoundException,
                                      java.io.IOException,
                                      java.text.ParseException
Loads the contents of the inputFileName. The inputFile describes the map which is used to draw the PlanetLab nodes upon. The loaded parameters are used to create the map.

Parameters:
inputFileName -
Throws:
java.io.FileNotFoundException
java.io.IOException
java.text.ParseException
See Also:
Visualizer

createMap

public void createMap()
               throws java.io.IOException,
                      java.io.FileNotFoundException,
                      java.text.ParseException
Description copied from class: Visualizer
does nothing

Overrides:
createMap in class Visualizer
Throws:
java.io.IOException - if there's an error opening or reading a file
java.io.FileNotFoundException - if a file is not found
java.text.ParseException - if a parse error occurs

reassignNodesAndEdges

private void reassignNodesAndEdges()
uses the scenario-config data to generate the edges and to assign node colors


getMap

public NodeEdgeMap getMap()
Overrides:
getMap in class Visualizer
Returns:
the map

getGenerateMap

public GenerateMap getGenerateMap()
Overrides:
getGenerateMap in class Visualizer
Returns:
the generateMap

isMapCreated

public boolean isMapCreated()
Returns:
the mapCreated

setMapCreated

public void setMapCreated(boolean mapCreated)
Parameters:
mapCreated - the mapCreated to set

getMapViewFileName

public java.lang.String getMapViewFileName(boolean withFileExt)
Returns:
the mapViewFileName