|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectverinec.data.repository.VerinecRepository
public abstract class VerinecRepository
Abstract class implementing bases for the repository. IVerinecRepository implementors can inherit from this class to save some coding. Bases on a xml document containing all nodes. Classes using this base must make sure to always call super methods for all modifying operations or some methods will operate on outdated information.
| Field Summary | |
|---|---|
private Logger |
logger
|
protected Element |
networks
The network data. |
protected Document |
nodes
The document containing the nodes. |
protected String |
projectName
The name of the currently opened project. |
protected SchemaValidator |
validator
Validator to check nodes and network before saving and after loading. |
| Constructor Summary | |
|---|---|
VerinecRepository(String project)
Constructor for the base repository class. |
|
| Method Summary | |
|---|---|
void |
drop()
Drop network, that is remove all network connections and nodes information. |
Element |
getGlobals()
Get the globals of the currently active project. |
Element |
getNode(String name)
Get a network Node. |
String[] |
getNodeNames()
Query all existing node names. |
Element |
getNodes()
Get all nodes. |
List |
getNodesWithInterfaceIp(String ip)
Get all nodes having a network interface with the specified ip. |
Element |
getPhysicalNetworks()
Get the list of physical connections of this project. |
String |
getProjectName()
This method is implemented here because normally, concrete implementations won't need added behaviour. |
protected void |
init()
Initialise the nodes and networks variables with empty xml. |
void |
removeNode(String name)
Remove the node, that is detach it from nodes. |
void |
setGlobals(Element e)
Set new globals, overwriting the existing ones. |
void |
setNode(Element node)
Set a network Node. |
void |
setNodes(Element newnodes)
Overwrite all nodes and global values. |
void |
setPhysicalNetworks(Element physical)
Set the physical networks of this project. |
protected void |
validateNetworks(Element networks)
Tests a networks document for validity. |
protected void |
validateNode(Element node)
Validate a node using the SchemaValidator. |
protected void |
validatePhysicalNetworks(Element physical)
Tests a physical network for validity. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface verinec.data.repository.IVerinecRepository |
|---|
getProjectNames |
| Field Detail |
|---|
private Logger logger
protected Document nodes
protected String projectName
protected SchemaValidator validator
protected Element networks
| Constructor Detail |
|---|
public VerinecRepository(String project)
project - The name of the project to open.| Method Detail |
|---|
protected void init()
public String getProjectName()
throws VerinecException
projectName.
getProjectName in interface IVerinecRepositoryVerinecException - if the project is not valid.
public void drop()
throws VerinecException
drop in interface IVerinecRepositoryVerinecException - If extending class runs into a problem.public String[] getNodeNames()
getNodeNames in interface IVerinecRepository
public Element getNode(String name)
throws VerinecException
getNode in interface IVerinecRepositoryname - Name of network node to retreived.
VerinecException - If no node with that name exists in this project or if the stored node is invalid.
public List getNodesWithInterfaceIp(String ip)
throws VerinecException
getNodesWithInterfaceIp in interface IVerinecRepositoryip - The ip address.
VerinecException - if anything goes wrong with xpath.
public void setNode(Element node)
throws VerinecException
setNode in interface IVerinecRepositorynode - 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 IVerinecRepositoryname - of node to remove.
VerinecException - if the node can not be found.
public Element getNodes()
throws VerinecException
getNodes in interface IVerinecRepositoryVerinecException - if one of the nodes can not be retreived.
public void setNodes(Element newnodes)
throws VerinecException
setNodes in interface IVerinecRepositorynewnodes - Element containing all node elements of the projects and global data.
VerinecException - if one of the nodes can not be set.
public void setGlobals(Element e)
throws VerinecException
setGlobals in interface IVerinecRepositorye - The nodes element with the new globals. Node children are ignored.
VerinecException - if the parameter is not a valid nodes tag or other error occurs.
public Element getGlobals()
throws VerinecException
getGlobals in interface IVerinecRepositoryVerinecException - if invalid database prevents returning the globals of project this repository is set to.
public Element getPhysicalNetworks()
throws VerinecException
getPhysicalNetworks in interface IVerinecRepositoryVerinecException - if the stored file can not be read properly.
public void setPhysicalNetworks(Element physical)
throws VerinecException
setPhysicalNetworks in interface IVerinecRepositoryphysical - The new physical network definition for this project. It is cloned so the original parameter remains unchanged.
VerinecException - if the networks can not be stored.
protected void validateNode(Element node)
throws VerinecException
node - The node to be validated.
VerinecException - if validation fails.
protected void validateNetworks(Element networks)
throws VerinecException
networks - The network to validate.
VerinecException - if validation fails.
protected void validatePhysicalNetworks(Element physical)
throws VerinecException
physical - The network to validate.
VerinecException - if validation fails.
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||