fi.helsinki.dacopan.pef
Class XMLProtocolEventsReader

java.lang.Object
  extended by fi.helsinki.dacopan.pef.XMLProtocolEventsReader
All Implemented Interfaces:
ProtocolEventsReader, org.xml.sax.EntityResolver

public class XMLProtocolEventsReader
extends java.lang.Object
implements ProtocolEventsReader, org.xml.sax.EntityResolver

The default, DOM-based implementation of the PEF reader.

Version:
$Id: XMLProtocolEventsReader.java,v 1.18 2005/04/15 11:40:53 pamietti Exp $

Field Summary
protected  org.w3c.dom.Document document
          source DOM document used to populate the view
static java.lang.String DTD_RESOURCE
          the classpath resource where the DTD should reside
static java.lang.String DTD_SYSTEM_ID
          system id of the DTD that PEF instances should use
protected  DataView view
          the view to be populated
 
Constructor Summary
XMLProtocolEventsReader()
           
 
Method Summary
protected  float getFloatAttribute(org.w3c.dom.Node node, java.lang.String name)
          Returns the attribute value as a float.
protected  long getId(org.w3c.dom.Node node)
          Returns the id value of the given node.
protected  long getId(org.w3c.dom.Node node, java.lang.String name)
          Returns the id value of the given attribute of the given node.
protected  long[] getIdRefs(org.w3c.dom.Node node, java.lang.String name)
          Gets IDREFS in an array.
protected  int getIntegerAttribute(org.w3c.dom.Node node, java.lang.String name)
          Returns the attribute value as an integer.
protected  java.lang.String getStringAttribute(org.w3c.dom.Node node, java.lang.String name)
          Returns the value of the attribute with the given name.
protected  java.lang.String getText(org.w3c.dom.Node node)
          Returns the text content of the given node.
protected  org.w3c.dom.Document parseDocument(java.io.Reader reader)
          Parses the contents of the reader to a DOM document.
protected  void processFlows()
           
protected  void processHosts()
           
protected  void processLayersAndProtocols()
           
protected  void processLinks()
           
protected  void processUnits(ProgressIndicator indicator)
           
protected  void processVariables()
           
 void read(java.io.Reader reader, DataView view)
           
 void read(java.io.Reader reader, DataView view, ProgressIndicator indicator)
          Reads in the contents of the reader and notifies the given indicator of any progress being made.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Provides special resolving for the PEF DTD: it is loaded from the classpath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DTD_SYSTEM_ID

public static final java.lang.String DTD_SYSTEM_ID
system id of the DTD that PEF instances should use

See Also:
Constant Field Values

DTD_RESOURCE

public static final java.lang.String DTD_RESOURCE
the classpath resource where the DTD should reside

See Also:
Constant Field Values

document

protected org.w3c.dom.Document document
source DOM document used to populate the view


view

protected DataView view
the view to be populated

Constructor Detail

XMLProtocolEventsReader

public XMLProtocolEventsReader()
Method Detail

read

public void read(java.io.Reader reader,
                 DataView view)

read

public void read(java.io.Reader reader,
                 DataView view,
                 ProgressIndicator indicator)
Reads in the contents of the reader and notifies the given indicator of any progress being made.

Specified by:
read in interface ProtocolEventsReader
Parameters:
reader - source of data
view - target of data
indicator - progress indicator (optional, can be null)

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
Provides special resolving for the PEF DTD: it is loaded from the classpath.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Throws:
org.xml.sax.SAXException
java.io.IOException

parseDocument

protected org.w3c.dom.Document parseDocument(java.io.Reader reader)
Parses the contents of the reader to a DOM document.


processHosts

protected void processHosts()

processFlows

protected void processFlows()

processLinks

protected void processLinks()

processLayersAndProtocols

protected void processLayersAndProtocols()

processVariables

protected void processVariables()

processUnits

protected void processUnits(ProgressIndicator indicator)

getId

protected long getId(org.w3c.dom.Node node)
Returns the id value of the given node.


getId

protected long getId(org.w3c.dom.Node node,
                     java.lang.String name)
Returns the id value of the given attribute of the given node.


getStringAttribute

protected java.lang.String getStringAttribute(org.w3c.dom.Node node,
                                              java.lang.String name)
Returns the value of the attribute with the given name.


getIdRefs

protected long[] getIdRefs(org.w3c.dom.Node node,
                           java.lang.String name)
Gets IDREFS in an array.


getIntegerAttribute

protected int getIntegerAttribute(org.w3c.dom.Node node,
                                  java.lang.String name)
Returns the attribute value as an integer.


getFloatAttribute

protected float getFloatAttribute(org.w3c.dom.Node node,
                                  java.lang.String name)
Returns the attribute value as a float.


getText

protected java.lang.String getText(org.w3c.dom.Node node)
Returns the text content of the given node.



© Dacopan2 team, 2005-