Esri Geoportal Server
1.0

com.esri.gpt.catalog.search
Class SearchEngineCSW

java.lang.Object
  extended by com.esri.gpt.catalog.search.ASearchEngine
      extended by com.esri.gpt.catalog.search.SearchEngineCSW
All Implemented Interfaces:
IRequest<SearchRequestDefinition>
Direct Known Subclasses:
SearchEngineExternalCsw, SearchEngineLocal

public class SearchEngineCSW
extends ASearchEngine

The class SearchEngineCSW. Accesses a CSW repository to send searTch and parse back results. works closely with the csw client jar. Parameters that can be used are "url" and "profileId".


Nested Class Summary
static class SearchEngineCSW.AimsContentTypes
          ArcIMS content types
static class SearchEngineCSW.Scheme
          The Enum Scheme.
static class SearchEngineCSW.SEARCH_OPERATION
          The Enum SEARCH_OPERATION.
 
Field Summary
static String DATE_FORMAT
          Date format used by csw
static String KEY_LINK_INFO
           
static String KEY_REFERENCES
           
static String KEY_TYPES
           
 
Constructor Summary
protected SearchEngineCSW()
          Instantiates a new search DAOCSW.
  SearchEngineCSW(RequestContext context)
          constructors ============================================================
 
Method Summary
 Map<String,Object> createInstances(StringSet rids)
          Creates instances
 void doSearch()
          Performs search.
 void doSearch(String cswRequest)
          Performs a search using a supplied CSW request string.
 CswCatalogCapabilities getCapabilities()
          Gets the capabilities.
 CswClient getCswClient()
          Gets the csw client.
protected  CswProfile getCswProfile()
          Gets the csw profile.
 String getGetCapabiltiesUrl()
          Gets the gets the capabilties url.
 String getGetMetadataRecordUrl()
          Gets the gets the metadata record url.
 String getGetRecordsUrl()
          Gets the get records request url.
protected  CswRecord getMetadata(String uuid)
          Gets the metadata as a csw client api record.
 SearchResultRecord getMetadataAsSearchResultRecord(String uuid)
          Gets metadata as search result record
 String getMetadataAsText(String uuid)
          Gets the metadata as text.
 String getMetadataUrl(String uuid)
          Gets the metadata url for get record by Id.
 String getProfileId()
          Gets the profile id.
 String getSearchQuery()
          Returns the search query for the search operation
 void init()
          Inits the Object after you have set the properties.
 CswSearchCriteria marshallGptToCswClientCriteria(SearchCriteria gptSearchCriteria)
          Marshall gpt to csw client criteria.
static CswSearchCriteria marshallGptToCswClientCriteria2(SearchCriteria gptSearchCriteria)
          Marshall gpt to csw client criteria.
protected  SearchResultRecord marshallRecord(CswRecord cswRecord)
          Marshall record.
protected  void marshallRecords(CswRecords cswRecords)
          Marshall CSW client records and gpt search records.
 CswRecords parseResponse(String cswResponse)
          Parses the CSW response.
protected  boolean readIsExternalSearch()
          Tells us if the search is external to GPT9 or Internal
protected  CswRecords sendRequest(String cswRequest)
          Sends a CSW GetRecords request to CSW service.
 void setCapabilities(CswCatalogCapabilities capabilities)
          Sets the capabilities.
 void setCswClient(CswClient cswClient)
          Sets the csw client.
 void setGetCapabiltiesUrl(String getCapabiltiesUrl)
          Sets the gets the capabilties url.
 void setGetMetadataRecordUrl(String getMetadataRecordUrl)
          Sets the gets the metadata record url.
 void setGetRecordsUrl(String postRequestUrl)
          Sets the get records request url.
 void setProfileId(String profileId)
          Sets the profile id.
static String transformGptToCswRequest(SearchCriteria criteria, SearchEngineCSW.SEARCH_OPERATION operation)
          Transform GPT criteria to CSW request.
 
