com.liferay.portlet.documentlibrary.store
Class S3Store

java.lang.Object
  extended by com.liferay.portlet.documentlibrary.store.BaseStore
      extended by com.liferay.portlet.documentlibrary.store.S3Store
All Implemented Interfaces:
com.liferay.portlet.documentlibrary.store.Store

public class S3Store
extends com.liferay.portlet.documentlibrary.store.BaseStore

Author:
Brian Wing Shun Chan, Sten Martinez, Edward Han

Field Summary
 
Fields inherited from interface com.liferay.portlet.documentlibrary.store.Store
VERSION_DEFAULT
 
Constructor Summary
S3Store()
           
 
Method Summary
 void addDirectory(long companyId, long repositoryId, java.lang.String dirName)
           
 void addFile(long companyId, long repositoryId, java.lang.String fileName, java.io.InputStream is)
           
 void checkRoot(long companyId)
           
 void deleteDirectory(long companyId, long repositoryId, java.lang.String dirName)
           
 void deleteFile(long companyId, long repositoryId, java.lang.String fileName)
           
 void deleteFile(long companyId, long repositoryId, java.lang.String fileName, java.lang.String versionLabel)
           
protected  org.jets3t.service.security.AWSCredentials getAWSCredentials()
           
 java.io.InputStream getFileAsStream(long companyId, long repositoryId, java.lang.String fileName, java.lang.String versionLabel)
           
protected  java.lang.String getFileName(java.lang.String key)
           
 java.lang.String[] getFileNames(long companyId, long repositoryId)
           
 java.lang.String[] getFileNames(long companyId, long repositoryId, java.lang.String dirName)
           
 long getFileSize(long companyId, long repositoryId, java.lang.String fileName)
           
protected  java.lang.String getHeadVersionLabel(long companyId, long repositoryId, java.lang.String fileName)
           
protected  java.lang.String getKey(long companyId, long repositoryId)
           
protected  java.lang.String getKey(long companyId, long repositoryId, java.lang.String fileName)
           
protected  java.lang.String getKey(long companyId, long repositoryId, java.lang.String fileName, java.lang.String versionLabel)
           
protected  org.jets3t.service.model.S3Bucket getS3Bucket()
           
protected  org.jets3t.service.S3Service getS3Service()
           
 boolean hasDirectory(long companyId, long repositoryId, java.lang.String dirName)
           
 boolean hasFile(long companyId, long repositoryId, java.lang.String fileName, java.lang.String versionLabel)
           
 void move(java.lang.String srcDir, java.lang.String destDir)
           
 void updateFile(long companyId, long repositoryId, long newRepositoryId, java.lang.String fileName)
           
 void updateFile(long companyId, long repositoryId, java.lang.String fileName, java.lang.String newFileName)
           
 void updateFile(long companyId, long repositoryId, java.lang.String fileName, java.lang.String versionLabel, java.io.InputStream is)
           
 
Methods inherited from class com.liferay.portlet.documentlibrary.store.BaseStore
addFile, addFile, copyFileVersion, getFile, getFile, getFileAsBytes, getFileAsBytes, getFileAsStream, hasFile, updateFile, updateFile, updateFileVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

S3Store

public S3Store()
Method Detail

addDirectory

public void addDirectory(long companyId,
                         long repositoryId,
                         java.lang.String dirName)
Specified by:
addDirectory in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
addDirectory in class com.liferay.portlet.documentlibrary.store.BaseStore

addFile

public void addFile(long companyId,
                    long repositoryId,
                    java.lang.String fileName,
                    java.io.InputStream is)
             throws com.liferay.portal.kernel.exception.SystemException
Specified by:
addFile in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
addFile in class com.liferay.portlet.documentlibrary.store.BaseStore
Throws:
com.liferay.portal.kernel.exception.SystemException

checkRoot

public void checkRoot(long companyId)
Specified by:
checkRoot in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
checkRoot in class com.liferay.portlet.documentlibrary.store.BaseStore

deleteDirectory

public void deleteDirectory(long companyId,
                            long repositoryId,
                            java.lang.String dirName)
                     throws com.liferay.portal.kernel.exception.SystemException
Specified by:
deleteDirectory in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
deleteDirectory in class com.liferay.portlet.documentlibrary.store.BaseStore
Throws:
com.liferay.portal.kernel.exception.SystemException

deleteFile

public void deleteFile(long companyId,
                       long repositoryId,
                       java.lang.String fileName)
                throws com.liferay.portal.kernel.exception.SystemException
Specified by:
deleteFile in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
deleteFile in class com.liferay.portlet.documentlibrary.store.BaseStore
Throws:
com.liferay.portal.kernel.exception.SystemException

deleteFile

public void deleteFile(long companyId,
                       long repositoryId,
                       java.lang.String fileName,
                       java.lang.String versionLabel)
                throws com.liferay.portal.kernel.exception.SystemException
Specified by:
deleteFile in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
deleteFile in class com.liferay.portlet.documentlibrary.store.BaseStore
Throws:
com.liferay.portal.kernel.exception.SystemException

