org.dspace.app.xmlui.cocoon
Class OpenSearchGenerator

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.cocoon.OpenSearchGenerator
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 OpenSearchGenerator
extends org.apache.cocoon.generation.AbstractGenerator
implements org.apache.cocoon.caching.CacheableProcessingComponent, org.apache.avalon.excalibur.pool.Recyclable

Generate an OpenSearch-compliant search results document for DSpace, either a community or collection or the whole repository. Once thing that has been modified from DSpace's JSP implementation is what is placed inside an item's description, we've changed it so that the list of metadata fields is scanned until a value is found and the first one found is used as the description. This means that we look at the abstract, description, alternative title, title, etc... to and the first metadata value found is used. 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

Field Summary
 
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
OpenSearchGenerator()
           
 
Method Summary
 void generate()
          Generate the search results document.
 java.io.Serializable getKey()
          Generate the unique caching key.
 org.apache.excalibur.source.SourceValidity getValidity()
          Generate the cache validity object.
 void recycle()
          Recycle
 void setup(org.apache.cocoon.environment.SourceResolver resolver, java.util.Map objectModel, java.lang.String src, org.apache.avalon.framework.parameters.Parameters par)
          Setup configuration for this request
 
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.xml.XMLProducer
setConsumer
 

Constructor Detail

OpenSearchGenerator

public OpenSearchGenerator()
Method Detail

getKey

public java.io.Serializable getKey()
Generate the unique caching key. This key must be unique inside the space of this component.

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

getValidity

public org.apache.excalibur.source.SourceValidity getValidity()
Generate the cache validity object.

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

setup

public void setup(org.apache.cocoon.environment.SourceResolver resolver,
                  java.util.Map objectModel,
                  java.lang.String src,
                  org.apache.avalon.framework.parameters.Parameters par)
           throws org.apache.cocoon.ProcessingException,
                  org.xml.sax.SAXException,
                  java.io.IOException
Setup configuration for this request

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

generate

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

Specified by:
generate in interface org.apache.cocoon.generation.Generator
Throws:
java.io.IOException
org.xml.sax.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 org.apache.cocoon.generation.AbstractGenerator


Copyright © 2010 DuraSpace. All Rights Reserved.