org.exoplatform.clouddrive.cmis.ecms.viewer.storage
Class PDFViewerStorage

java.lang.Object
  extended by org.exoplatform.clouddrive.cmis.ecms.viewer.storage.PDFViewerStorage

public class PDFViewerStorage
extends Object

Convert cloud file to PDF file a store it in temporary local file on the file system. This file can be used for remote file representation in eXo Platform.
This class build on an idea of ECMS PDFViewerService but uses CloudFile instead of JCR Node for file data.
This service uses ExoCache as a weak storage of spooled locally cloud files. The storage will be cleaned if file/drive will be removed or the cache will be evicted.
Local files will be stored in JVM temporary folder in a tree hiearchy: repository/workspace/username/driveTitle/fileId.
If remote file is not in PDF format it will be attempted to convert it to the PDF by JodConverterService.
Created by The eXo Platform SAS

Version:
$Id: PDFViewerStorage.java 00000 Nov 25, 2014 pnedonosko $
Author:
Peter Nedonosko

Nested Class Summary
protected  class PDFViewerStorage.Evicter
           
protected  class PDFViewerStorage.FileKey
           
protected  class PDFViewerStorage.FilesCleaner
           
 class PDFViewerStorage.PDFFile
           
 
Field Summary
protected  ConcurrentHashMap<String,PDFViewerStorage.FilesCleaner> cleaners
           
static long FILE_LIVE_TIME
           
protected  org.exoplatform.services.cms.jodconverter.JodConverterService jodConverter
           
static int MAX_FILENAME_LENGTH
           
static String PAGE_IMAGE_EXT
           
static String PAGE_IMAGE_TYPE
           
static String PDF_EXT
           
static String PDF_TYPE
           
protected  File rootDir
           
protected  ConcurrentHashMap<PDFViewerStorage.FileKey,PDFViewerStorage.PDFFile> spool
           
 
Constructor Summary
PDFViewerStorage(org.exoplatform.services.cache.CacheService cacheService, org.exoplatform.services.cms.jodconverter.JodConverterService jodConverter)
           
 
Method Summary
 PDFViewerStorage.PDFFile createFile(String repository, String workspace, JCRLocalCMISDrive drive, org.exoplatform.clouddrive.CloudFile file)
           
 PDFViewerStorage.PDFFile getFile(String repository, String workspace, org.exoplatform.clouddrive.CloudDrive drive, String fileId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_FILENAME_LENGTH

public static final int MAX_FILENAME_LENGTH
See Also:
Constant Field Values

FILE_LIVE_TIME

public static final long FILE_LIVE_TIME
See Also:
Constant Field Values

PAGE_IMAGE_TYPE

public static final String PAGE_IMAGE_TYPE
See Also:
Constant Field Values

PDF_TYPE

public static final String PDF_TYPE
See Also:
Constant Field Values

PAGE_IMAGE_EXT

public static final String PAGE_IMAGE_EXT
See Also:
Constant Field Values

PDF_EXT

public static final String PDF_EXT
See Also:
Constant Field Values

spool

protected final ConcurrentHashMap<PDFViewerStorage.FileKey,PDFViewerStorage.PDFFile> spool

jodConverter

protected final org.exoplatform.services.cms.jodconverter.JodConverterService jodConverter

rootDir

protected final File rootDir

cleaners

protected final ConcurrentHashMap<String,PDFViewerStorage.FilesCleaner> cleaners
Constructor Detail

PDFViewerStorage

public PDFViewerStorage(org.exoplatform.services.cache.CacheService cacheService,
                        org.exoplatform.services.cms.jodconverter.JodConverterService jodConverter)
                 throws IOException
Throws:
IOException
Method Detail

getFile

public PDFViewerStorage.PDFFile getFile(String repository,
                                        String workspace,
                                        org.exoplatform.clouddrive.CloudDrive drive,
                                        String fileId)
                                 throws org.exoplatform.clouddrive.DriveRemovedException,
                                        javax.jcr.RepositoryException
Throws:
org.exoplatform.clouddrive.DriveRemovedException
javax.jcr.RepositoryException

createFile

public PDFViewerStorage.PDFFile createFile(String repository,
                                           String workspace,
                                           JCRLocalCMISDrive drive,
                                           org.exoplatform.clouddrive.CloudFile file)
                                    throws org.exoplatform.clouddrive.CloudDriveException,
                                           org.exoplatform.clouddrive.DriveRemovedException,
                                           javax.jcr.RepositoryException,
                                           IOException
Throws:
org.exoplatform.clouddrive.CloudDriveException
org.exoplatform.clouddrive.DriveRemovedException
javax.jcr.RepositoryException
IOException


Copyright © 2003–2015 eXo Platform SAS. All rights reserved.