Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| deegree 2.4 (2010/11/11 10:47 build-27-official)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.deegree.portal.standard.csw.control
Class SimpleSearchListener

    java.lang.Object
      org.deegree.enterprise.control.AbstractListener
          org.deegree.portal.standard.csw.control.SimpleSearchListener

All Implemented Interfaces:
  EventListener, WebListener

Direct Known Subclasses:
  AddToShoppingCartListener, DetailedSearchListener, OverviewMetadataListener, SeriesChildrenSearchListener, TurnPageListener

    public class SimpleSearchListener

extends AbstractListener

A `${type_name}` class.
This listener does more than just search for data. It searches for data *and* then searches if there are services (WMS, WFS) available, which provide this data.

Version:
  $Revision: 19184 $, $Date: 2009-08-17 18:07:01 +0200 (Mo, 17. Aug 2009) $
Author:
  Judit Mays, last edited by: $Author: jmays $

Field Summary
`protected CSWClientConfiguration` | `config`
`static String` | `HTML_FRAGMENT` used in jsp pages
`protected NamespaceContext` | `nsContext`
`(package private) static String` | `RESULT_SEARCH`
`(package private) static String` | `RPC_CATALOG`
`(package private) static String` | `RPC_FORMAT`
`(package private) static String` | `SESSION_AVAILABLESERVICECATALOGS`
`(package private) static String` | `SESSION_DATARECORDS`
`(package private) static String` | `SESSION_REQUESTFORRESULTS`
`(package private) static String` | `SESSION_RESULTFORHITS`

Constructor Summary
`SimpleSearchListener()`

Method Summary
`void` | `actionPerformed(FormEvent event)`
`protected List<DataSessionRecord>` | `createDataSessionRecords(HashMap results)` Created a list of DataSessionRecord from all the returned results
`protected String` | `createRequest(RPCStruct rpcStruct, String format, String resultType)` This method creates a csw request with the RequestFactory of the passed format, using the paramter values passed in the rpcStruct.
`protected RPCStruct` | `createRpcStructForServiceSearch(String template, String identifier)` Creates an RPC request from the given template
`protected Map` | `doServiceSearch(HashMap result, String format, String resultType)` Invokes a GetRecords request with type RESULT to get the actual records for all the metadata returned during the GetRecords request with type HIT
`protected List` | `extractMetadata(Document doc)` Extracts all Metadata nodes from the passed csw:GetRecordsResponse Document.
`protected List` | `extractRPCCatalogs(RPCWebEvent rpcEvent)` Extracts the catalog names from the first parameter of the params element within the passed rpcEvent.
`protected Object` | `extractRPCMember(RPCStruct struct, String member)` Extracts the member of the passed name from the passed struct.
`protected RPCParameter[]` | `extractRPCParameters(RPCWebEvent rpcEvent)` Extracts the parameters from the method call element within the passed rpcEvent.
`protected RPCStruct` | `extractRPCStruct(RPCWebEvent rpcEvent, int index)` Extracts the `RPCStruct` from the indicated parameter in the params element of the passed `RPCWebEvent`.
`protected String` | `extractValue(Node node, String xPath)` Extracts node value
`protected String` | `getMetadataType(Element docElem)` Checks if the metadata is of series, dataset, application or service type
`protected String` | `getXPathToId(Element docElem)`
`protected String` | `getXPathToTitle(Element docElement)`
`protected void` | `handleResult(Object resultHits, Object resultResults, String pathToXslFile)` Handles the result of the search requests and transforms the result to HTML using xslt, then saves the transformed result into the session
`protected boolean` | `isKnownMetadataType(Element docElem)` Checks whether the metadata document is of a known type.
`protected HashMap` | `performRequest(String protocol, String request, List catalogs)` Performs the CSW request and returns the result as a HashMap
`protected void` | `validateRequest(RPCWebEvent rpcEvent)` Validates the rpc request and makes sure that all the needed parameters are included

Methods inherited from class org.deegree.enterprise.control.AbstractListener
`getAlternativeNextPage, getHomePath, getInitParameter, getInitParameterList, getNextPage, getRequest, getReturnValue, gotoErrorPage, handle, setAlternativeNextPage, setDefaultAlternativeNextPage, setDefaultNextPage, setNextPage, setReturnValue, toModel`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### HTML_FRAGMENT

    public static final String HTML_FRAGMENT

  used in jsp pages

  See Also:
    Constant Field Values

