Package org.ametys.plugins.flipbook
Class AbstractConvertDocument2ImagesComponent
- java.lang.Object
- 
- org.apache.avalon.framework.logger.AbstractLogEnabled
- 
- org.ametys.plugins.flipbook.AbstractConvertDocument2ImagesComponent
 
 
- 
- All Implemented Interfaces:
- Initializable,- Component,- LogEnabled,- Serviceable,- ThreadSafe
 - Direct Known Subclasses:
- ConvertContentAttachment2ImagesComponent,- ConvertExternalResource2ImagesComponent,- ConvertMetadata2ImagesComponent,- ConvertResource2ImagesComponent
 
 public abstract class AbstractConvertDocument2ImagesComponent extends AbstractLogEnabled implements ThreadSafe, Initializable, Serviceable, Component Document to images action: converts the document into one image per page if it is not already done.
- 
- 
Field SummaryFields Modifier and Type Field Description protected Context_cocoonContextThe cocoon contextprotected Document2ImagesConvertor_documentToImagesThe document to images convertor.private ConcurrentMap<String,ReentrantLock>_locksMap of locks, indexed by resource ID.protected AmetysObjectResolver_resolverThe ametys object resolver.
 - 
Constructor SummaryConstructors Constructor Description AbstractConvertDocument2ImagesComponent()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Stringcache(String relativeCachePath, String md5sum, InputStream documentInputStream, String documentName, String documentId, String documentMimeType)Create the images and put it into the cacheprotected voidcreateImages(InputStream documentInputStream, String documentName, File baseFolder)Create images for a resource, in a specified folder.voidinitialize()protected booleanisMimeTypeSupported(String mimeType)Test if the mimetype is supported for conversionvoidservice(ServiceManager serviceManager)- 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabledenableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
- 
 
- 
- 
- 
Field Detail- 
_resolverprotected AmetysObjectResolver _resolver The ametys object resolver.
 - 
_documentToImagesprotected Document2ImagesConvertor _documentToImages The document to images convertor.
 - 
_cocoonContextprotected Context _cocoonContext The cocoon context
 - 
_locksprivate ConcurrentMap<String,ReentrantLock> _locks Map of locks, indexed by resource ID.
 
- 
 - 
Constructor Detail- 
AbstractConvertDocument2ImagesComponentpublic AbstractConvertDocument2ImagesComponent() 
 
- 
 - 
Method Detail- 
initializepublic void initialize() throws Exception - Specified by:
- initializein interface- Initializable
- Throws:
- Exception
 
 - 
servicepublic void service(ServiceManager serviceManager) throws ServiceException - Specified by:
- servicein interface- Serviceable
- Throws:
- ServiceException
 
 - 
isMimeTypeSupportedprotected boolean isMimeTypeSupported(String mimeType) Test if the mimetype is supported for conversion- Parameters:
- mimeType- the mime type
- Returns:
- true if the mimetype can be transformed
 
 - 
cacheprotected String cache(String relativeCachePath, String md5sum, InputStream documentInputStream, String documentName, String documentId, String documentMimeType) throws IOException, FlipbookException Create the images and put it into the cache- Parameters:
- relativeCachePath- the path of the relative cache
- md5sum- the md5 sum
- documentInputStream- the input stream of the document
- documentName- the document's name
- documentId- the id of the document
- documentMimeType- the mime type of the document
- Returns:
- The absolute cache path
- Throws:
- IOException- if an error occurs while manipulating files
- FlipbookException- if an error occurs while manipulating the flipbook
- UnsupportedOperationException- If the mime type is not supported
 
 - 
createImagesprotected void createImages(InputStream documentInputStream, String documentName, File baseFolder) throws IOException, FlipbookException Create images for a resource, in a specified folder.- Parameters:
- documentInputStream- the input stream of the document
- documentName- the name of the document
- baseFolder- the base folder.
- Throws:
- IOException- if an error occurs while manipulating files
- FlipbookException- if an error occurs while manipulating the flipbook
 
 
- 
 
-