MainJavadocSource
SearchSource

com.raritantechnologies.searchApp
Class SearchSource

java.lang.Object
  extended bycom.raritantechnologies.searchApp.SearchSource
Direct Known Subclasses:
AdhocInfoSearchSource, AutonomySearchSource, BrowseSearchSource, CompositeSearchSource, CurrentResultsSource, DatabaseStatisticsSource, DataCollectorSearchSource, DieselpointSearchSource, DQLSearchSource, EndecaSearchSource, ERoomSearchSource, ExaleadSearchSource, FastSearchSource, FastSearchSource, FastSearchViewSource, FederatedSearchSource, FileSystemSearchSource, FlatFileSearchSource, HibernateSearchSource, HTMLSearchSource, HTTPRestSearchSource, InMemorySearchSource, JCRSearchSource, LDAPSearchSource, LookupSearchSource, LuceneMemorySource, LuceneSearchSource, MarkLogicSearchSource, OmniFindSearchSource, OpenSearchSource, QueryProcessorFilterSource, RdfOwlSearchSource, RecommendSearchSource, RequestSearchSource, ResultSetQueryProcessor, SearchHistorySource, SelectedRecordsSearchSource, SevSearchSource, SOAPSearchSource, SOLRSearchSource, SQLSearchSource, TaxonomyIDRollupSource, TreeSearchSource, UltraseekSearchSource, VerityFederatedSearchSource, VeritySearchSource, VWebServicesSearchSource, Z3950SearchSource

public abstract class SearchSource
extends java.lang.Object

Represents a search source: can be a web site, database, SOAP source, etc. - anything that has a search API or network protocol.

SearchSource is an abstract base class. Creation of SearchSource is done by ISearchFieldMapFactory using dynamic instantiation of a companion IXMLSearchSourceFactory class. The SearchSourceFactory implementation knows how to create a specific instance of a SearchSource from a specific type of <SourceType> XML tag.

SearchSource has data access methods for security purposes. The default implementation is to have no data access restrictions.

Data access can have multiple levels (total access, browse, partial access for example to a set of documents within a docbase controlled by an ACL list), or only metadata, no full text, concurrent access (simultaneous use limits), paid access, etc. SearchSource also lets QueryProcessors/QueryFormatters determine what field level access is available to a user.

Typically, the front end of the application will determine data access privilidges by determine which SearchSource are available to the user, and then once selected either by the user or by code, determine if the SearchSource can be used by the user at the time it is requested to run a search. The filtered list of SearchSources is then passed on to a compatible IQueryProcessor.

Examples:Basic XML Configuration Template:
  <SourceType name="[Source Name - unique within this source type]"
                 type="[Source Type]" 
                 displayName="[Source Name shown to users]"
                 sourceFactoryClass="[fully qualified class name of implementer of this interface]" 
                 queryProcessor="[fully qualified class name of implementer of source IQueryProcessor]" >

   <StaticFields>
     <StaticField fieldID="[the abstract field ID]"
                   value="the static value coming from this source" >
     </StaticField>
   </StaticFields>

   <FieldFormatters>
     <Formatter fieldID="[the abstract field ID]"
                   formatterClass="the IFieldFormatter class" >
     <!-- Formatter specific fields -->
     </Formatter>
   </FieldFormatters>

   <SecurityModel>
     <search>[public|restricted]</search>
     <fullText>[public|restricted]</fullText>
     <loginName>[(optional) login name for this source]</loginName>
   </SecurityModel>

   <SortMap>
     
   </SortMap>

   <!-- SourceType - specific information -->

  </SourceType>

 

Developed by Raritan Technologies .

Author:
Ted Sullivan, Glenn Robitaille

Field Summary
static java.lang.StringID_FIELD
           
static java.lang.StringIS_FEDERATED
           
static java.lang.StringNUMBER_OF_FIELDS
           
static java.lang.StringSECURE
           
static java.lang.StringSOURCE_NAME
           
static java.lang.StringSOURCE_TYPE
           
