com.atlassian.jira.io
Interface TempFileFactory

All Known Implementing Classes:
TempFileFactoryImpl

@PublicApi
@InjectableComponent
public interface TempFileFactory

A SessionTempFile monitor for managing deletion of temporary files.

Since:
6.0.8

Method Summary
 SessionTempFile getSessionTempFile(String path)
          Returns the SessionTempFile for the file at path, which must have been previously created using makeSessionTempFile(String), or null if not found.
 SessionTempFile makeSessionTempFile(String path)
          Makes a new SessionTempFile for the file at path.
 

Method Detail

makeSessionTempFile

@Nonnull
SessionTempFile makeSessionTempFile(String path)
                                    throws IllegalArgumentException,
                                           SessionNotFoundException
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.

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
SessionNotFoundException - if there is no current session
Since:
6.0.8

getSessionTempFile

@Nullable
SessionTempFile getSessionTempFile(String path)
                                   throws SessionNotFoundException
Returns the SessionTempFile for the file at path, which must have been previously created using makeSessionTempFile(String), or null if not found.

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
Since:
6.0.8


Copyright © 2002-2014 Atlassian. All Rights Reserved.