org.dspace.app.xmlui.cocoon
Class ConcatenationReader

java.lang.Object
  extended by org.apache.cocoon.util.AbstractLogEnabled
      extended by org.apache.cocoon.reading.AbstractReader
          extended by org.apache.cocoon.reading.ResourceReader
              extended by org.dspace.app.xmlui.cocoon.ConcatenationReader
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.reading.Reader, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.sitemap.SitemapOutputComponent

public class ConcatenationReader
extends org.apache.cocoon.reading.ResourceReader

Concatenates and Minifies CSS, JS and JSON files The URL of the resource can contain references to multiple files: e.g."themes/Mirage/lib/css/reset,base,helper,style,print.css" The Reader will concatenate all these files, and output them as a single resource. If "xmlui.theme.enableMinification" is set to true, the output will also be minified prior to returning the resource. Validity is determined based upon last modified date of the most recently edited file.

Author:
Roel Van Reeth (roel at atmire dot com), Art Lowel (art dot lowel at atmire dot com), Ben Bosman (ben at atmire dot com)

Field Summary
protected  List<org.apache.excalibur.source.Source> inputSources
           
 
Fields inherited from class org.apache.cocoon.reading.ResourceReader
bufferSize, byteRanges, configuredBufferSize, configuredByteRanges, configuredExpires, configuredQuickTest, expires, inputSource, quickTest, request, response
 
Fields inherited from class org.apache.cocoon.reading.AbstractReader
objectModel, out, parameters, resolver, source
 
Fields inherited from interface org.apache.cocoon.reading.Reader
ROLE
 
Constructor Summary
ConcatenationReader()
           
 
Method Summary
 void generate()
          Generates the requested resource.
 Serializable getKey()
          Generate the unique key.
 long getLastModified()
           
 org.apache.excalibur.source.SourceValidity getValidity()
          Generate the validity object.
 void recycle()
          Recyclable
 void setup(org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String src, org.apache.avalon.framework.parameters.Parameters par)
          Setup the reader.
 
Methods inherited from class org.apache.cocoon.reading.ResourceReader
configure, getMimeType, hasRanges, processStream, setBufferSize, setByteRanges, setExpires, setQuickTest, setupHeaders
 
Methods inherited from class org.apache.cocoon.reading.AbstractReader
setOutputStream, shouldSetContentLength
 
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
 

Field Detail

inputSources

protected List<org.apache.excalibur.source.Source> inputSources
Constructor Detail

ConcatenationReader

public ConcatenationReader()
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 reader. The resource is opened to get an InputStream, the length and the last modification date

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

recycle

public void recycle()
Recyclable

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

getKey

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

Specified by:
getKey in interface org.apache.cocoon.caching.CacheableProcessingComponent
Overrides:
getKey in class org.apache.cocoon.reading.ResourceReader
Returns:
The generated key hashes the src

getValidity

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

Specified by:
getValidity in interface org.apache.cocoon.caching.CacheableProcessingComponent
Overrides:
getValidity in class org.apache.cocoon.reading.ResourceReader
Returns:
The generated validity object or null if the component is currently not cacheable.

getLastModified

public long getLastModified()
Specified by:
getLastModified in interface org.apache.cocoon.reading.Reader
Overrides:
getLastModified in class org.apache.cocoon.reading.ResourceReader
Returns:
the time the read source was last modified or 0 if it is not possible to detect

generate

public void generate()
              throws IOException,
                     org.apache.cocoon.ProcessingException
Generates the requested resource.

Specified by:
generate in interface org.apache.cocoon.reading.Reader
Overrides:
generate in class org.apache.cocoon.reading.ResourceReader
Throws:
IOException
org.apache.cocoon.ProcessingException


Copyright © 2012 DuraSpace. All Rights Reserved.