org.dspace.app.xmlui.opensearch
Class AbstractOpenSearchGenerator

java.lang.Object
  extended by org.apache.cocoon.util.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.generation.AbstractGenerator
              extended by org.dspace.app.xmlui.opensearch.AbstractOpenSearchGenerator
All Implemented Interfaces:
org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.cocoon.caching.CacheableProcessingComponent, org.apache.cocoon.generation.Generator, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.xml.XMLProducer
Direct Known Subclasses:
DiscoveryOpenSearchGenerator, StandardOpenSearchGenerator

public abstract class AbstractOpenSearchGenerator
extends org.apache.cocoon.generation.AbstractGenerator
implements org.apache.cocoon.caching.CacheableProcessingComponent, org.apache.avalon.excalibur.pool.Recyclable

This class provides the common attributes and methods for parameter parsing, cache key and validity generations. Parameters are parsed, sanitized and default values are assigned to them. Subclasses requiring a custom parameter parsing is able to overwrite this setup() method, but in most cases, this method should be enough.

Author:
Richard Rodgers, Nestor Oviedo

Field Summary
static int DEFAULT_RPP
          default value for results per page parameter
protected  String format
          The results requested format
static int MAX_RPP
          max allowed value for results per page parameter
protected  String query
          the search query string
protected  Document resultsDoc
          the results document (cached)
protected  int rpp
          results per page
protected  DSpaceObject scope
          optional search scope (= handle of container) or null
protected  SortOption sort
          optional sort specification
protected  String sortOrder
          sort order, see SortOption
protected  int start
          first result index
 
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.generation.Generator
ROLE
 
Constructor Summary
AbstractOpenSearchGenerator()
           
 
Method Summary
 Serializable getKey()
          Generate the unique caching key.
 org.apache.excalibur.source.SourceValidity getValidity()
          Generate the cache validity object, based on the websvc.opensearch.validity config property
 void recycle()
          Recycle
 void setup(org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String src, org.apache.avalon.framework.parameters.Parameters par)
          Setup configuration for this request, parameter parsing and sanitization.
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.generation.Generator
generate
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

format

protected String format
The results requested format


query

protected String query
the search query string


scope

protected DSpaceObject scope
optional search scope (= handle of container) or null


sort

protected SortOption sort
optional sort specification


sortOrder

protected String sortOrder
sort order, see SortOption


rpp

protected int rpp
results per page


start

protected int start
first result index


resultsDoc

protected Document resultsDoc
the results document (cached)


DEFAULT_RPP

public static int DEFAULT_RPP
default value for results per page parameter


MAX_RPP

public static int MAX_RPP
max allowed value for results per page parameter

Constructor Detail

AbstractOpenSearchGenerator

public AbstractOpenSearchGenerator()
Method Detail

getKey

public Serializable getKey()
Generate the unique caching key. This key includes the concrete class name to ensure uniqueness

Specified by:
getKey in interface org.apache.cocoon.caching.CacheableProcessingComponent

getValidity

public org.apache.excalibur.source.SourceValidity getValidity()
Generate the cache validity object, based on the websvc.opensearch.validity config property

Specified by:
getValidity in interface org.apache.cocoon.caching.CacheableProcessingComponent

setup

public void setup(org.apache.cocoon.environment.SourceResolver resolver,
                  Map objectModel,
                  String src,
                  org.apache.avalon.framework.parameters.Parameters par)
           throws org.apache.cocoon.ProcessingException,
                  SAXException,
                  IOException
Setup configuration for this request, parameter parsing and sanitization. This methods should be overwrite only if the subclass requires a different parameter parsing

Specified by:
setup in interface org.apache.cocoon.sitemap.SitemapModelComponent
Overrides:
setup in class org.apache.cocoon.generation.AbstractGenerator
Throws:
org.apache.cocoon.ProcessingException
SAXException
IOException

recycle

public void recycle()
Recycle

Specified by:
recycle in interface org.apache.avalon.excalibur.pool.Recyclable
Overrides:
recycle in class org.apache.cocoon.generation.AbstractGenerator


Copyright © 2012 DuraSpace. All Rights Reserved.