Class AbstractViewerService
- java.lang.Object
-
- org.silverpeas.core.viewer.service.AbstractViewerService
-
- Direct Known Subclasses:
DefaultPreviewService
,DefaultViewService
public abstract class AbstractViewerService extends Object
- Author:
- Yohann Chastagnier
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractViewerService.ViewerProcess<R extends Serializable>
This class handles the execution of aAbstractViewerService.ViewerTreatment
.protected static interface
AbstractViewerService.ViewerTreatment<R>
-
Field Summary
Fields Modifier and Type Field Description static String
PDF_DOCUMENT_EXTENSION
-
Constructor Summary
Constructors Constructor Description AbstractViewerService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected File
changeFileExtension(File file, String fileExtension)
Changes the extension of the specified file with the given one.protected File
generateTmpFile(ViewerContext viewerContext, String fileExtension)
Generates a temporary file.protected <R extends Serializable>
AbstractViewerService.ViewerProcess<R>process(String processName, AbstractViewerService.ViewerTreatment<R> viewerTreatment)
This method allows to start the setting of aAbstractViewerService.ViewerTreatment
.
It manages also a cache mechanism in order to avoid taking too much resources at the same time and also in order to preserve space in the filesystem.
-
-
-
Field Detail
-
PDF_DOCUMENT_EXTENSION
public static final String PDF_DOCUMENT_EXTENSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
generateTmpFile
protected File generateTmpFile(ViewerContext viewerContext, String fileExtension)
Generates a temporary file.- Parameters:
fileExtension
- the extension of the temporary file.- Returns:
- the generated temporary file.
-
changeFileExtension
protected File changeFileExtension(File file, String fileExtension)
Changes the extension of the specified file with the given one.- Parameters:
fileExtension
- the extension to use.- Returns:
- the file with the new extension.
-
process
protected <R extends Serializable> AbstractViewerService.ViewerProcess<R> process(String processName, AbstractViewerService.ViewerTreatment<R> viewerTreatment)
This method allows to start the setting of aAbstractViewerService.ViewerTreatment
.
It manages also a cache mechanism in order to avoid taking too much resources at the same time and also in order to preserve space in the filesystem.- Type Parameters:
R
- the concrete type of the object on which the treatment works.- Parameters:
processName
- the name of the process (preview for example).viewerTreatment
- the treatment to perform.- Returns:
- the result of the process.
-
-