verinec.gui
Class VerinecStudio.StudioRepository

java.lang.Object
  extended by verinec.data.repository.VerinecRepository
      extended by verinec.gui.VerinecStudio.StudioRepository
All Implemented Interfaces:
IVerinecRepository
Enclosing class:
VerinecStudio

 class VerinecStudio.StudioRepository
extends VerinecRepository

A repository to interact with the network currently represented in the gui. Note that updates are NOT reflected in the gui! Use new NwHub, new PCNode resp. addNode and the add... methods in PCNode to create new elements or delete elements. Implementation: Relies on the VerinecStudio.repo for handling the lists of other projects.

Author:
david.buchmann at unifr.ch

Field Summary
 
Fields inherited from class verinec.data.repository.VerinecRepository
networks, nodes, projectName, validator
 
Constructor Summary
VerinecStudio.StudioRepository(String name)
          Create the studio repository.
 
Method Summary
 void addPhysicalNetwork(Element e)
          Add a physical_network to the list of physical networks.
 void drop()
          Drop this repository, that is remove all nodes and connections and globals and start with an empty network.
 Element getNodes()
          Overwrite to declare no exception.
 Element getPhysicalNetworks()
          Get the networks data of this project.
 String[] getProjectNames()
          Get the names of all existing projects that can be opened with openProject().
 void setNode(Element node)
          Set a network Node.
 
Methods inherited from class verinec.data.repository.VerinecRepository
getGlobals, getNode, getNodeNames, getNodesWithInterfaceIp, getProjectName, init, removeNode, setGlobals, setNodes, setPhysicalNetworks, validateNetworks, validateNode, validatePhysicalNetworks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VerinecStudio.StudioRepository

public VerinecStudio.StudioRepository(String name)
Create the studio repository.

Parameters:
name - Project name.
Method Detail

getProjectNames

public String[] getProjectNames()
                         throws VerinecException
Get the names of all existing projects that can be opened with openProject(). There is no defined order for the names.

All implementations should also contain a similar method sgetProjectNames which is static, for use in the factory. (As Java does not allow static methods to be declared in an Interface, this feature can not be enforced.)

Returns:
Array of Strings with the names of all existing projects.
Throws:
VerinecException - if some error occurs while trying to collect the project names.

drop

public void drop()
          throws VerinecException
Drop this repository, that is remove all nodes and connections and globals and start with an empty network. This is the same as VerinecStudio.newProject()

Specified by:
drop in interface IVerinecRepository
Overrides:
drop in class VerinecRepository
Throws:
VerinecException - If the project could not be cleaned.

setNode

public void setNode(Element node)
             throws VerinecException
Set a network Node. Do not use this to create new nodes in the gui, rather use VerinecStudio.addNode(int, int).

Specified by:
setNode in interface IVerinecRepository
Overrides:
setNode in class VerinecRepository
Parameters:
node - The Jdom Element of the node.
Throws:
VerinecException - if the node is not valid or can not be stored.

getNodes

public Element getNodes()
Overwrite to declare no exception.

Specified by:
getNodes in interface IVerinecRepository
Overrides:
getNodes in class VerinecRepository
Returns:
The nodes element.
See Also:
VerinecRepository.getNodes()

getPhysicalNetworks

public Element getPhysicalNetworks()
Get the networks data of this project. Returns a copy of the data, to modify use setPhysicalNetworks. todo: What should we do if the network is invalid because a node has been deleted? We do not want to loose the whole network.

Specified by:
getPhysicalNetworks in interface IVerinecRepository
Overrides:
getPhysicalNetworks in class VerinecRepository
Returns:
The networks element, containing the definition of the network of this project.

addPhysicalNetwork

public void addPhysicalNetwork(Element e)
Add a physical_network to the list of physical networks.

Parameters:
e - The network element to add to nw:physical.

Copyright © 2005 Verinec, DIUF