org.dspace.app.xmlui.cocoon
Class DSpaceFeedGenerator

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.DSpaceFeedGenerator
All Implemented Interfaces:
org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.avalon.framework.configuration.Configurable, org.apache.cocoon.caching.CacheableProcessingComponent, org.apache.cocoon.generation.Generator, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.xml.XMLProducer

public class DSpaceFeedGenerator
extends org.apache.cocoon.generation.AbstractGenerator
implements org.apache.avalon.framework.configuration.Configurable, org.apache.cocoon.caching.CacheableProcessingComponent, org.apache.avalon.excalibur.pool.Recyclable

Generate a syndication feed for DSpace, either a community or collection or the whole repository. This code was adapted from the syndication found in DSpace's JSP implementation, "org.dspace.app.webui.servlet.FeedServlet". 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 refrences 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 basicaly works like this, when text that needs to be localized is put into the feed it is allways 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 occurances ande replace them with proper cocoon i18n elements.

Author:
Scott Phillips, Ben Bosman, 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
DSpaceFeedGenerator()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
          Setup component wide configuration
 void generate()
          Generate the syndication feed.
 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, Map objectModel, 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

DSpaceFeedGenerator

public DSpaceFeedGenerator()
Method Detail

getKey

public 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. The validity object will include the collection being viewed and all recently submitted items. This does not include the community / collection hierarch, when this changes they will not be reflected in the cache.

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

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Setup component wide configuration

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

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

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

generate

public void generate()
              throws IOException,
                     SAXException,
                     org.apache.cocoon.ProcessingException
Generate the syndication feed.

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 org.apache.cocoon.generation.AbstractGenerator


Copyright © 2011 DuraSpace. All Rights Reserved.