|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectverinec.data.repository.VerinecRepository
verinec.data.repository.FileRepository
public class FileRepository
Implementation of the IRepository for using the file system to store nodes and network definition.
The base directory can be defined by setting the property verinec.data.repository.file_basedir If this property is not set, defaults to ./data
Creates a directory for each project. The project dir contains a
nodes subdir for the nodes and a file networks.xml for the
networks.
The xml is parsed using a jdom SAXBuilder and written using jdom XMLOutputter.
| Field Summary | |
|---|---|
private static File |
fileRoot
The directory under which the project directories are created. |
private static String |
GLOBALS_FILE
Filename for the globals definitions. |
private File |
globalsFile
The globals data file, created from GLOBALS_FILE. |
private Logger |
log
|
private static String |
NETWORKS_FILE
Filename for the network definitions. |
private File |
networksFile
The network data file, created from NETWORKS_FILE. |
private static String |
NODES_DIRECTORY
Directory name for the nodes xml files. |
private File |
nodesDir
The nodes directory, created from NODES_DIRECTORY. |
private File |
projectDir
The project directory, created from fileRoot and projectName parameter in constructor. |
private static XMLOutputter |
xmloutput
The jdom XMLOutputter to write xml files. |
| Fields inherited from class verinec.data.repository.VerinecRepository |
|---|
networks, nodes, projectName, validator |
| Constructor Summary | |
|---|---|
FileRepository(String projectName)
Create a file repository for the given projectName. |
|
| Method Summary | |
|---|---|
void |
drop()
Drop this repository, that is delete all data associated with it. |
private File |
fileFromNodename(String name)
Encapsulates how the filename is determined for some node. |
Element |
getGlobals()
Get the nodes tag with only the global variables and eventual metadata from other namespaces, but no node children. |
String[] |
getProjectNames()
Get the names of all existing projects that can be opened with openProject() This method just redirects to the sgetProjectNames method. |
void |
removeNode(String name)
Remove an existing node from the configuration. |
void |
setGlobals(Element globals)
Set the global elements without touching the nodes. |
void |
setNode(Element node)
Set a network Node. |
void |
setPhysicalNetworks(Element physical)
Set the networks of this project. |
static String[] |
sgetProjectNames()
Get the names of all existing projects. |
| Methods inherited from class verinec.data.repository.VerinecRepository |
|---|
getNode, getNodeNames, getNodes, getNodesWithInterfaceIp, getPhysicalNetworks, getProjectName, init, setNodes, validateNetworks, validateNode, validatePhysicalNetworks |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final String NODES_DIRECTORY
private static final String NETWORKS_FILE
private static final String GLOBALS_FILE
private static final File fileRoot
private Logger log
private final File projectDir
fileRoot and projectName parameter in constructor.
private final File nodesDir
NODES_DIRECTORY.
NODES_DIRECTORYprivate final File networksFile
NETWORKS_FILE.
NETWORKS_FILEprivate final File globalsFile
GLOBALS_FILE.
GLOBALS_FILEprivate static final XMLOutputter xmloutput
| Constructor Detail |
|---|
public FileRepository(String projectName)
throws VerinecException
projectName - Name of the project, interpreted as directory name under fileRoot.
VerinecException - If the file repository can not be instantiated.| Method Detail |
|---|
public String[] getProjectNames()
sgetProjectNames().public static String[] sgetProjectNames()
public void drop()
throws VerinecException
drop in interface IVerinecRepositorydrop in class VerinecRepositoryVerinecException - If deleting the repository fails.private File fileFromNodename(String name)
name - The name of the node to create a file for.
public void setNode(Element node)
throws VerinecException
setNode in interface IVerinecRepositorysetNode in class VerinecRepositorynode - The Jdom Element of the node.
VerinecException - If the node is invalid or an io error occurs.
public void removeNode(String name)
throws VerinecException
removeNode in interface IVerinecRepositoryremoveNode in class VerinecRepositoryname - The node name to remove. It is an error to pass a nonexisting name.
VerinecException - if the node is not existing.
public void setGlobals(Element globals)
throws VerinecException
setGlobals in interface IVerinecRepositorysetGlobals in class VerinecRepositoryglobals - A nodes tag with all elements that shoud be global.
VerinecException - if the parameter is not a valid nodes tag or io error occur.
public Element getGlobals()
throws VerinecException
getGlobals in interface IVerinecRepositorygetGlobals in class VerinecRepositoryVerinecException - if the stored file can not be read properly.
public void setPhysicalNetworks(Element physical)
throws VerinecException
setPhysicalNetworks in interface IVerinecRepositorysetPhysicalNetworks in class VerinecRepositoryphysical - Element "physical" containing the physical network definitions.
VerinecException - if the parameter is not a valid networks tag or io error occur.
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||