org.w3c.mwi.mobileok.basic
Class PreprocessorResults

java.lang.Object
  extended by org.w3c.mwi.mobileok.basic.PreprocessorResults

public final class PreprocessorResults
extends java.lang.Object

Encapsulates the moki representation of a primary Web resource and of all the Web resources it might import, embed, or link to.

The moki representation of a resource follows the moki schema.

The class in itself mostly defines getters and setters to internal fields. These fields could have different meanings depending on the use of the class. The class methods descriptions explain how these fields are used within the mobileOK Checker.

Version:
$Revision: 1.1 $
Author:
The W3C mobileOK Checker Task Force
See Also:
Preprocessor

Field Summary
private  org.w3c.dom.Document mokiDocument
          The moki representation of this instance.
private  java.util.List<Resource> resources
          Pointer to the list of resources that are at the source of the moki representation.
private  org.w3c.dom.Document saxonMokiDocument
          The moki representation of this instance that takes advantage of a few features of Saxon (e.g.
 
Constructor Summary
PreprocessorResults(java.util.List<Resource> resources)
          Creates a PreprocessorResults instance associated with the given list of resources.
 
Method Summary
private  org.w3c.dom.Document buildMokiDocument()
          Creates the moki representation of the resource using all the information contained in this instance.
private  java.lang.String getLocalHostIP()
          Static helper method that returns the IP address of localhost.
 org.w3c.dom.Document getMokiDocument()
          Returns the moki representation of the resource.
 org.w3c.dom.Document getSaxonMokiDocument()
          Returns the moki representation of the resource built specifically to take advantage of features of Saxon, and typically the possibility to keep line numbers even when the document is represented as a DOM tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resources

private final java.util.List<Resource> resources
Pointer to the list of resources that are at the source of the moki representation.


mokiDocument

private org.w3c.dom.Document mokiDocument
The moki representation of this instance.


saxonMokiDocument

private org.w3c.dom.Document saxonMokiDocument
The moki representation of this instance that takes advantage of a few features of Saxon (e.g. line numbering).

Constructor Detail

PreprocessorResults

public PreprocessorResults(java.util.List<Resource> resources)
Creates a PreprocessorResults instance associated with the given list of resources.

The list should contain one resource identified as ResourceContext.Primary. If it contains more than one primary resources, the first one in the list will be used as the primary resource for the moki document.

Parameters:
resources - list of resources to represent in the moki document
Method Detail

getMokiDocument

public org.w3c.dom.Document getMokiDocument()
                                     throws TestException
Returns the moki representation of the resource.

Returns:
the moki DOM document that represents the resource.
Throws:
TestException - an unexpected error occurred while building the document.

getSaxonMokiDocument

public org.w3c.dom.Document getSaxonMokiDocument()
                                          throws TestException
Returns the moki representation of the resource built specifically to take advantage of features of Saxon, and typically the possibility to keep line numbers even when the document is represented as a DOM tree.

Returns:
the moki for Saxon representation of the resource
Throws:
TestException - an unexpected error occurred while building the document.

getLocalHostIP

private java.lang.String getLocalHostIP()
Static helper method that returns the IP address of localhost.

Returns:
the IP address of localhost, e.g. 127.0.0.1.

buildMokiDocument

private org.w3c.dom.Document buildMokiDocument()
                                        throws TestException
Creates the moki representation of the resource using all the information contained in this instance.

Returns:
the moki DOM document representing the resource.
Throws:
TestException - an unexpected error occurred while building the document.