Methods inherited from class com.esri.gpt.catalog.search.ASearchEngine
checkPagination, getConnectionTimeoutMs, getConnectionUri, getCredentials, getFactoryAttributes, getHitsOnly, getKey, getKeyAbstract, getMessageBroker, getRequestContext, getRequestDefinition, getResourceLinkBuilder, getResponseTimeoutMs, getSearchTimeInMillis, getTimeInSeconds, readInputCharacters, setConnectionTimeoutMs, setConnectionUri, setCredentials, setFactoryAttributes, setHitsOnly, setKey, setMessageBroker, setRequestContext, setRequestDefinition, setResourceLinkBuilder, setResponseTimeout, setSearchTimeInMillis
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_FORMAT

public static final String DATE_FORMAT
Date format used by csw

See Also:
Constant Field Values

KEY_LINK_INFO

public static final String KEY_LINK_INFO
See Also:
Constant Field Values

KEY_REFERENCES

public static final String KEY_REFERENCES
See Also:
Constant Field Values

KEY_TYPES

public static final String KEY_TYPES
See Also:
Constant Field Values
Constructor Detail

SearchEngineCSW

public SearchEngineCSW(RequestContext context)
constructors ============================================================


SearchEngineCSW

protected SearchEngineCSW()
Instantiates a new search DAOCSW.

Method Detail

getCapabilities

public CswCatalogCapabilities getCapabilities()
Gets the capabilities.

Returns:
the capabilities

setCapabilities

public void setCapabilities(CswCatalogCapabilities capabilities)
Sets the capabilities.

Parameters:
capabilities - the new capabilities

getGetMetadataRecordUrl

public String getGetMetadataRecordUrl()
Gets the gets the metadata record url.

Returns:
the gets the metadata record url

setGetMetadataRecordUrl

