Package org.ametys.cms.content
Class ContentFileReader
- java.lang.Object
 - 
- org.apache.avalon.framework.logger.AbstractLogEnabled
 - 
- org.apache.cocoon.reading.AbstractReader
 - 
- org.ametys.core.util.cocoon.AbstractResourceReader
 - 
- org.ametys.cms.content.ContentFileReader
 
 
 
 
 
- 
- All Implemented Interfaces:
 Poolable,Recyclable,Component,LogEnabled,CacheableProcessingComponent,Reader,SitemapModelComponent,SitemapOutputComponent
public class ContentFileReader extends AbstractResourceReader implements CacheableProcessingComponent
Reader for binary or file metadata. 
- 
- 
Field Summary
Fields Modifier and Type Field Description private String_attributeprivate Content_contentprivate File_fileprivate String_path- 
Fields inherited from class org.ametys.core.util.cocoon.AbstractResourceReader
__ALLOWED_FORMATS, __DEFAULT_FORMAT 
- 
Fields inherited from class org.apache.cocoon.reading.AbstractReader
objectModel, out, parameters, resolver, source 
 - 
 
- 
Constructor Summary
Constructors Constructor Description ContentFileReader() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RichText_getMeta(CompositeMetadata meta, String metadataName)Get the rich text metavoiddoSetup(SourceResolver res, Map objModel, String src, Parameters par)protected StringgetEncodedFilename()If needed, returns the resource's name, properly encoded for using in a "Content-Disposition" HTTP header.
May be null, in which case the result ofAbstractResourceReader.getFilename()is used instead.protected StringgetFilename()Returns the resource's name.protected InputStreamgetInputStream()Returns the resource'sInputStream.SerializablegetKey()longgetLastModified()protected longgetLength()Returns the resource's length.StringgetMimeType()SourceValiditygetValidity()voidrecycle()- 
Methods inherited from class org.ametys.core.util.cocoon.AbstractResourceReader
generate, generateThumbnail, getKeySuffix, processImage, setup 
- 
Methods inherited from class org.apache.cocoon.reading.AbstractReader
setOutputStream, shouldSetContentLength 
- 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
ContentFileReader
public ContentFileReader()
 
 - 
 
- 
Method Detail
- 
doSetup
public void doSetup(SourceResolver res, Map objModel, String src, Parameters par) throws ProcessingException, IOException
Description copied from class:AbstractResourceReaderCalled byAbstractResourceReader.setup(SourceResolver, Map, String, Parameters). This method should be implemented by subclasses to retrieve the actual resource.- Specified by:
 doSetupin classAbstractResourceReader- Parameters:
 res- theSourceResolver.objModel- the Cocoon's object model.src- the source, as given by the sitemap.par- the parameters, as given by the sitemap.- Throws:
 ProcessingException- if an error occurs while processing the resource.IOException- if an error occurs while accessing the resource.
 
- 
getKey
public Serializable getKey()
- Specified by:
 getKeyin interfaceCacheableProcessingComponent
 
- 
getValidity
public SourceValidity getValidity()
- Specified by:
 getValidityin interfaceCacheableProcessingComponent
 
- 
getLastModified
public long getLastModified()
- Specified by:
 getLastModifiedin interfaceReader- Overrides:
 getLastModifiedin classAbstractReader
 
- 
getMimeType
public String getMimeType()
- Specified by:
 getMimeTypein interfaceSitemapOutputComponent- Overrides:
 getMimeTypein classAbstractReader
 
- 
getInputStream
protected InputStream getInputStream()
Description copied from class:AbstractResourceReaderReturns the resource'sInputStream.- Specified by:
 getInputStreamin classAbstractResourceReader- Returns:
 - the resource's 
InputStream. 
 
- 
getFilename
protected String getFilename()
Description copied from class:AbstractResourceReaderReturns the resource's name.- Specified by:
 getFilenamein classAbstractResourceReader- Returns:
 - the resource's name.
 
 
- 
getEncodedFilename
protected String getEncodedFilename()
Description copied from class:AbstractResourceReaderIf needed, returns the resource's name, properly encoded for using in a "Content-Disposition" HTTP header.
May be null, in which case the result ofAbstractResourceReader.getFilename()is used instead.- Specified by:
 getEncodedFilenamein classAbstractResourceReader- Returns:
 - the encoded resource's name, if any.
 
 
- 
getLength
protected long getLength()
Description copied from class:AbstractResourceReaderReturns the resource's length.- Specified by:
 getLengthin classAbstractResourceReader- Returns:
 - the resource's length.
 
 
- 
_getMeta
protected RichText _getMeta(CompositeMetadata meta, String metadataName)
Get the rich text meta- Parameters:
 meta- The composite metametadataName- The metadata name (with /)- Returns:
 - The rich text meta
 
 
- 
recycle
public void recycle()
- Specified by:
 recyclein interfaceRecyclable- Overrides:
 recyclein classAbstractReader
 
 - 
 
 -