### RESULT_SEARCH

    static final String RESULT_SEARCH

See Also:
  Constant Field Values

### RPC_CATALOG

    static final String RPC_CATALOG

See Also:
  Constant Field Values

### RPC_FORMAT

    static final String RPC_FORMAT

See Also:
  Constant Field Values

### SESSION_AVAILABLESERVICECATALOGS

    static final String SESSION_AVAILABLESERVICECATALOGS

See Also:
  Constant Field Values

### SESSION_DATARECORDS

    static final String SESSION_DATARECORDS

See Also:
  Constant Field Values

### SESSION_REQUESTFORRESULTS

    static final String SESSION_REQUESTFORRESULTS

See Also:
  Constant Field Values

### SESSION_RESULTFORHITS

    static final String SESSION_RESULTFORHITS

See Also:
  Constant Field Values

### config

    protected CSWClientConfiguration config

### nsContext

    protected NamespaceContext nsContext

Constructor Detail

### SimpleSearchListener

    public SimpleSearchListener()

Method Detail

### actionPerformed

    public void actionPerformed(FormEvent event)

  Specified by:
    `actionPerformed` in interface `WebListener`
  Specified by:
    `actionPerformed` in class `AbstractListener`

### validateRequest

    protected void validateRequest(RPCWebEvent rpcEvent)
                            throws CatalogClientException

  Validates the rpc request and makes sure that all the needed parameters are included

  Parameters:
    `rpcEvent` -
  Throws:
    `CatalogClientException`

### createRequest

    protected String createRequest(RPCStruct rpcStruct,
                                   String format,
                                   String resultType)
                            throws CatalogClientException

  This method creates a csw request with the RequestFactory of the passed format, using the paramter values passed in the rpcStruct. (csw:GetRecords request, if the passed resultType is HITS or RESULTS, and csw:GetRecordsById request, if the passed resultType is null).

  Parameters:
    `rpcStruct` - The struct contains parameter values to be used in the RequestFactory.
    `format` - The format determines the RequestFactory to be used.
    `resultType` - The type of desired result. Possible values are HITS or RESULTS or null.
  Returns:
    Returns the xml encoded request as `String`.
  Throws:
    `CatalogClientException`

### performRequest

    protected HashMap performRequest(String protocol,
                                     String request,
                                     List catalogs)
                              throws CatalogClientException

  Performs the CSW request and returns the result as a HashMap

  Parameters:
    `protocol` -
    `request` -
    `catalogs` -
  Returns:
    Returns a `HashMap`, which contains one key-value-pair for each catalogue, that has been searched. The key is the name of the catalogue. The value is the doc Document, that contains the number of matches (resultType="HITS"), or 1 to n metadata entries (resultType="RESULTS")
  Throws:
    `CatalogClientException`

### handleResult

    protected void handleResult(Object resultHits,
                                Object resultResults,
                                String pathToXslFile)
                         throws XMLParsingException,
                                CatalogClientException

  Handles the result of the search requests and transforms the result to HTML using xslt, then saves the transformed result into the session

  Parameters:
    `resultHits` -
    `resultResults` -
    `pathToXslFile` - e.g. file://$iGeoPortal_home$/WEB-INF/conf/igeoportal/metaList2html.xsl
  Throws:
    `XMLParsingException` - if the documents contained in resultHits don't have the expected structure.
    `CatalogClientException`

### createDataSessionRecords

    protected List<DataSessionRecord> createDataSessionRecords(HashMap results)
                                                        throws CatalogClientException

  Created a list of DataSessionRecord from all the returned results

  Parameters:
    `results` -
  Returns:
    Returns a List of distinct DataSessionRecords for all metadata elements within the passed results.
  Throws:
    `CatalogClientException` - if the identifier or the title of a metadata element could not be extracted.

### extractMetadata

    protected List extractMetadata(Document doc)
                            throws CatalogClientException,
                                   XMLParsingException

  Extracts all Metadata nodes from the passed csw:GetRecordsResponse Document.

  Parameters:
    `doc` - The csw:GetRecordsResponse Document from which to extract the Metadata nodes.
  Returns:
    Returns a NodeList of Metadata Elements for the passed Document.
  Throws:
    `CatalogClientException` - if metadata nodes could not be extracted from the passed Document.
    `XMLParsingException`

