public abstract class AbstractConvertDocument2ImagesComponent extends AbstractLogEnabled implements ThreadSafe, Initializable, Serviceable, Component
Modifier and Type | Field and Description |
---|---|
protected Context |
_cocoonContext
The cocoon context
|
protected Document2ImagesConvertor |
_documentToImages
The document to images convertor.
|
private ConcurrentMap<String,ReentrantLock> |
_locks
Map of locks, indexed by resource ID.
|
protected AmetysObjectResolver |
_resolver
The ametys object resolver.
|
Constructor and Description |
---|
AbstractConvertDocument2ImagesComponent() |
Modifier and Type | Method and Description |
---|---|
protected String |
cache(String relativeCachePath,
String md5sum,
InputStream documentInputStream,
String documentName,
String documentId,
String documentMimeType)
Create the images and put it into the cache
|
protected void |
createImages(InputStream documentInputStream,
String documentName,
File baseFolder)
Create images for a resource, in a specified folder.
|
void |
initialize() |
protected boolean |
isMimeTypeSupported(String mimeType)
Test if the mimetype is supported for conversion
|
void |
service(ServiceManager serviceManager) |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
protected AmetysObjectResolver _resolver
protected Document2ImagesConvertor _documentToImages
protected Context _cocoonContext
private ConcurrentMap<String,ReentrantLock> _locks
public AbstractConvertDocument2ImagesComponent()
public void initialize() throws Exception
initialize
in interface Initializable
Exception
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
ServiceException
protected boolean isMimeTypeSupported(String mimeType)
mimeType
- the mime typeprotected String cache(String relativeCachePath, String md5sum, InputStream documentInputStream, String documentName, String documentId, String documentMimeType) throws IOException, FlipbookException
relativeCachePath
- the path of the relative cachemd5sum
- the md5 sumdocumentInputStream
- the input stream of the documentdocumentName
- the document's namedocumentId
- the id of the documentdocumentMimeType
- the mime type of the documentIOException
- if an error occurs while manipulating filesFlipbookException
- if an error occurs while manipulating the flipbookUnsupportedOperationException
- If the mime type is not supportedprotected void createImages(InputStream documentInputStream, String documentName, File baseFolder) throws IOException, FlipbookException
documentInputStream
- the input stream of the documentdocumentName
- the name of the documentbaseFolder
- the base folder.IOException
- if an error occurs while manipulating filesFlipbookException
- if an error occurs while manipulating the flipbook