org.jmonks.batch.io.xml
Class XMLRecordSpec

java.lang.Object
  extended byorg.jmonks.batch.io.RecordSpec
      extended byorg.jmonks.batch.io.xml.XMLRecordSpec

public class XMLRecordSpec
extends RecordSpec

XMLRecordSpec represents record-spec element in the file spec belongs to the xml file type. Along with the record-type attribute it looks for the record-xpath attribute in the record-spec element to identify the record. Record type and record-xpath attribute values should be unique across the file-spec. XML Record spec doesnt require any field specs to be defined. treats all the elements underneath the given xpath as a fields. Here is a sample spec snippet...

      <file-spec file-type="xml" root-element="consumer-request">
          <record-spec record-type="detail" record-xpath="/consumer-request/consumer-add"/>
      </file-spec>
  

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Field Summary
static java.lang.String RECORD_XPATH_ATTRIB_NAME
          Constant defines the record xpath attribute name.
protected  java.lang.String recordXPath
          Holds the record spec xpath.
 
Fields inherited from class org.jmonks.batch.io.RecordSpec
fieldSpecList, RECORD_SPEC_TAG_NAME, RECORD_TYPE_ATTRIB_NAME, recordType
 
Constructor Summary
XMLRecordSpec(RecordType recordType)
          Constructs the XMLRecordSpec by using record type.
 
Method Summary
static RecordSpec createXMLRecordSpec(org.w3c.dom.Element recordSpecElement)
          Factory method to create the xml record spec from the given DOM Element representing the record-spec element in the file spec.
 java.lang.String getRecordXPath()
          Gets the xpath to identify the record.
 boolean isMatch(java.lang.String xpath)
          Tells whether given xpath matches the xpath of this record spec.
 java.lang.String toString()
           
 
Methods inherited from class org.jmonks.batch.io.RecordSpec
addFieldSpec, getFieldSpecs, getRecordType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

recordXPath

protected java.lang.String recordXPath
Holds the record spec xpath.


RECORD_XPATH_ATTRIB_NAME

public static final java.lang.String RECORD_XPATH_ATTRIB_NAME
Constant defines the record xpath attribute name.

See Also:
Constant Field Values
Constructor Detail

XMLRecordSpec

public XMLRecordSpec(RecordType recordType)
Constructs the XMLRecordSpec by using record type.

Parameters:
recordType - Type of the record.
Method Detail

getRecordXPath

public java.lang.String getRecordXPath()
Gets the xpath to identify the record.


isMatch

public boolean isMatch(java.lang.String xpath)
Tells whether given xpath matches the xpath of this record spec.

Parameters:
xpath - Value to be compared with the record specs.
Returns:
Returns true if this record spec matches give xpath, false otherwise.
Throws:
java.lang.IllegalArgumentException - If xpath is null.

createXMLRecordSpec

public static RecordSpec createXMLRecordSpec(org.w3c.dom.Element recordSpecElement)
Factory method to create the xml record spec from the given DOM Element representing the record-spec element in the file spec.

Parameters:
recordSpecElement - DOM Element representing the record spec.
Returns:
Returns the xml file record spec.
Throws:
FileSpecException - If record-spec doesnt have the record-xpath or record-type attribute.

toString

public java.lang.String toString()