getFileAsStream

public java.io.InputStream getFileAsStream(long companyId,
                                           long repositoryId,
                                           java.lang.String fileName,
                                           java.lang.String versionLabel)
                                    throws com.liferay.portal.kernel.exception.PortalException,
                                           com.liferay.portal.kernel.exception.SystemException
Specified by:
getFileAsStream in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
getFileAsStream in class com.liferay.portlet.documentlibrary.store.BaseStore
Throws:
com.liferay.portal.kernel.exception.PortalException
com.liferay.portal.kernel.exception.SystemException

getFileNames

public java.lang.String[] getFileNames(long companyId,
                                       long repositoryId)
                                throws com.liferay.portal.kernel.exception.SystemException
Throws:
com.liferay.portal.kernel.exception.SystemException

getFileNames

public java.lang.String[] getFileNames(long companyId,
                                       long repositoryId,
                                       java.lang.String dirName)
                                throws com.liferay.portal.kernel.exception.SystemException
Specified by:
getFileNames in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
getFileNames in class com.liferay.portlet.documentlibrary.store.BaseStore
Throws:
com.liferay.portal.kernel.exception.SystemException

getFileSize

public long getFileSize(long companyId,
                        long repositoryId,
                        java.lang.String fileName)
                 throws com.liferay.portal.kernel.exception.PortalException,
                        com.liferay.portal.kernel.exception.SystemException
Specified by:
getFileSize in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
getFileSize in class com.liferay.portlet.documentlibrary.store.BaseStore
Throws:
com.liferay.portal.kernel.exception.PortalException
com.liferay.portal.kernel.exception.SystemException

hasDirectory

public boolean hasDirectory(long companyId,
                            long repositoryId,
                            java.lang.String dirName)
Specified by:
hasDirectory in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
hasDirectory in class com.liferay.portlet.documentlibrary.store.BaseStore

hasFile

public boolean hasFile(long companyId,
                       long repositoryId,
                       java.lang.String fileName,
                       java.lang.String versionLabel)
                throws com.liferay.portal.kernel.exception.SystemException
Specified by:
hasFile in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
hasFile in class com.liferay.portlet.documentlibrary.store.BaseStore
Throws:
com.liferay.portal.kernel.exception.SystemException

move

public void move(java.lang.String srcDir,
                 java.lang.String destDir)
Specified by:
move in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
move in class com.liferay.portlet.documentlibrary.store.BaseStore

updateFile

public void updateFile(long companyId,
                       long repositoryId,
                       long newRepositoryId,
                       java.lang.String fileName)
                throws com.liferay.portal.kernel.exception.SystemException
Specified by:
updateFile in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
updateFile in class com.liferay.portlet.documentlibrary.store.BaseStore
Throws:
com.liferay.portal.kernel.exception.SystemException

updateFile

public void updateFile(long companyId,
                       long repositoryId,
                       java.lang.String fileName,
                       java.lang.String newFileName)
                throws com.liferay.portal.kernel.exception.SystemException
Throws:
com.liferay.portal.kernel.exception.SystemException

updateFile

public void updateFile(long companyId,
                       long repositoryId,
                       java.lang.String fileName,
                       java.lang.String versionLabel,
                       java.io.InputStream is)
                throws com.liferay.portal.kernel.exception.SystemException
Specified by:
updateFile in interface com.liferay.portlet.documentlibrary.store.Store
Specified by:
updateFile in class com.liferay.portlet.documentlibrary.store.BaseStore
Throws:
com.liferay.portal.kernel.exception.SystemException

getAWSCredentials

protected org.jets3t.service.security.AWSCredentials getAWSCredentials()
                                                                throws org.jets3t.service.S3ServiceException
Throws:
org.jets3t.service.S3ServiceException

getFileName

protected java.lang.String getFileName(java.lang.String key)

getHeadVersionLabel

protected java.lang.String getHeadVersionLabel(long companyId,
                                               long repositoryId,
                                               java.lang.String fileName)
                                        throws com.liferay.portal.kernel.exception.PortalException,
                                               org.jets3t.service.S3ServiceException
Throws:
com.liferay.portal.kernel.exception.PortalException
org.jets3t.service.S3ServiceException

getKey

protected java.lang.String getKey(long companyId,
                                  long repositoryId)

getKey

protected java.lang.String getKey(long companyId,
                                  long repositoryId,
                                  java.lang.String fileName)

getKey

protected java.lang.String getKey(long companyId,
                                  long repositoryId,
                                  java.lang.String fileName,
                                  java.lang.String versionLabel)

getS3Bucket

protected org.jets3t.service.model.S3Bucket getS3Bucket()
                                                 throws org.jets3t.service.S3ServiceException
Throws:
org.jets3t.service.S3ServiceException

getS3Service

protected org.jets3t.service.S3Service getS3Service()
                                             throws org.jets3t.service.S3ServiceException
Throws:
org.jets3t.service.S3ServiceException