public void setGetMetadataRecordUrl(String getMetadataRecordUrl)
Sets the gets the metadata record url. (will be used as prefix for getMetadata

Parameters:
getMetadataRecordUrl - the new gets the metadata record url

getGetCapabiltiesUrl

public String getGetCapabiltiesUrl()
Gets the gets the capabilties url.

Returns:
the gets the capabilties url (trimmed, never null)

setGetCapabiltiesUrl

public void setGetCapabiltiesUrl(String getCapabiltiesUrl)
Sets the gets the capabilties url.

Parameters:
getCapabiltiesUrl - the new gets the capabilties url

getGetRecordsUrl

public String getGetRecordsUrl()
Gets the get records request url.

Returns:
the post request url (trimmed, never null)

setGetRecordsUrl

public void setGetRecordsUrl(String postRequestUrl)
                      throws SearchException
Sets the get records request url.

Parameters:
postRequestUrl - the new post request url
Throws:
SearchException - the search exception

getCswClient

public CswClient getCswClient()
Gets the csw client.

Returns:
the csw client (never null)

setCswClient

public void setCswClient(CswClient cswClient)
Sets the csw client.

Parameters:
cswClient - the new csw client

getProfileId

public String getProfileId()
Gets the profile id.

Returns:
the profile id (trimmed, never null)

setProfileId

public void setProfileId(String profileId)
Sets the profile id.

Parameters:
profileId - the new profile id

init

public void init()
          throws SearchException
Description copied from class: ASearchEngine
Inits the Object after you have set the properties. Sets the attribute timeout connection and the attribute response timeout

Overrides:
init in class ASearchEngine
Throws:
SearchException - the search exception

readIsExternalSearch

protected boolean readIsExternalSearch()
Tells us if the search is external to GPT9 or Internal

Specified by:
readIsExternalSearch in class ASearchEngine
Returns:
false

doSearch

public void doSearch()
              throws SearchException
Performs search. It will use the SearchCritiria and SearchResults supplied by the factory class.

Specified by:
doSearch in class ASearchEngine
Throws:
SearchException - thrown when error with search.

doSearch

public void doSearch(String cswRequest)
              throws SearchException
Performs a search using a supplied CSW request string.

Parameters:
cswRequest - the CSW request string.
Throws:
SearchException - if an exception occurs

getMetadataUrl

public String getMetadataUrl(String uuid)
                      throws SearchException
Gets the metadata url for get record by Id.

Overrides:
getMetadataUrl in class ASearchEngine
Parameters:
uuid - the uuid
Returns:
the metadata url
Throws:
SearchException - the search exception

parseResponse

public CswRecords parseResponse(String cswResponse)
                         throws SearchException
Parses the CSW response.

Parameters:
cswResponse - the input source associated with the CSW response XML
Returns:
the resultant records
Throws:
SearchException - if an exception occurs

sendRequest

protected CswRecords sendRequest(String cswRequest)
                          throws SearchException
Sends a CSW GetRecords request to CSW service.

Parameters:
cswRequest - the CSW XML request
Returns:
the resultant records
Throws:
SearchException - the search exception

getSearchQuery

public String getSearchQuery()
                      throws SearchException
Returns the search query for the search operation

Specified by:
getSearchQuery in class ASearchEngine
Returns:
CSW query for the search criteria of the object
Throws:
SearchException

transformGptToCswRequest

public static String transformGptToCswRequest(SearchCriteria criteria,
                                              SearchEngineCSW.SEARCH_OPERATION operation)
                                       throws SearchException
Transform GPT criteria to CSW request.

Parameters:
criteria - the criteria
operation - Type of operation to be appended into DOM.
Returns:
the string (trimmed, never null)
Throws:
SearchException - the search exception

marshallRecords

protected void marshallRecords(CswRecords cswRecords)
                        throws SearchException
Marshall CSW client records and gpt search records.

Parameters:
cswRecords - the CSW records
Throws:
SearchException

marshallRecord

protected SearchResultRecord marshallRecord(CswRecord cswRecord)
                                     throws SearchException
Marshall record. Converts csw client record to search result record.

Parameters:
cswRecord - the csw record
Returns:
the search result record
Throws:
SearchException

getCswProfile

protected CswProfile getCswProfile()
                            throws SearchException
Gets the csw profile.

Returns:
the csw profile
Throws:
SearchException - the search exception

getMetadataAsText

public String getMetadataAsText(String uuid)
                         throws SearchException
Gets the metadata as text.

Specified by:
getMetadataAsText in class ASearchEngine
Parameters:
uuid - (Guid or uuid, method will not verify parameter)
Returns:
Metadata as Text (possibly null)
Throws:
SearchException - the search exception

getMetadata

protected CswRecord getMetadata(String uuid)
                         throws SearchException
Gets the metadata as a csw client api record.

Parameters:
uuid - the uuid
Returns:
the metadata
Throws:
SearchException - the search exception

marshallGptToCswClientCriteria2

public static CswSearchCriteria marshallGptToCswClientCriteria2(SearchCriteria gptSearchCriteria)
Marshall gpt to csw client criteria.

Parameters:
gptSearchCriteria - the gpt search criteria
Returns:
the csw search criteria

marshallGptToCswClientCriteria

public CswSearchCriteria marshallGptToCswClientCriteria(SearchCriteria gptSearchCriteria)
Marshall gpt to csw client criteria.

Parameters:
gptSearchCriteria - the gpt search criteria
Returns:
the csw search criteria

getMetadataAsSearchResultRecord

public SearchResultRecord getMetadataAsSearchResultRecord(String uuid)
                                                   throws SearchException
Gets metadata as search result record

Specified by:
getMetadataAsSearchResultRecord in class ASearchEngine
Parameters:
uuid - Uniquie id of the record
Returns:
Search result record
Throws:
SearchException

createInstances

public Map<String,Object> createInstances(StringSet rids)
                                   throws SearchException
Creates instances

Overrides:
createInstances in class ASearchEngine
Parameters:
rids -
Returns:
Map with engine
Throws:
SearchException - (Currently does not throw an excpetion)

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.