com.adobe.icc.dbforms.util
Class TempFileManager

java.lang.Object
  extended by com.adobe.icc.dbforms.util.TempFileManager

public class TempFileManager
extends java.lang.Object


Field Summary
static java.lang.String TEMP_FILE_PREFIX
           
static java.lang.String TEMP_FILE_SUFFIX
           
 
Constructor Summary
TempFileManager()
           
 
Method Summary
 void cleanTemp()
          Clean the files created within the temp folder.
 java.lang.String createTempFileInRepository(java.io.InputStream inputStream, java.lang.String mimeType)
          Creates a temporary file in repository and returns the file to the path.
 java.lang.String getTmpfolder()
           
static boolean nodeExists(java.lang.String absPath)
           
 byte[] readFile(java.lang.String fileName)
          Read a file (for upload) and return as byte array
static byte[] retrieveContentFromJCRRepository(java.lang.String absPath)
          Retrieves bytes of a file in JCR repository (CRX)
static byte[] retrieveContentFromJCRRepository(java.lang.String absPath, boolean deleteFile)
          Retrieves bytes of a file in JCR repository (CRX)
static byte[] retrieveContentFromJCRRepository(java.lang.String absPath, boolean deleteFile, Session session)
          Retrieves bytes of a file in JCR repository (CRX)
 void setTmpfolder(java.lang.String folder)
           
 java.io.File writeTempFile(java.lang.String name)
          Write a file and return as File object
 java.io.File writeTempFile(java.lang.String name, java.lang.String suffix)
          Write a file and return as File object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMP_FILE_PREFIX

public static final java.lang.String TEMP_FILE_PREFIX
See Also:
Constant Field Values

TEMP_FILE_SUFFIX

public static final java.lang.String TEMP_FILE_SUFFIX
See Also:
Constant Field Values
Constructor Detail

TempFileManager

public TempFileManager()
Method Detail

createTempFileInRepository

public java.lang.String createTempFileInRepository(java.io.InputStream inputStream,
                                                   java.lang.String mimeType)
                                            throws ICCException
Creates a temporary file in repository and returns the file to the path.

Parameters:
InputStream -
mimeType -
Returns:
Path to temporary file
Throws:
ICCException

cleanTemp

public void cleanTemp()
Clean the files created within the temp folder.


writeTempFile

public java.io.File writeTempFile(java.lang.String name)
                           throws ICCException
Write a file and return as File object

Parameters:
name - name of file
Returns:
the file created
Throws:
ICCException

writeTempFile

public java.io.File writeTempFile(java.lang.String name,
                                  java.lang.String suffix)
                           throws ICCException
Write a file and return as File object

Parameters:
name - name of file
suffix - suffix for the temp file
Returns:
the file created
Throws:
ICCException

readFile

public byte[] readFile(java.lang.String fileName)
                throws ICCException,
                       java.io.IOException
Read a file (for upload) and return as byte array

Parameters:
directory - path to folder where file resides
fileName - name of file
Returns:
the read in file as byte array
Throws:
java.io.IOException
ICCException

getTmpfolder

public java.lang.String getTmpfolder()

setTmpfolder

public void setTmpfolder(java.lang.String folder)

retrieveContentFromJCRRepository

public static byte[] retrieveContentFromJCRRepository(java.lang.String absPath)
                                               throws ICCException,
                                                      java.io.IOException
Retrieves bytes of a file in JCR repository (CRX)

Parameters:
absPath - - Path of the file in CRX. The path should begin from root of the repository (i.e. path after the hostname:port)
Returns:
byte array
Throws:
java.io.IOException
ICCException

retrieveContentFromJCRRepository

public static byte[] retrieveContentFromJCRRepository(java.lang.String absPath,
                                                      boolean deleteFile)
                                               throws ICCException,
                                                      java.io.IOException
Retrieves bytes of a file in JCR repository (CRX)

Parameters:
absPath - - Path of the file in CRX. The path should begin from root of the repository (i.e. path after the hostname:port)
deleteFile - - deletes the file after content retrieval
Returns:
byte array
Throws:
java.io.IOException
ICCException

retrieveContentFromJCRRepository

public static byte[] retrieveContentFromJCRRepository(java.lang.String absPath,
                                                      boolean deleteFile,
                                                      Session session)
                                               throws ICCException,
                                                      java.io.IOException
Retrieves bytes of a file in JCR repository (CRX)

Parameters:
absPath - - Path of the file in CRX. The path should begin from root of the repository (i.e. path after the hostname:port)
deleteFile - - deletes the file after content retrieval
session - - This session to be used while fetching the absPath content. If null, current session is used
Returns:
byte array
Throws:
java.io.IOException
ICCException

nodeExists

public static boolean nodeExists(java.lang.String absPath)


[an error occurred while processing this directive] [an error occurred while processing this directive]