org.dspace.app.xmlui.opensearch
Class DiscoveryOpenSearchGenerator

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
                  extended by org.dspace.app.xmlui.opensearch.DiscoveryOpenSearchGenerator
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

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

Generate an OpenSearch compliant search results document for DSpace, either scoped by a collection, a community or the whole repository. This class implements the generate() method in order to issue a search using the PostgreSQL indexes. Search params are parsed by AbstractOpenSearchGenerator class. I18N: Feed's are internationalized, meaning that they may contain references to messages contained in the global messages.xml file using cocoon's i18n schema. However the library used to build the feeds does not understand this schema to work around this limitation I created a little hack. It basically works like this, when text that needs to be localized is put into the feed it is always mangled such that a prefix is added to the messages's key. Thus if the key were "xmlui.feed.text" then the resulting text placed into the feed would be "I18N:xmlui.feed.text". After the library is finished and produced it's final result the output is traversed to find these occurrences and replace them with proper cocoon i18n elements.

Author:
Richard Rodgers, Nestor Oviedo

Field Summary
 
Fields inherited from class org.dspace.app.xmlui.opensearch.AbstractOpenSearchGenerator
DEFAULT_RPP, format, MAX_RPP, query, resultsDoc, rpp, scope, sort, sortOrder, start
 
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
DiscoveryOpenSearchGenerator()
           
 
Method Summary
 void generate()
          Generate the search results document.
 void recycle()
          Recycle
 void setup(org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String src, org.apache.avalon.framework.parameters.Parameters par)
          Setup the Discovery search service.
 
Methods inherited from class org.dspace.app.xmlui.opensearch.AbstractOpenSearchGenerator
getKey, getValidity
 
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.caching.CacheableProcessingComponent
getKey, getValidity
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Constructor Detail

DiscoveryOpenSearchGenerator

public DiscoveryOpenSearchGenerator()
Method Detail

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 the Discovery search service. Other paramas are setup in superclass's methods

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

generate

public void generate()
              throws IOException,
                     SAXException,
                     org.apache.cocoon.ProcessingException
Generate the search results document.

Specified by:
generate in interface org.apache.cocoon.generation.Generator
Throws:
IOException
SAXException
org.apache.cocoon.ProcessingException

recycle

public void recycle()
Recycle

Specified by:
recycle in interface org.apache.avalon.excalibur.pool.Recyclable
Overrides:
recycle in class AbstractOpenSearchGenerator


Copyright © 2012 DuraSpace. All Rights Reserved.