issrg.editor2
Class PERMISPolicyValidator

java.lang.Object
  extended by issrg.editor2.PERMISPolicyValidator
All Implemented Interfaces:
PolicyValidator

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.

Author:
Christian Azzopardi

Constructor Summary
PERMISPolicyValidator()
           
 
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

PERMISPolicyValidator

public PERMISPolicyValidator()
Method Detail

setDocument

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

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

validateDocument

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
Throws:
a - ValidationException if an error occurs.
ValidationException

createDocument

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


getValidDocument

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
Returns:
A valid PERMIS org.w3c.dom.Document.

getChildElements

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

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