static java.lang.StringTITLE_FIELD
           
static java.lang.StringURL_FIELD
           
 
Constructor Summary
SearchSource()
           
 
Method Summary
 voidaddFieldFormatter(IFieldFormatter fieldFormatter)
           
 voidaddSearchField(SearchField searchField)
          SearchFields are added by the SearchFieldMapFactory
protected  voidaddSourceAttributes(java.util.List attrList)
           
 voidaddStaticField(java.lang.String fieldID, java.lang.String fieldValue)
           
 voidaddStaticFields(IResult result)
           
 voidaddUserSearchField(java.lang.String fieldID, java.lang.String userField)
           
 booleancanAccess(ILoginInfo userInfo)
          Method to determine if a user can access this search source.
 booleancanConsolidateSources()
          Methods to determine if a SearchSource can be consolidated: a single QueryProcessor can be used to search multiple sources.
 SearchSource[]consolidateSources(SearchSource[] allSources)
          Returns a list of sources that can be searched with the this search source's QueryProcessor.
 java.lang.ObjectdelSearchField(java.lang.String fieldID)
          Removes a SearchField from the field map.
 voidformatResult(IResult result)
           
 voidformatResult(java.lang.String sessionID, IResult result)
           
 java.lang.StringformatResultField(java.lang.String fieldName, java.lang.String fieldVal)
           
 java.lang.StringformatResultField(java.lang.String sessionID, java.lang.String fieldName, java.lang.String fieldVal)
           
 voidformatResults(IResultSet results)
          Applies all IFieldFormatter(s) registered with this SearchSource to an IResult.
 voidformatResults(java.lang.String sessionID, IResultSet results)
           
 java.util.IteratorgetAccessableFields(ILoginInfo userInfo)
          Method to determine which fields in a SearchSource can be searched/viewed by a User Default implementation assumes that all fields are searchable/viewable.
 java.util.ListgetAttributes()
           
 java.lang.StringgetBasePath()
           
 java.lang.StringgetConfigPath()
           
 java.lang.StringgetDisplayName()
           
 java.util.ListgetFieldFormatters()
           
 java.lang.StringgetIDField()
          Returns the source field that should be used as a unique ID.
 java.lang.StringgetName()
           
 java.lang.ObjectgetProperty(java.lang.String property)
          returns a Source Property.
abstract  IQueryProcessorgetQueryProcessor()
          returns the type of QueryProcessor that can access this SearchSource.
 SearchFieldgetSearchField(java.lang.String fieldID)
          Returns a SearchField instance for the given fieldID.
 java.lang.StringgetSearchFieldID(java.lang.String sourceFieldName)
          returns the search field ID for the name of the field in the SearchSource.
 java.util.IteratorgetSearchFields()
           
 java.util.ListgetSearchFields(java.lang.String fieldID)
           
 AbstractSortSpecgetSecondarySortSpec(java.lang.String primaryField)
          returns the background sort specification for a given primary sort field.
 ISecurityManagergetSecurityManager()
          Method returns the securityManager instance or null if there is none.
 java.lang.StringgetSecurityManagerName()
           
 SecurityModelgetSecurityModel()
          Returns the SearchSource's security model.
 AbstractSortSpecgetSortSpec()
          returns the default background sort specification.
 ILoginInfogetSourceCredentials(ILoginInfo userInfo)
          Method returns source credentials for a given user.
 java.lang.String[]getSourcePropertyNames()
          Returns a list of Source type specific property names.
 java.lang.StringgetTitleField()
           
 java.lang.StringgetType()
          returns the source type.
 java.lang.StringgetURLField()
           
 java.util.MapgetUserSearchFields()
           
 booleanisMultiThreaded()
           
 voidsetConfigPath(java.lang.String configPath)
           
 voidsetDisplayName(java.lang.String displayName)
           
 voidsetIDField(java.lang.String idField)
           
 voidsetMultiThreaded(boolean multiThreaded)
           
 voidsetName(java.lang.String sourceName)
          set/get the name of this instance of the SearchSource e.g.
 voidsetSecurityManagerName(java.lang.String securityManager)
           
 voidsetSecurityModel(SecurityModel securityModel)
           
 voidsetSortMap(AbstractSortMap sortMap)
          sets the background sort map for this source.
 voidsetSourcePropertyInfoSource(ISearchSourceInfo sourceInfo)
           
 voidsetTitleField(java.lang.String titleField)
           
 voidsetType(java.lang.String sourceType)
          sets the source type.
 voidsetURLField(java.lang.String urlField)
           
 booleanshouldFormatResults()
           
 booleansupportsBackgroundSort()
          Returns true if this source supports multi-level sorting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_FIELD

