Class PERMISPolicyValidator

  extended by issrg.editor2.PERMISPolicyValidator
All Implemented Interfaces:

public class PERMISPolicyValidator
extends java.lang.Object
implements PolicyValidator

This Class implements the Policy Validator Class Methods. It should verify that an XML document is valid PERMIS XML.

There is scope for this PERMISPolicyValidator Class to be improved upon on the way that it checks if a document is Valid or not.

At the moment it verifies documents by checking that the policy has the basic sub-policy elements in a specific order. If an error is encountered an error message will be displayed.

Further improvements could allow further checking, such as if the attributes of an element are allowed, or if further XML structure is erroneous.

Christian Azzopardi

Constructor Summary
Method Summary
 void createDocument()
          Creates and sets a new valid and empty Document.
static java.lang.String[] getChildElements(org.w3c.dom.Node elem)
          Obtains the Child Elements of a Node.
 org.w3c.dom.Document getValidDocument()
          Method that is used to return a good Valid PERMIS Document.
 void setDocument(org.w3c.dom.Document d)
          The Document to verify is set using this method.
 void validateDocument()
          Method that validates the current Document.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public PERMISPolicyValidator()
Method Detail


public void setDocument(org.w3c.dom.Document d)
The Document to verify is set using this method.

Specified by:
setDocument in interface PolicyValidator
d - Document to be set.


public void validateDocument()
                      throws ValidationException
Method that validates the current Document. This checks that the PERMIS main policy tags are in the correct order.

Specified by:
validateDocument in interface PolicyValidator
a - ValidationException if an error occurs.


public void createDocument()
Creates and sets a new valid and empty Document.


public org.w3c.dom.Document getValidDocument()
Method that is used to return a good Valid PERMIS Document. If there is no current document set, the method calls createDocument() to create one.

After a document is obtained it will add the required tags, to make it valid.

Specified by:
getValidDocument in interface PolicyValidator
A valid PERMIS org.w3c.dom.Document.


public static java.lang.String[] getChildElements(org.w3c.dom.Node elem)
Obtains the Child Elements of a Node. Can be deprecated or improved.

elem - the Node Element to obtain the Child Elements of
String[] An String Array of Child Elements