### extractValue

    protected String extractValue(Node node,
                                  String xPath)
                           throws CatalogClientException,
                                  XMLParsingException

  Extracts node value

  Parameters:
    `node` -
    `xPath` -
  Returns:
    Returns the value for the passed node and xPath.
  Throws:
    `CatalogClientException`
    `XMLParsingException`

### doServiceSearch

    protected Map doServiceSearch(HashMap result,
                                  String format,
                                  String resultType)
                           throws CatalogClientException

  Invokes a GetRecords request with type RESULT to get the actual records for all the metadata returned during the GetRecords request with type HIT

  Parameters:
    `result` - HashMap containing data catalog names (as keys) and GetRecordResponse Documents (as values).
    `format` - some service format like "ISO19119"
    `resultType` - either "HITS" or "RESULTS".
  Returns:
    Returns a Map that contains the title extracted from the passed document (as key) and a List of all corresponding available service catalogs (as value).
  Throws:
    `CatalogClientException`

### createRpcStructForServiceSearch

    protected RPCStruct createRpcStructForServiceSearch(String template,
                                                        String identifier)
                                                 throws CatalogClientException,
                                                        RPCException

  Creates an RPC request from the given template

  Parameters:
    `template` -
    `identifier` -
  Returns:
    Returns the new rpcStruct.
  Throws:
    `CatalogClientException`
    `RPCException`

### extractRPCParameters

    protected RPCParameter[] extractRPCParameters(RPCWebEvent rpcEvent)
                                           throws CatalogClientException

  Extracts the parameters from the method call element within the passed rpcEvent.

  Parameters:
    `rpcEvent` -
  Returns:
    Returns the parameters as array of `RPCParameter`.
  Throws:
    `CatalogClientException`

### extractRPCCatalogs

    protected List extractRPCCatalogs(RPCWebEvent rpcEvent)
                               throws CatalogClientException

  Extracts the catalog names from the first parameter of the params element within the passed rpcEvent.

  Parameters:
    `rpcEvent` -
  Returns:
    Returns the catalogue names as array of `String`.
  Throws:
    `CatalogClientException`

### extractRPCStruct

    protected RPCStruct extractRPCStruct(RPCWebEvent rpcEvent,
                                         int index)
                                  throws CatalogClientException

  Extracts the `RPCStruct` from the indicated parameter in the params element of the passed `RPCWebEvent`.

  Parameters:
    `rpcEvent` - The RPCWebEvent, that contains the RPCStruct to extract.
    `index` - The index of the parameter from which to extract the RPCStruct (starting with 0).
  Returns:
    Returns the `RPCStruct` from the indicated params element.
  Throws:
    `CatalogClientException`

### extractRPCMember

    protected Object extractRPCMember(RPCStruct struct,
                                      String member)
                               throws CatalogClientException

  Extracts the member of the passed name from the passed struct.

  Parameters:
    `struct` - The rpcStruct to extract the passed member from.
    `member` - The Member to extract from the passed rpcStruct.
  Returns:
    Returns the member value object.
  Throws:
    `CatalogClientException`

### getMetadataType

    protected String getMetadataType(Element docElem)

  Checks if the metadata is of series, dataset, application or service type

  Parameters:
    `docElem` -
  Returns:
    "service": if the metadata is a service "dataset": if the metadata is a dataset "series" : if the metadata is a datasetCollection (series)

### isKnownMetadataType

    protected boolean isKnownMetadataType(Element docElem)

  Checks whether the metadata document is of a known type. The known types are "series", "dataset", "service" and "application"

  Parameters:
    `docElem` -
  Returns:
    true if it is a known metadata type, false otherwise

### getXPathToId

    protected String getXPathToId(Element docElem)

  Parameters:
    `docElem` -
  Returns:
    xPath to the record identifier

### getXPathToTitle

    protected String getXPathToTitle(Element docElement)

  Parameters:
    `docElement` -
  Returns:
    xPath to record title

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| deegree 2.4 (2010/11/11 10:47 build-27-official)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org