public static final java.lang.String ID_FIELD
See Also:
Constant Field Values

URL_FIELD

public static final java.lang.String URL_FIELD
See Also:
Constant Field Values

TITLE_FIELD

public static final java.lang.String TITLE_FIELD
See Also:
Constant Field Values

NUMBER_OF_FIELDS

public static final java.lang.String NUMBER_OF_FIELDS
See Also:
Constant Field Values

SOURCE_TYPE

public static final java.lang.String SOURCE_TYPE
See Also:
Constant Field Values

SOURCE_NAME

public static final java.lang.String SOURCE_NAME
See Also:
Constant Field Values

SECURE

public static final java.lang.String SECURE
See Also:
Constant Field Values

IS_FEDERATED

public static final java.lang.String IS_FEDERATED
See Also:
Constant Field Values
Constructor Detail

SearchSource

public SearchSource()
Method Detail

getQueryProcessor

public abstract IQueryProcessor getQueryProcessor()
returns the type of QueryProcessor that can access this SearchSource.


setType

public void setType(java.lang.String sourceType)
sets the source type. e.g. "Verity K2 Product" "Documentum docbase" "SQL Worker" "HTML Worker"


getType

public java.lang.String getType()
returns the source type. e.g. "Verity K2 Product" "Documentum docbase" "SQL Worker" "HTML Worker" etc.


setName

public void setName(java.lang.String sourceName)
set/get the name of this instance of the SearchSource e.g. Product name Docbase name Database name Web site name


getName

public java.lang.String getName()

setDisplayName

public void setDisplayName(java.lang.String displayName)

getDisplayName

public java.lang.String getDisplayName()

setMultiThreaded

public void setMultiThreaded(boolean multiThreaded)

isMultiThreaded

public boolean isMultiThreaded()

addSearchField

public void addSearchField(SearchField searchField)
SearchFields are added by the SearchFieldMapFactory


delSearchField

public java.lang.Object delSearchField(java.lang.String fieldID)
Removes a SearchField from the field map.

Parameters:
fieldID - the search field ID to remove
Returns:
the removed field object or "null" if the requested fieldID doesn't exist in the map

getSearchFields

public java.util.Iterator getSearchFields()

getSearchField

public SearchField getSearchField(java.lang.String fieldID)
Returns a SearchField instance for the given fieldID. SearchField is the SearchSource-specific field object. It contains all of the source-specific parameters needed by its SearchSource to execute a search.


getSearchFields

public java.util.List getSearchFields(java.lang.String fieldID)

shouldFormatResults

public boolean shouldFormatResults()

addFieldFormatter

public void addFieldFormatter(IFieldFormatter fieldFormatter)

addStaticField

public void addStaticField(java.lang.String fieldID,
                           java.lang.String fieldValue)

formatResults

public void formatResults(IResultSet results)
Applies all IFieldFormatter(s) registered with this SearchSource to an IResult. Generally used to convert source-specific format to common or normalized formats or to correct data errors or anomalies.


formatResults

public void formatResults(java.lang.String sessionID,
                          IResultSet results)

addStaticFields

public void addStaticFields(IResult result)

formatResult

public void formatResult(IResult result)

formatResult

public void formatResult(java.lang.String sessionID,
                         IResult result)

formatResultField

