org.simBio.sim.dm
Class ProtocolParser

java.lang.Object
  extended by org.simBio.sim.dm.ProtocolParser
Direct Known Subclasses:
JSProtocolParser

public class ProtocolParser
extends java.lang.Object

Protocol XML-file parser.

Version:
$Id: ProtocolParser.java,v 1.2 2007/11/07 04:57:06 mikaelwing Exp $
Author:
Mikael Wing

Field Summary
protected  org.w3c.dom.Document protocol
           
 
Constructor Summary
ProtocolParser(org.w3c.dom.Document protocolXML)
           
ProtocolParser(java.io.InputStream protocol)
           
 
Method Summary
 java.lang.String getBaseModel()
          Read tag attribute "path" from file protocol.
 java.io.File getCsvRootFile()
          Get CSV-file.
 org.w3c.dom.traversal.NodeIterator getEraser()
          Read tag from file protocol.
 org.w3c.dom.Node getExchanger()
          Read tag from file protocol.
 java.lang.String getGenerateModel()
          Read tag attribute "path" from file protocol.
 java.lang.String getIdentification()
          Read tag attribute "identification" from file protocol.
 org.w3c.dom.traversal.NodeIterator getInserter()
          Read tag from file protocol.
 org.w3c.dom.traversal.NodeIterator getInserterBefore()
          Read tag from file protocol.
 java.lang.String getLauncher()
          Read tag attribute "launch" from file protocol.
 int getMaxThreads()
          Read tag attribute "threads" from file protocol.
 org.w3c.dom.traversal.NodeIterator getMultiplier()
          Read tag from file protocol.
 org.w3c.dom.Node getNormalizeTo()
          Read tag attribute "xpath" from file protocol.
 java.io.InputStream getProtocolAsStream()
          Get protocol as stream.
 java.lang.String getSettings()
          Read tag attribute "settings" from file protocol.
 java.lang.String getTocXML()
          Get Toc XML-file path.
 org.w3c.dom.traversal.NodeIterator getWriter()
          Read tag from file protocol.
 java.io.File getXmlRootDir()
          Get XML root dir.
 org.w3c.dom.traversal.NodeIterator getXpath(java.lang.String xpath)
          Read input parameter xpath from file protocol.
 boolean hasExchanger()
          Check if the protocol file has an exchanger or not.
 void setXmlRootDir()
          Add XML root dir (if exist) to XML-file path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

protocol

protected org.w3c.dom.Document protocol
Constructor Detail

ProtocolParser

public ProtocolParser(java.io.InputStream protocol)
Parameters:
protocol - as InputStream

ProtocolParser

public ProtocolParser(org.w3c.dom.Document protocolXML)
Parameters:
protocolXML - as Document
Method Detail

getProtocolAsStream

public java.io.InputStream getProtocolAsStream()
Get protocol as stream.

Returns:
protocol as stream.

getBaseModel

public java.lang.String getBaseModel()
                              throws java.io.IOException
Read tag attribute "path" from file protocol.

Returns:
nodevalue for path.
Throws:
java.io.IOException

getGenerateModel

public java.lang.String getGenerateModel()
                                  throws java.io.IOException
Read tag attribute "path" from file protocol.

Returns:
nodevalue for path.
Throws:
java.io.IOException

getMaxThreads

public int getMaxThreads()
Read tag attribute "threads" from file protocol.

Returns:
Max number of threads or 1 if not defined.

getLauncher

public java.lang.String getLauncher()
                             throws java.io.IOException
Read tag attribute "launch" from file protocol.

Returns:
nodevalue for launch.
Throws:
java.io.IOException

getEraser

public org.w3c.dom.traversal.NodeIterator getEraser()
                                             throws java.io.IOException
Read tag from file protocol.

Returns:
nodeIterator for eraser.
Throws:
java.io.IOException

getInserter

public org.w3c.dom.traversal.NodeIterator getInserter()
                                               throws java.io.IOException
Read tag from file protocol.

Returns:
nodeIterator for inserter.
Throws:
java.io.IOException

getInserterBefore

public org.w3c.dom.traversal.NodeIterator getInserterBefore()
                                                     throws java.io.IOException
Read tag from file protocol.

Returns:
nodeIterator for insert/before.
Throws:
java.io.IOException

getWriter

public org.w3c.dom.traversal.NodeIterator getWriter()
                                             throws java.io.IOException
Read tag from file protocol.

Returns:
nodeIterator for writer.
Throws:
java.io.IOException

getMultiplier

public org.w3c.dom.traversal.NodeIterator getMultiplier()
                                                 throws java.io.IOException
Read tag from file protocol.

Returns:
nodeIterator for write/multiplier.
Throws:
java.io.IOException

hasExchanger

public boolean hasExchanger()
Check if the protocol file has an exchanger or not.

Returns:
true, when the file has at least one exchanger.

getExchanger

public org.w3c.dom.Node getExchanger()
                              throws java.io.IOException
Read tag from file protocol.

Returns:
node for exchanger.
Throws:
java.io.IOException

getIdentification

public java.lang.String getIdentification()
                                   throws java.io.IOException
Read tag attribute "identification" from file protocol.

Returns:
nodevalue for identification.
Throws:
java.io.IOException

getXmlRootDir

public java.io.File getXmlRootDir()
                           throws java.io.IOException
Get XML root dir.

Returns:
file path for XML.
Throws:
java.io.IOException

setXmlRootDir

public void setXmlRootDir()
Add XML root dir (if exist) to XML-file path. This will give the following path: //


getCsvRootFile

public java.io.File getCsvRootFile()
                            throws java.io.IOException
Get CSV-file.

Returns:
CSV-file.
Throws:
java.io.IOException

getTocXML

public java.lang.String getTocXML()
                           throws java.io.IOException
Get Toc XML-file path.

Returns:
Toc XML-file path.
Throws:
java.io.IOException

getSettings

public java.lang.String getSettings()
                             throws java.io.IOException
Read tag attribute "settings" from file protocol.

Returns:
nodevalue for settings.
Throws:
java.io.IOException

getXpath

public org.w3c.dom.traversal.NodeIterator getXpath(java.lang.String xpath)
                                            throws java.io.IOException
Read input parameter xpath from file protocol.

Parameters:
xpath - string
Returns:
nodeIterator for xpath.
Throws:
java.io.IOException

getNormalizeTo

public org.w3c.dom.Node getNormalizeTo()
                                throws java.io.IOException
Read tag attribute "xpath" from file protocol.

Returns:
node for xpath.
Throws:
java.io.IOException


Copyright © 2002-2008 Cell/Biodinamics simulation project. All Rights Reserved.