public abstract class DLPreviewableProcessor extends Object implements DLProcessor
Modifier and Type | Field and Description |
---|---|
static String |
DECRYPT_PATH |
static String |
DECRYPT_TMP_PATH |
protected Map<String,Future<?>> |
futures |
static String |
PREVIEW_PATH |
static String |
PREVIEW_TMP_PATH |
static long |
REPOSITORY_ID |
static int |
THUMBNAIL_INDEX_CUSTOM_1 |
static int |
THUMBNAIL_INDEX_CUSTOM_2 |
static int |
THUMBNAIL_INDEX_DEFAULT |
static String |
THUMBNAIL_PATH |
static String |
THUMBNAIL_TMP_PATH |
static String |
TMP_PATH |
Constructor and Description |
---|
DLPreviewableProcessor() |
Modifier and Type | Method and Description |
---|---|
protected void |
addFileToStore(long companyId,
String dirName,
String filePath,
File srcFile) |
protected void |
addFileToStore(long companyId,
String dirName,
String filePath,
InputStream is) |
void |
cleanUp(FileEntry fileEntry)
Cleans up any resources that the processor created for the file entry.
|
void |
cleanUp(FileVersion fileVersion)
Cleans up any resources that the processor created for the given file
version.
|
void |
copy(FileVersion sourceFileVersion,
FileVersion destinationFileVersion)
Copies all resources generated for the source file version, reusing them
for destination file version.
|
protected void |
copyPreviews(FileVersion sourceFileVersion,
FileVersion destinationFileVersion) |
protected void |
copyThumbnail(FileVersion sourceFileVersion,
FileVersion destinationFileVersion,
int index) |
protected void |
copyThumbnails(FileVersion sourceFileVersion,
FileVersion destinationFileVersion) |
static void |
deleteFiles() |
void |
deleteFiles(FileEntry fileEntry,
String thumbnailType) |
void |
deleteFiles(FileVersion fileVersion,
String thumbnailType) |
protected void |
deleteFiles(long companyId,
long groupId,
long fileEntryId,
long fileVersionId,
String thumbnailType) |
protected void |
deletePreviews(long companyId,
long groupId,
long fileEntryId,
long fileVersionId) |
protected void |
deleteThumbnail(long companyId,
long groupId,
long fileEntryId,
long fileVersionId,
String thumbnailType,
int index) |
protected void |
deleteThumbnails(long companyId,
long groupId,
long fileEntryId,
long fileVersionId,
String thumbnailType) |
protected void |
destroyProcess(String processIdentity) |
protected abstract void |
doExportGeneratedFiles(PortletDataContext portletDataContext,
FileEntry fileEntry,
Element fileEntryElement) |
protected InputStream |
doGetPreviewAsStream(FileVersion fileVersion,
int index,
String type) |
protected InputStream |
doGetPreviewAsStream(FileVersion fileVersion,
String type) |
protected int |
doGetPreviewFileCount(FileVersion fileVersion) |
protected long |
doGetPreviewFileSize(FileVersion fileVersion,
int index) |
protected long |
doGetPreviewFileSize(FileVersion fileVersion,
int index,
String type) |
protected long |
doGetPreviewFileSize(FileVersion fileVersion,
String type) |
protected InputStream |
doGetThumbnailAsStream(FileVersion fileVersion,
int index) |
protected long |
doGetThumbnailFileSize(FileVersion fileVersion,
int index) |
protected abstract void |
doImportGeneratedFiles(PortletDataContext portletDataContext,
FileEntry fileEntry,
FileEntry importedFileEntry,
Element fileEntryElement) |
protected void |
exportBinary(PortletDataContext portletDataContext,
Element fileEntryElement,
FileVersion fileVersion,
InputStream is,
String binPath,
String binPathName) |
void |
exportGeneratedFiles(PortletDataContext portletDataContext,
FileEntry fileEntry,
Element fileEntryElement)
Exports any resources generated for the file entry into file entry
element.
|
protected void |
exportPreview(PortletDataContext portletDataContext,
FileEntry fileEntry,
Element fileEntryElement,
String binPathSuffix,
String previewType) |
protected void |
exportPreview(PortletDataContext portletDataContext,
FileEntry fileEntry,
Element fileEntryElement,
String binPathSuffix,
String previewType,
int fileIndex) |
protected void |
exportThumbnail(PortletDataContext portletDataContext,
FileEntry fileEntry,
Element fileEntryElement,
String binPathName,
int index) |
protected void |
exportThumbnails(PortletDataContext portletDataContext,
FileEntry fileEntry,
Element fileEntryElement,
String binPathSuffix) |
protected String |
getBinPath(PortletDataContext portletDataContext,
FileEntry fileEntry,
int index) |
protected String |
getBinPath(PortletDataContext portletDataContext,
FileEntry fileEntry,
String type) |
protected File |
getDecryptedTempFile(String id) |
protected abstract List<Long> |
getFileVersionIds() |
protected static String |
getPathSegment(FileVersion fileVersion,
boolean preview) |
protected static String |
getPathSegment(long groupId,
long fileEntryId,
long fileVersionId,
boolean preview) |
protected String |
getPreviewFilePath(FileVersion fileVersion) |
protected String |
getPreviewFilePath(FileVersion fileVersion,
int index) |
protected String |
getPreviewFilePath(FileVersion fileVersion,
int index,
String type) |
protected String |
getPreviewFilePath(FileVersion fileVersion,
String type) |
protected String |
getPreviewFilePath(long groupId,
long fileEntryId,
long fileVersionId,
int index,
String type) |
protected String |
getPreviewFilePath(long groupId,
long fileEntryId,
long fileVersionId,
String type) |
protected File |
getPreviewTempFile(String id) |
protected File |
getPreviewTempFile(String id,
int index) |
protected File |
getPreviewTempFile(String id,
int index,
String type) |
protected File |
getPreviewTempFile(String id,
String type) |
protected int |
getPreviewTempFileCount(FileVersion fileVersion) |
protected int |
getPreviewTempFileCount(FileVersion fileVersion,
String type) |
protected String |
getPreviewTempFilePath(String id) |
protected String |
getPreviewTempFilePath(String id,
int index) |
protected String |
getPreviewTempFilePath(String id,
int index,
String type) |
protected String |
getPreviewTempFilePath(String id,
String type) |
protected String |
getPreviewType() |
protected abstract String |
getPreviewType(FileVersion fileVersion) |
protected String |
getPreviewType(int index) |
protected String[] |
getPreviewTypes() |
protected String |
getThumbnailFilePath(FileVersion fileVersion,
int index) |
protected String |
getThumbnailFilePath(FileVersion fileVersion,
String type,
int index) |
protected String |
getThumbnailFilePath(long groupId,
long fileEntryId,
long fileVersionId,
String thumbnailType,
int index) |
protected File |
getThumbnailTempFile(String id) |
protected File |
getThumbnailTempFile(String id,
String type) |
protected String |
getThumbnailTempFilePath(String id) |
protected String |
getThumbnailTempFilePath(String id,
String type) |
protected String |
getThumbnailType() |
protected abstract String |
getThumbnailType(FileVersion fileVersion) |
protected boolean |
hasPreview(FileVersion fileVersion,
String type) |
protected boolean |
hasPreviews(FileVersion fileVersion) |
protected boolean |
hasThumbnail(FileVersion fileVersion,
int index) |
protected boolean |
hasThumbnails(FileVersion fileVersion) |
void |
importGeneratedFiles(PortletDataContext portletDataContext,
FileEntry fileEntry,
FileEntry importedFileEntry,
Element fileEntryElement)
Imports any existing resources from the file entry or file entry element.
|
protected void |
importPreview(PortletDataContext portletDataContext,
FileEntry fileEntry,
FileEntry importedFileEntry,
Element fileEntryElement,
String binPathSuffix,
String previewType) |
protected void |
importPreview(PortletDataContext portletDataContext,
FileEntry fileEntry,
FileEntry importedFileEntry,
Element fileEntryElement,
String binPathSuffix,
String previewType,
int fileIndex) |
protected void |
importPreviewFromLAR(PortletDataContext portletDataContext,
FileEntry fileEntry,
Element fileEntryElement,
String binPathSuffix,
String previewType,
int fileIndex) |
protected void |
importThumbnail(PortletDataContext portletDataContext,
FileEntry fileEntry,
FileEntry importedFileEntry,
Element fileEntryElement,
String binPathName,
int index) |
protected void |
importThumbnailFromLAR(PortletDataContext portletDataContext,
FileEntry fileEntry,
Element fileEntryElement,
String binPathName,
int index) |
protected void |
importThumbnails(PortletDataContext portletDataContext,
FileEntry fileEntry,
FileEntry importedFileEntry,
Element fileEntryElement,
String binPathSuffix) |
boolean |
isSupported(FileVersion fileVersion)
Returns
true if the file version is supported by this
processor. |
protected boolean |
isThumbnailEnabled(int index) |
protected void |
sendGenerationMessage(String destinationName,
FileVersion sourceFileVersion,
FileVersion destinationFileVersion) |
protected void |
storeThumbnailImage(FileVersion fileVersion,
RenderedImage renderedImage,
int index) |
protected void |
storeThumbnailImages(FileVersion fileVersion,
File file) |
protected void |
storeThumbnailImages(FileVersion fileVersion,
RenderedImage renderedImage) |
void |
trigger(FileVersion sourceFileVersion,
FileVersion destinationFileVersion)
Launches the processor's work with respect to the destination file
version.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterPropertiesSet, destroy, getType, isSupported
public static final String DECRYPT_PATH
public static final String DECRYPT_TMP_PATH
public static final String PREVIEW_PATH
public static final String PREVIEW_TMP_PATH
public static final long REPOSITORY_ID
public static final int THUMBNAIL_INDEX_CUSTOM_1
public static final int THUMBNAIL_INDEX_CUSTOM_2
public static final int THUMBNAIL_INDEX_DEFAULT
public static final String THUMBNAIL_PATH
public static final String THUMBNAIL_TMP_PATH
public static final String TMP_PATH
protected Map<String,Future<?>> futures
public static void deleteFiles()
public void cleanUp(FileEntry fileEntry)
DLProcessor
cleanUp
in interface DLProcessor
fileEntry
- the file entry for which resources are cleaned uppublic void cleanUp(FileVersion fileVersion)
DLProcessor
DLProcessor.cleanUp(FileEntry)
if you want to clean up everything.cleanUp
in interface DLProcessor
fileVersion
- the file version for which resources will be cleaned
uppublic void copy(FileVersion sourceFileVersion, FileVersion destinationFileVersion)
DLProcessor
copy
in interface DLProcessor
sourceFileVersion
- the file version to copy resources fromdestinationFileVersion
- the file version to copy resources topublic void deleteFiles(FileEntry fileEntry, String thumbnailType)
public void deleteFiles(FileVersion fileVersion, String thumbnailType)
public void exportGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement) throws Exception
DLProcessor
exportGeneratedFiles
in interface DLProcessor
portletDataContext
- the portlet data context to use during this
export operationfileEntry
- the file entry for which resources are exportedfileEntryElement
- the file entry element to save resources intoException
- if an error occurred while exporting the file entry
resourcespublic void importGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement) throws Exception
DLProcessor
PortletDataContext.isPerformDirectBinaryImport()
), the resources are
directly copied from the file entry; otherwise, they're extracted from
the file entry element.importGeneratedFiles
in interface DLProcessor
portletDataContext
- the portlet data context to use during this
import operationfileEntry
- the file entry to import resources from, if direct
binary import is supportedimportedFileEntry
- the file entry for which resources are importedfileEntryElement
- the file entry element to import resources from,
if direct binary import is not supportedException
- if an error occurred while importing the file entry
resourcespublic boolean isSupported(FileVersion fileVersion)
DLProcessor
true
if the file version is supported by this
processor.isSupported
in interface DLProcessor
fileVersion
- the file versiontrue
if this processor supports the file version;
false
otherwisepublic void trigger(FileVersion sourceFileVersion, FileVersion destinationFileVersion)
DLProcessor
trigger
in interface DLProcessor
sourceFileVersion
- the file version to copy previews and thumbnails
from (optionally null
)destinationFileVersion
- the latest file version to processprotected static String getPathSegment(FileVersion fileVersion, boolean preview)
protected static String getPathSegment(long groupId, long fileEntryId, long fileVersionId, boolean preview)
protected void addFileToStore(long companyId, String dirName, String filePath, File srcFile) throws PortalException
PortalException
protected void addFileToStore(long companyId, String dirName, String filePath, InputStream is) throws PortalException
PortalException
protected void copyPreviews(FileVersion sourceFileVersion, FileVersion destinationFileVersion)
protected void copyThumbnail(FileVersion sourceFileVersion, FileVersion destinationFileVersion, int index)
protected void copyThumbnails(FileVersion sourceFileVersion, FileVersion destinationFileVersion)
protected void deleteFiles(long companyId, long groupId, long fileEntryId, long fileVersionId, String thumbnailType)
protected void deletePreviews(long companyId, long groupId, long fileEntryId, long fileVersionId)
protected void deleteThumbnail(long companyId, long groupId, long fileEntryId, long fileVersionId, String thumbnailType, int index)
protected void deleteThumbnails(long companyId, long groupId, long fileEntryId, long fileVersionId, String thumbnailType)
protected void destroyProcess(String processIdentity)
protected abstract void doExportGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement) throws Exception
Exception
protected InputStream doGetPreviewAsStream(FileVersion fileVersion, int index, String type) throws PortalException
PortalException
protected InputStream doGetPreviewAsStream(FileVersion fileVersion, String type) throws PortalException
PortalException
protected int doGetPreviewFileCount(FileVersion fileVersion) throws Exception
Exception
protected long doGetPreviewFileSize(FileVersion fileVersion, int index) throws PortalException
PortalException
protected long doGetPreviewFileSize(FileVersion fileVersion, int index, String type) throws PortalException
PortalException
protected long doGetPreviewFileSize(FileVersion fileVersion, String type) throws PortalException
PortalException
protected InputStream doGetThumbnailAsStream(FileVersion fileVersion, int index) throws PortalException
PortalException
protected long doGetThumbnailFileSize(FileVersion fileVersion, int index) throws PortalException
PortalException
protected abstract void doImportGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement) throws Exception
Exception
protected void exportBinary(PortletDataContext portletDataContext, Element fileEntryElement, FileVersion fileVersion, InputStream is, String binPath, String binPathName)
protected void exportPreview(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathSuffix, String previewType) throws Exception
Exception
protected void exportPreview(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathSuffix, String previewType, int fileIndex) throws Exception
Exception
protected void exportThumbnail(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathName, int index) throws PortalException
PortalException
protected void exportThumbnails(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathSuffix) throws PortalException
PortalException
protected String getBinPath(PortletDataContext portletDataContext, FileEntry fileEntry, int index)
protected String getBinPath(PortletDataContext portletDataContext, FileEntry fileEntry, String type)
protected File getDecryptedTempFile(String id)
protected abstract List<Long> getFileVersionIds()
protected String getPreviewFilePath(FileVersion fileVersion)
protected String getPreviewFilePath(FileVersion fileVersion, int index)
protected String getPreviewFilePath(FileVersion fileVersion, int index, String type)
protected String getPreviewFilePath(FileVersion fileVersion, String type)
protected String getPreviewFilePath(long groupId, long fileEntryId, long fileVersionId, int index, String type)
protected String getPreviewFilePath(long groupId, long fileEntryId, long fileVersionId, String type)
protected File getPreviewTempFile(String id)
protected File getPreviewTempFile(String id, int index)
protected File getPreviewTempFile(String id, int index, String type)
protected File getPreviewTempFile(String id, String type)
protected int getPreviewTempFileCount(FileVersion fileVersion)
protected int getPreviewTempFileCount(FileVersion fileVersion, String type)
protected String getPreviewTempFilePath(String id)
protected String getPreviewTempFilePath(String id, int index)
protected String getPreviewTempFilePath(String id, int index, String type)
protected String getPreviewTempFilePath(String id, String type)
protected String getPreviewType()
protected abstract String getPreviewType(FileVersion fileVersion)
protected String getPreviewType(int index)
protected String[] getPreviewTypes()
protected String getThumbnailFilePath(FileVersion fileVersion, int index)
protected String getThumbnailFilePath(FileVersion fileVersion, String type, int index)
protected String getThumbnailFilePath(long groupId, long fileEntryId, long fileVersionId, String thumbnailType, int index)
protected File getThumbnailTempFile(String id)
protected File getThumbnailTempFile(String id, String type)
protected String getThumbnailTempFilePath(String id)
protected String getThumbnailTempFilePath(String id, String type)
protected String getThumbnailType()
protected abstract String getThumbnailType(FileVersion fileVersion)
protected boolean hasPreview(FileVersion fileVersion, String type) throws Exception
Exception
protected boolean hasPreviews(FileVersion fileVersion) throws Exception
Exception
protected boolean hasThumbnail(FileVersion fileVersion, int index)
protected boolean hasThumbnails(FileVersion fileVersion)
protected void importPreview(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement, String binPathSuffix, String previewType) throws Exception
Exception
protected void importPreview(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement, String binPathSuffix, String previewType, int fileIndex) throws Exception
Exception
protected void importPreviewFromLAR(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathSuffix, String previewType, int fileIndex) throws Exception
Exception
protected void importThumbnail(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement, String binPathName, int index) throws Exception
Exception
protected void importThumbnailFromLAR(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathName, int index) throws Exception
Exception
protected void importThumbnails(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement, String binPathSuffix) throws Exception
Exception
protected boolean isThumbnailEnabled(int index)
protected void sendGenerationMessage(String destinationName, FileVersion sourceFileVersion, FileVersion destinationFileVersion)
protected void storeThumbnailImage(FileVersion fileVersion, RenderedImage renderedImage, int index) throws Exception
Exception
protected void storeThumbnailImages(FileVersion fileVersion, File file) throws Exception
Exception
protected void storeThumbnailImages(FileVersion fileVersion, RenderedImage renderedImage) throws Exception
Exception