Last update: 2011-06-23

org.proteios.io.mzdata
Class MzDataImpCommon

java.lang.Object
  extended by org.proteios.io.mzdata.MzDataImpCommon
Direct Known Subclasses:
MzDataImpCommonDc

public class MzDataImpCommon
extends Object

This class supports import of mzData files into Proteios. It contains common attributes and methods, and is intended to be the parent class for other classes that process an XML block in an mzData file. An mzData file contains information on a mass spectrometry experiment. The mzData file is first vaildated against the XML Schema Definition file mzdata.xsd. If the file is valid, its content is parsed and selected information stored in Proteios. The mzData file is parsed using cursor-based XML stream parsing. The StAX (Stream API for XML) parser finds start and stop (end) tags, which are then processed. Element attributes are located in the start tag, and elements of simple types are stored directly after the start tag is read. For more complex elements, values of attributes and sub-elements are collected in temporary variables, until the end tag is reached, and the colelcted contents are stored. Example: XML tag tagData At start tag: Method thisTagElementStart() stores attribute values. Between tags: tagData is stored in temporary StringBuffer. At end tag: Method thisTagItem() processes collected data. Tag data may be exchanged for a start/end tag pair, etc.

Version:
2.0
Author:
Olle
Last modified
$Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $

Field Summary
protected static org.apache.log4j.Logger log
          Logger used.
 
Constructor Summary
MzDataImpCommon()
          Default constructor.
 
Method Summary
 void blockEnd(javax.xml.stream.XMLStreamReader parser)
          Processes end of XML block processed by this class.
 void blockStart(javax.xml.stream.XMLStreamReader parser)
          Processes start of XML block processed by this class.
 String getBlockTagName()
          Get the blockTagName.
 StringBuffer getTempStrBuf()
          Get the StringBuffer tempStrBuf value.
 void parse(javax.xml.stream.XMLStreamReader parser)
          Parse the current XML block.
 void processCData(javax.xml.stream.XMLStreamReader parser)
          Processes a CData event.
 void processCharacters(javax.xml.stream.XMLStreamReader parser)
          Processes a Characters event.
 void processInternalEndElement(javax.xml.stream.XMLStreamReader parser)
          Processes an internal EndElement event.
 void processInternalStartElement(javax.xml.stream.XMLStreamReader parser)
          Processes an internal StartElement event.
 void setBlockTagName(String blockTagName)
          Set the blockTagName.
 void setTempStrBuf(StringBuffer tempStrBuf)
          Set the StringBuffer tempStrBuf value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
Logger used. Used to log specific events.

Constructor Detail

MzDataImpCommon

public MzDataImpCommon()
Default constructor.

Method Detail

getBlockTagName

public String getBlockTagName()
Get the blockTagName.

Returns:
blockName String the XML block tag name

setBlockTagName

public void setBlockTagName(String blockTagName)
Set the blockTagName.

Parameters:
blockTagName - String the XML block tag name to set.

getTempStrBuf

public StringBuffer getTempStrBuf()
Get the StringBuffer tempStrBuf value.

Returns:
tempStrBuf StringBuffer tempStrBuf with temporary storage of parsed data.

setTempStrBuf

public void setTempStrBuf(StringBuffer tempStrBuf)
Set the StringBuffer tempStrBuf value.

Parameters:
tempStrBuf - StringBuffer tempStrBuf value to set.

parse

public void parse(javax.xml.stream.XMLStreamReader parser)
           throws javax.xml.stream.XMLStreamException
Parse the current XML block. The XMLStreamReader parser is updated to refer to the current position in the XML data.

Parameters:
parser - XMLStreamReader instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

processCharacters

public void processCharacters(javax.xml.stream.XMLStreamReader parser)
                       throws javax.xml.stream.XMLStreamException
Processes a Characters event.

Parameters:
parser - XMLStreamReader instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

processCData

public void processCData(javax.xml.stream.XMLStreamReader parser)
                  throws javax.xml.stream.XMLStreamException
Processes a CData event.

Parameters:
parser - XMLStreamReader instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

blockStart

public void blockStart(javax.xml.stream.XMLStreamReader parser)
                throws javax.xml.stream.XMLStreamException
Processes start of XML block processed by this class. Extracts data from attributes. This method should be overirdden by the daughter class if it needs to process the XML start element of the block.

Parameters:
parser - XMLStreamReader instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

blockEnd

public void blockEnd(javax.xml.stream.XMLStreamReader parser)
              throws javax.xml.stream.XMLStreamException
Processes end of XML block processed by this class. Extracts data in block. This method should be overirdden by the daughter class if it needs to process the XML end element of the block.

Parameters:
parser - XMLStreamReader instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

processInternalStartElement

public void processInternalStartElement(javax.xml.stream.XMLStreamReader parser)
                                 throws javax.xml.stream.XMLStreamException
Processes an internal StartElement event. This method should be overidden by the daughter class to process the XML block that starts with the current element.

Parameters:
parser - XMLStreamReader instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

processInternalEndElement

public void processInternalEndElement(javax.xml.stream.XMLStreamReader parser)
                               throws javax.xml.stream.XMLStreamException
Processes an internal EndElement event. This method should be overirdden by the daughter class to process the XML block that ends with the current element.

Parameters:
parser - XMLStreamReader instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

Last update: 2011-06-23