@PublicApi @InjectableComponent public interface

TempFileFactory

com.atlassian.jira.io.TempFileFactory
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

A SessionTempFile monitor for managing deletion of temporary files.

Summary

Public Methods
@Nullable 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.
@Nonnull SessionTempFile makeSessionTempFile(String path)
Makes a new SessionTempFile for the file at path.

Public Methods

@Nullable public 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.

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

@Nonnull public SessionTempFile makeSessionTempFile (String path)

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