net.sf.mavenhist.extractor
Class AbstractXPathValueExtractor

java.lang.Object
  extended by net.sf.mavenhist.extractor.AbstractXMLValueExtractor
      extended by net.sf.mavenhist.extractor.AbstractValidatingXMLValueExtractor
          extended by net.sf.mavenhist.extractor.AbstractXPathValueExtractor
All Implemented Interfaces:
INamedExtractor, IValueExtractor, IXMLValueExtractor
Direct Known Subclasses:
AbstractCheckstyleSingleValueExtractor, AbstractCoberturaSingleValueExtractor, AbstractCPDDuplicatedLinesExtractor, AbstractFindbugsExtractor, AbstractJNCSSExtractor, AbstractJUnitExtractor, AbstractPMDExtractor

public abstract class AbstractXPathValueExtractor
extends AbstractValidatingXMLValueExtractor

Default implementation for a IValueExtractor. Supports the easy usage of a XPath query.


Constructor Summary
AbstractXPathValueExtractor()
           
 
Method Summary
 MultiMetric[] extractValidatedDocument(Document document)
          Extracts muliple values from one result document.
protected  String getVersion(Document document)
          Returns the version of the underlying XML file.
protected  String getVersionXPath()
          Returns the XPath to get the version of the underlying XML file.
protected abstract  String getXPath(String version)
          Returns the XPath to get the required value of a specified XML version.
 
Methods inherited from class net.sf.mavenhist.extractor.AbstractValidatingXMLValueExtractor
extract, getValidityTestXPath, isDocumentValid
 
Methods inherited from class net.sf.mavenhist.extractor.AbstractXMLValueExtractor
extract
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.mavenhist.extractor.INamedExtractor
getName
 

Constructor Detail

AbstractXPathValueExtractor

public AbstractXPathValueExtractor()
Method Detail

extractValidatedDocument

public final MultiMetric[] extractValidatedDocument(Document document)
                                             throws TransformerException
Extracts muliple values from one result document.

Specified by:
extractValidatedDocument in class AbstractValidatingXMLValueExtractor
Parameters:
document - to parse for the values.
Returns:
Array of metrics with the differentiated locations and values.
Throws:
TransformerException - the XML-Queries failed.

getXPath

protected abstract String getXPath(String version)
Returns the XPath to get the required value of a specified XML version.

Returns:
XPath to get the required value.

getVersion

protected final String getVersion(Document document)
                           throws TransformerException
Returns the version of the underlying XML file. If nothing is defined null is returned.

Returns:
version of the underlying XML file or null if no version is provided.
Throws:
TransformerException - if version could not be found in the document

getVersionXPath

protected String getVersionXPath()
Returns the XPath to get the version of the underlying XML file.

Returns:
XPath to get the version of the underlying XML file or null if no version is available.


Copyright © 2009. All Rights Reserved.