com.atlassian.jira.io
Class TempFileFactoryImpl

java.lang.Object
  extended by com.atlassian.jira.io.TempFileFactoryImpl
All Implemented Interfaces:
TempFileFactory

public class TempFileFactoryImpl
extends Object
implements TempFileFactory

TempFileFactory implementation for managing deletion of temporary files.


Constructor Summary
TempFileFactoryImpl(HttpServletVariables httpServletVariables, AttachmentConfig attachmentConfig)
           
 
Method Summary
 SessionTempFile getSessionTempFile(String path)
          Returns the SessionTempFile for the file at path, which must have been previously created using TempFileFactory.makeSessionTempFile(String), or null if not found.
 SessionTempFile makeSessionTempFile(String path)
          Makes a new SessionTempFile for the file at path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TempFileFactoryImpl

public TempFileFactoryImpl(HttpServletVariables httpServletVariables,
                           AttachmentConfig attachmentConfig)
Method Detail

makeSessionTempFile

@Nonnull
public SessionTempFile makeSessionTempFile(String path)
                                    throws IllegalArgumentException,
                                           IllegalStateException
Description copied from interface: TempFileFactory
Makes a new SessionTempFile for the file at path. The lifecycle of the SessionTempFile will become bound to the HTTP session associated with the current thread, meaning that the file will be deleted when the session is destroyed.

Note that for security reasons path must point to a file in java.io.tmpdir or in JIRA's temporary attachments directory.

Specified by:
makeSessionTempFile in interface TempFileFactory
Parameters:
path - a relative (within java.io.tmpdir) or absolute path
Returns:
a new SessionTempFile
Throws:
IllegalArgumentException - if there is no file at path or if the file is not in a temporary file directory
IllegalStateException

getSessionTempFile

@Nullable
public SessionTempFile getSessionTempFile(String path)
                                   throws IllegalArgumentException,
                                          SessionNotFoundException
Description copied from interface: TempFileFactory
Returns the SessionTempFile for the file at path, which must have been previously created using TempFileFactory.makeSessionTempFile(String), or null if not found.

Specified by:
getSessionTempFile in interface TempFileFactory
Parameters:
path - a relative (within java.io.tmpdir) or absolute path
Returns:
a SessionTempFile or null if there is no SessionTempFile for path
Throws:
SessionNotFoundException - if there is no current session
IllegalArgumentException


Copyright © 2002-2014 Atlassian. All Rights Reserved.