com.raritantechnologies.searchApp.formatters
Class StringPatternResultParser

java.lang.Object
  extended bycom.raritantechnologies.searchApp.formatters.StringPatternResultParser
All Implemented Interfaces:
IConfigurable, IResultParser

public class StringPatternResultParser
extends java.lang.Object
implements IResultParser

Result Parser that can transform structured text into metadata. Uses a state transition model in which regular expressions are used to detect state transitions. Output elements (String parsers) and line - to - field elements move string data into metadata fields.

XMl Configuration Template:
   <StringParser 
      class="com.raritantechnologies.searchApp.formatters.StringPatternResultParser"
      initialState="[ state name of initial state: e.g. 'Start' ]" >

     <!-- One or more State Changes -->
     <StateChange inputState="[ previous state name ]"
                     outputState="[ result state name ]"
                     matchPattern="[ regular expression pattern that triggers state change ]"
                     changeOnMatch="true(default)|false"
                     changeAtLine="true|false( default ) - state changes occurs on if true, after if false" />

     <!-- If multiple possible RegExpr patterns for a state change: use this format -->
     <StateChange inputState="[ previous state name ]"
                     outputState="[ result state name ]" >
         <MatchPattern>[ regular expression pattern that triggers state change ]</MatchPattern>
         <MatchPattern>[ alternative regular expression ]</MatchPattern>
     </StateChange>

     <!-- Line fields set or concatenate text lines to a metadata field -->
     <LineField state="[ state name that activates this transform ]"
                   fieldID="[ result field that gets text data ]"
                   appendMode="true|false"
                   delimiter="[ string inserted between text lines ]" />


     <!-- String filters that can transform a text line into metadata -->
     <FilteredField state="[ state name that activates this parser ]"
                      fieldID="[ result field that gets filtered string ]" >

       <StringFilter class="[ class of com.raritantechnologies.utils.filter.IStringFilter ]" >

       </StringFilter>

     </FilteredField>

   </StringParser>
 

Developed by Raritan Technologies .

Author:
Ted Sullivan

Field Summary
 
Fields inherited from interface com.raritantechnologies.searchApp.IResultParser
TEMPLATE
 
Constructor Summary
StringPatternResultParser()
           
 
Method Summary
 java.lang.String getConfigurationXML()
           
 java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
           
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 IResult parse(java.lang.String dataString)
          Create an IResult object from the formatted data string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringPatternResultParser

public StringPatternResultParser()
Method Detail

parse

public IResult parse(java.lang.String dataString)
Description copied from interface: IResultParser
Create an IResult object from the formatted data string.

Specified by:
parse in interface IResultParser

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IConfigurable

getConfigurationXML

public java.lang.String getConfigurationXML()

getConfigurationXML

public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)