com.raritantechnologies.federated
Class FederatedQueryProcessor

java.lang.Object
  extended bycom.raritantechnologies.federated.FederatedQueryProcessor
All Implemented Interfaces:
IFederatedQueryProcessor, IQueryProcessor

public class FederatedQueryProcessor
extends java.lang.Object
implements IQueryProcessor, IFederatedQueryProcessor

Performs a multi-source or "federated" search.

Dispatches query request to multiple IQueryProcessors. Collects and organizes the responses.

Uses the composite pattern: FederatedQueryProcessor IS an IQueryProcessor so that it can be used where any IQueryProcessor can.


Developed by Raritan Technologies Inc..

Author:
Kepler Gelotte

Field Summary
 
Fields inherited from interface com.raritantechnologies.federated.IFederatedQueryProcessor
FULL_RESULTS, NO_RESULTS, PARTIAL_RESULTS
 
Constructor Summary
FederatedQueryProcessor()
           
 
Method Summary
 void addErrorMessage(java.lang.String message)
           
 void addMessage(java.lang.String message)
           
 void addResults(IResultSet newResults, java.lang.String sourceName)
           
 IResultSet executeQuery(java.lang.Integer queryID, ISearchFieldMap searchMap, SourceLoginInfo[] sources, OrderedMap inputParameters, java.lang.Integer pageSize, java.lang.Integer startRec)
          Implementation of executeQuery( ) Starts queries in their own thread based on number of sources Accumulates results from workers in its own FederatedResultSet
 IResultSet getCurrentResults()
           
 int getCurrentThreadCount()
           
 int getErrorCount()
           
 java.util.Iterator getErrorMessages()
           
 com.raritantechnologies.federated.FederatedRunner getFederatedRunner(int i)
           
 java.lang.String getLastSourceToFinish()
           
 int getMessageCount()
           
 java.util.Iterator getMessages()
           
 int getResultState()
           
 int getThreadCount()
           
 void searchDone(java.lang.String sourceName)
           
 void setResultCallBack(java.lang.Object obj, java.lang.String methodName)
          This registers a callback triggered after every result is returned
 void setSourceCallBack(java.lang.Object obj, java.lang.String methodName)
          This sets up a callback triggered after every source returns
 void setTimeouts(int[] t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FederatedQueryProcessor

public FederatedQueryProcessor()
Method Detail

executeQuery

public IResultSet executeQuery(java.lang.Integer queryID,
                               ISearchFieldMap searchMap,
                               SourceLoginInfo[] sources,
                               OrderedMap inputParameters,
                               java.lang.Integer pageSize,
                               java.lang.Integer startRec)
                        throws QueryProcessorException
Implementation of executeQuery( ) Starts queries in their own thread based on number of sources Accumulates results from workers in its own FederatedResultSet

Specified by:
executeQuery in interface IQueryProcessor
Parameters:
queryID - Unique ID for this query. Used by front end to manage queries and query pages. QueryProcessor may use this parameter to organize its search results, and to organize any state information it needs to process future page requests (future executeQuery( ) calls with the same queryID.
searchMap - Provides mapping information needed to translate the inputParameters into a search string appropriate for this type of QueryProcessor. Mapping information is obtained by the application framework from local configuration data.
sources - The LoginInfo and SearchSource(s) to be used for this query. The SearchSource(s) must be of the appropriate type for the QueryProcessor.
inputParameters - Form inputs. Use ISearchFieldMap to translate these into implementation and source-specific fields.
pageSize - Integer specifying the number of results to include in the returned Document. if null - use the default page size.
startRec - Integer specifying the starting record in the result set to be returned. if null - start with the first record.
Returns:
IResultSet containing result set.
Throws:
QueryProcessorException

setTimeouts

public void setTimeouts(int[] t)

searchDone

public void searchDone(java.lang.String sourceName)

getLastSourceToFinish

public java.lang.String getLastSourceToFinish()

getCurrentResults

public IResultSet getCurrentResults()
Specified by:
getCurrentResults in interface IFederatedQueryProcessor

addResults

public void addResults(IResultSet newResults,
                       java.lang.String sourceName)

addMessage

public void addMessage(java.lang.String message)

getMessageCount

public int getMessageCount()

getMessages

public java.util.Iterator getMessages()

addErrorMessage

public void addErrorMessage(java.lang.String message)

getErrorCount

public int getErrorCount()

getErrorMessages

public java.util.Iterator getErrorMessages()

setSourceCallBack

public void setSourceCallBack(java.lang.Object obj,
                              java.lang.String methodName)
This sets up a callback triggered after every source returns


setResultCallBack

public void setResultCallBack(java.lang.Object obj,
                              java.lang.String methodName)
This registers a callback triggered after every result is returned


getFederatedRunner

public com.raritantechnologies.federated.FederatedRunner getFederatedRunner(int i)

getThreadCount

public int getThreadCount()

getCurrentThreadCount

public int getCurrentThreadCount()

getResultState

public int getResultState()
Specified by:
getResultState in interface IFederatedQueryProcessor