com.raritantechnologies.searchApp.dataCollection
Class QueryProcessorGateway

java.lang.Object
  extended bycom.raritantechnologies.searchApp.dataCollection.QueryProcessorGateway
All Implemented Interfaces:
ICollectionGateway, java.lang.Runnable

public class QueryProcessorGateway
extends java.lang.Object
implements ICollectionGateway

ICollectionGateway implementation which uses an IQueryProcessor to generate results for indexing or other processing.

Uses a set of IQueryList objects to generate queries for the query processor.

The IResultSets returned from the IQueryProcessor are post-processed using an XMLResultProcessor to map the metadata to the schema required by indexers or other IGatewayOutputProcessors in the data collection / processing pipeline.

XML Configuration Template:
  <CollectionGateway name="QProc_1" 
          class="com.raritantechnologies.searchApp.dataCollection.QueryProcessorGateway"
          pageSize="[ size of result sets to be processed ]"
          maximumDocsPerSource="[ maximum number of documents to get from each source ]" 
          debug="[ true | false (default) | code]">

    <QueryList>
      <Query> 
        <Field ID="[a search field]" value="[value to search]" />
        <Field ID="[another field]" value="[value to search]" />
      </Query>
      <Query>
        <Field ID="[second query first field]" value="[ some value ]" />
      </Query>
    </QueryList>

    <!-- =================================================================== -->
    <!-- Alternatively - can derive the query list from another SearchSource -->
    <!-- This enables the queries to be determined dynamically (i.e. look up -->
    <!-- a set of user queries for alerting given a userID                   -->
    <!-- =================================================================== -->
    <QuerySource name="[ name of RTI SearchSource ]"
                    outputQueryFields="[ name of field(s) in query source result that have query=value parameters]" >

       <!-- Describes how to create a query to the QuerySource    -->
       <!-- to get the list of queries for the result Data source -->
       <QueryList>
          <Field ID="[ search field in QuerySource ]" value="[ value to search ]"  />
          <!-- etc... -->
       </QueryList>
 
       <!-- Describes how query source results are mapped to a DataSource query -->
       <QueryMap>
         <Field ID="[ output field in Query ]" mapTo="[ name of field in Data Source ]" />
       </QueryMap>

    </QuerySource>

    <!-- The Result data source from which information will be extracted. -->
    <Sources>
      <Source name="[Search Source name]" 
                 XMLResultProcessor="[ name of optional system object XMLResultProcessor ]">

        <!-- Example (Optional) XMLResultProcessor used to transform raw search result --> 
        <XMLResultProcessor>
          <RecordTag>Record</RecordTag>

          <!-- Define callback operations for the ProgrammableSAXFilter -->
          <!-- "shortcut versions -assume standard classes in com.raritantechnologies.xml.sax -->
          <Field ID="VdkVgwKey" callbackType="CData" >
            <ParamName>VdkVgwKey</ParamName> 
              <Comparator class="TagComparator" >
                <TagName>CIK</TagName>
              </Comparator>
          </Field>

          <Field ID="Name" callbackType="Attribute" >
            <ParamName>Name</ParamName> 
            <AttributeName>attrInXML</AttributeName>
            <Comparator class="TagComparator" >
                <TagName>Name</TagName>
            </Comparator>
          </Field>

          <!-- Fully qualified class names versions - use if custom callbacks are used (for example) -->
          <Field ID="CIK" callback="com.raritantechnologies.xml.sax.filter.callbacks.CDataCallbackOperation" >
            <ParamName>CIK</ParamName> 
              <Comparator class="com.raritantechnologies.xml.sax.filter.comparators.TagComparator" >
                <TagName>CIK</TagName>
              </Comparator>
          </Field>

          <Field ID="SIC" callback="com.raritantechnologies.xml.sax.filter.callbacks.AttributeCallbackOperation" >
            <AttributeName>StandardCode</AttributeName>
            <ParamName>SIC</ParamName> 
            <Comparator class="com.raritantechnologies.xml.sax.filter.comparators.TagComparator" >
              <TagName>SIC</TagName>
            </Comparator>
          </Field>

        </XMLResultProcessor>
      </Source>
    </Sources>
  </CollectionGateway>
 

Developed by Raritan Technologies .

Author:
Ted Sullivan

Constructor Summary
QueryProcessorGateway()
           
QueryProcessorGateway(ISearchFieldMap sfMap, java.lang.String ssName, IQueryList queryList)
           
 
Method Summary
 java.lang.String getConfigurationXML()
           
 void initialize(org.w3c.dom.Element gatewayElem, ISearchFieldMap sfMap)
          Initialize the ICollectionGateway from a Configuration XML element.
 boolean isPaused()
           
 void mapQuerySourceResultField(java.lang.String querySourceResultField, java.lang.String dataSourceSearchField)
           
 void pause()
           
 void resume()
           
 void run()
           
 void run(ILoginInfo userInfo)
          Need to have loginInfo for sources which require login/pw access.
 void setDataAvailable(IResultSet rs, int currentQuery, SearchSource ss)
           
 void setDataComplete()
           
 void setDEBUG(java.lang.String debugSt)
           
 void setGatewayListener(IGatewayListener listener)
          Sets the IGatewayListener interface.
 void setInputParameters(OrderedMap inputParams)
          set input parameters...
 void setQueryList(IQueryList theQueryList)
           
 void setQuerySource(SearchSource querySource)
           
 void setQuerySourceLogin(ILoginInfo querySourceLogin)
           
 void setQuerySourceName(java.lang.String querySourceName)
           
 void setQuerySourcePageSize(int querySourcePSize)
           
 void setQuerySourceQuery(OrderedMap querySourceQuery)
          Sets the query used to get a set of queries from the QuerySource:
 void setQuerySourceResultFields(java.lang.String[] querySourceResultFields)
           
 void setSearchSource(SearchSource theSearchSource)
           
 void setSourceLogin(ILoginInfo theSourceLogin)
           
 void setUseQuerySource(boolean useQuerySource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryProcessorGateway

public QueryProcessorGateway()

QueryProcessorGateway

public QueryProcessorGateway(ISearchFieldMap sfMap,
                             java.lang.String ssName,
                             IQueryList queryList)
Method Detail

setInputParameters

public void setInputParameters(OrderedMap inputParams)
Description copied from interface: ICollectionGateway
set input parameters...

Specified by:
setInputParameters in interface ICollectionGateway

run

public void run()
Specified by:
run in interface ICollectionGateway

run

public void run(ILoginInfo userInfo)
Description copied from interface: ICollectionGateway
Need to have loginInfo for sources which require login/pw access.

Specified by:
run in interface ICollectionGateway

setGatewayListener

public void setGatewayListener(IGatewayListener listener)
Description copied from interface: ICollectionGateway
Sets the IGatewayListener interface.

Specified by:
setGatewayListener in interface ICollectionGateway

setDataAvailable

public void setDataAvailable(IResultSet rs,
                             int currentQuery,
                             SearchSource ss)

setDataComplete

public void setDataComplete()

pause

public void pause()
Specified by:
pause in interface ICollectionGateway

resume

public void resume()
Specified by:
resume in interface ICollectionGateway

isPaused

public boolean isPaused()
Specified by:
isPaused in interface ICollectionGateway

initialize

public void initialize(org.w3c.dom.Element gatewayElem,
                       ISearchFieldMap sfMap)
Description copied from interface: ICollectionGateway
Initialize the ICollectionGateway from a Configuration XML element.

Specified by:
initialize in interface ICollectionGateway

setQuerySourceName

public void setQuerySourceName(java.lang.String querySourceName)

setQuerySource

public void setQuerySource(SearchSource querySource)

setQuerySourceQuery

public void setQuerySourceQuery(OrderedMap querySourceQuery)
Sets the query used to get a set of queries from the QuerySource:


setQuerySourceResultFields

public void setQuerySourceResultFields(java.lang.String[] querySourceResultFields)

mapQuerySourceResultField

public void mapQuerySourceResultField(java.lang.String querySourceResultField,
                                      java.lang.String dataSourceSearchField)

setUseQuerySource

public void setUseQuerySource(boolean useQuerySource)

setQuerySourceLogin

public void setQuerySourceLogin(ILoginInfo querySourceLogin)

setQuerySourcePageSize

public void setQuerySourcePageSize(int querySourcePSize)

setSearchSource

public void setSearchSource(SearchSource theSearchSource)

setQueryList

public void setQueryList(IQueryList theQueryList)

setSourceLogin

public void setSourceLogin(ILoginInfo theSourceLogin)

getConfigurationXML

public java.lang.String getConfigurationXML()
Specified by:
getConfigurationXML in interface ICollectionGateway

setDEBUG

public void setDEBUG(java.lang.String debugSt)