com.atlassian.bamboo.web.utils
Class UploadedFileManagerImpl

java.lang.Object
  extended by com.atlassian.bamboo.web.utils.UploadedFileManagerImpl
All Implemented Interfaces:
UploadedFileManager

public class UploadedFileManagerImpl
extends java.lang.Object
implements UploadedFileManager


Field Summary
static int DEFAULT_MAX_UPLOADED_FILE_SIZE_MB
           
 
Constructor Summary
UploadedFileManagerImpl(com.atlassian.config.HomeLocator homeLocator)
           
 
Method Summary
 UploadedFile createFile(java.io.InputStream inputStream, java.lang.String fileName, java.lang.String contentType, long size)
          Creates a file on disk.
 UploadedFile createFile(com.opensymphony.webwork.dispatcher.multipart.MultiPartRequestWrapper requestWrapper, java.lang.String fileParamName)
          Creates a file on disk.
 long getMaximumUploadedFileSizeBytes()
           
 java.io.File getUploadedFilesDirectory()
           
 void validateFile(com.opensymphony.webwork.dispatcher.multipart.MultiPartRequestWrapper requestWrapper, java.lang.String fileParamName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_UPLOADED_FILE_SIZE_MB

public static final int DEFAULT_MAX_UPLOADED_FILE_SIZE_MB
See Also:
Constant Field Values
Constructor Detail

UploadedFileManagerImpl

public UploadedFileManagerImpl(com.atlassian.config.HomeLocator homeLocator)
Method Detail

createFile

@NotNull
public UploadedFile createFile(@NotNull
                                       com.opensymphony.webwork.dispatcher.multipart.MultiPartRequestWrapper requestWrapper,
                                       @NotNull
                                       java.lang.String fileParamName)
                        throws UploadedFileManagerException
Description copied from interface: UploadedFileManager
Creates a file on disk. This method ensures that file name on disk is unique.

Specified by:
createFile in interface UploadedFileManager
Parameters:
requestWrapper - the wrapper containing getFile() and getFilesystemName() describing the attachment
fileParamName - name of form parameter specifying filename (in requestWrapper).
Returns:
A UploadedFile containing details about whereabouts of the created file
Throws:
UploadedFileManagerException - iff file upload fails

createFile

@NotNull
public UploadedFile createFile(@NotNull
                                       java.io.InputStream inputStream,
                                       @NotNull
                                       java.lang.String fileName,
                                       @NotNull
                                       java.lang.String contentType,
                                       long size)
                        throws UploadedFileManagerException
Description copied from interface: UploadedFileManager
Creates a file on disk. This method ensures that file name on disk is unique.

Specified by:
createFile in interface UploadedFileManager
fileName - the source filename
contentType - the content type of the passed stream
size - the size of the passed stream.
Returns:
A UploadedFile containing details about whereabouts of the created file
Throws:
UploadedFileManagerException - iff file upload fails

getMaximumUploadedFileSizeBytes

public long getMaximumUploadedFileSizeBytes()
Specified by:
getMaximumUploadedFileSizeBytes in interface UploadedFileManager

validateFile

public void validateFile(com.opensymphony.webwork.dispatcher.multipart.MultiPartRequestWrapper requestWrapper,
                         java.lang.String fileParamName)
                  throws UploadedFileManagerException
Throws:
UploadedFileManagerException

getUploadedFilesDirectory

@NotNull
public java.io.File getUploadedFilesDirectory()
Specified by:
getUploadedFilesDirectory in interface UploadedFileManager
Returns:
directory in Bamboo home, where uploaded files are stored


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.