public java.lang.String formatResultField(java.lang.String fieldName,
                                          java.lang.String fieldVal)

formatResultField

public java.lang.String formatResultField(java.lang.String sessionID,
                                          java.lang.String fieldName,
                                          java.lang.String fieldVal)

getFieldFormatters

public java.util.List getFieldFormatters()

getSearchFieldID

public java.lang.String getSearchFieldID(java.lang.String sourceFieldName)
returns the search field ID for the name of the field in the SearchSource.


getIDField

public java.lang.String getIDField()
Returns the source field that should be used as a unique ID.


setIDField

public void setIDField(java.lang.String idField)

getTitleField

public java.lang.String getTitleField()

setTitleField

public void setTitleField(java.lang.String titleField)

getURLField

public java.lang.String getURLField()

setURLField

public void setURLField(java.lang.String urlField)

getBasePath

public java.lang.String getBasePath()

getSourcePropertyNames

public java.lang.String[] getSourcePropertyNames()
Returns a list of Source type specific property names.


getProperty

public java.lang.Object getProperty(java.lang.String property)
returns a Source Property. The standard pattern is to return a String or Object if a property has a single value and a String or Object Array if the property has multiple values.


setSourcePropertyInfoSource

public void setSourcePropertyInfoSource(ISearchSourceInfo sourceInfo)

canAccess

public boolean canAccess(ILoginInfo userInfo)
Method to determine if a user can access this search source. Default implementation assumes that the SearchSource is "public" Subclasses should override this method to indicate other kinds of security such as concurrent use limits, paid use, etc.


getSourceCredentials

public ILoginInfo getSourceCredentials(ILoginInfo userInfo)
Method returns source credentials for a given user. This may involve different username password. This method allows a user to access different search sources with a single login. Subclasses may override this method to look up user credentials for a search source given the system login information. default returns same info to indicate that no credentials are needed.


getSecurityManager

public ISecurityManager getSecurityManager()
Method returns the securityManager instance or null if there is none.


getSecurityModel

public SecurityModel getSecurityModel()
Returns the SearchSource's security model. The SecurityModel designates whether the source is public or secure and whether access to documents is public or secure.


setSecurityModel

public void setSecurityModel(SecurityModel securityModel)

setSecurityManagerName

public void setSecurityManagerName(java.lang.String securityManager)

getSecurityManagerName

public java.lang.String getSecurityManagerName()

setConfigPath

public void setConfigPath(java.lang.String configPath)

getConfigPath

public java.lang.String getConfigPath()

getAccessableFields

public java.util.Iterator getAccessableFields(ILoginInfo userInfo)
Method to determine which fields in a SearchSource can be searched/viewed by a User Default implementation assumes that all fields are searchable/viewable. Subclasses should override this method to provide field-level security on results from a search source.


supportsBackgroundSort

public boolean supportsBackgroundSort()
Returns true if this source supports multi-level sorting.


setSortMap

public void setSortMap(AbstractSortMap sortMap)
sets the background sort map for this source.


getSortSpec

public AbstractSortSpec getSortSpec()
returns the default background sort specification.


getSecondarySortSpec

public AbstractSortSpec getSecondarySortSpec(java.lang.String primaryField)
returns the background sort specification for a given primary sort field.


canConsolidateSources

public boolean canConsolidateSources()
Methods to determine if a SearchSource can be consolidated: a single QueryProcessor can be used to search multiple sources. (For example, a VeritySearchSource with multiple collections).


consolidateSources

public SearchSource[] consolidateSources(SearchSource[] allSources)
Returns a list of sources that can be searched with the this search source's QueryProcessor. Default method returns the search source that matches this source's name. Subclasses can override this method to do actual consolidation.


addUserSearchField

public void addUserSearchField(java.lang.String fieldID,
                               java.lang.String userField)

getUserSearchFields

public java.util.Map getUserSearchFields()

getAttributes

public java.util.List getAttributes()

addSourceAttributes

protected void addSourceAttributes(java.util.List attrList)