Class ExportDownloadResourceManager
- java.lang.Object
-
- com.atlassian.confluence.importexport.resource.ExportDownloadResourceManager
-
- All Implemented Interfaces:
DownloadResourceManager,WritableDownloadResourceManager
public class ExportDownloadResourceManager extends Object implements WritableDownloadResourceManager
AWritableDownloadResourceManagerthat stores and reads macro output from a temporary location.
-
-
Constructor Summary
Constructors Constructor Description ExportDownloadResourceManager(BootstrapManager bootstrapManager, GateKeeper gateKeeper, PermissionManager permissionManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DownloadResourceReadergetResourceReader(String userName, String resourcePath, Map parameters)Returns aFileDownloadResourceReaderfor reading the stored output of the previous execution of a macro.DownloadResourceWritergetResourceWriter(String userName, String prefix, String suffix)Returns aFileDownloadResourceWriterfor storing output of a macro in a temporary location.booleanmatches(String resourcePath)Returns a boolean to indicate whether the current DownloadResourceManager will know how to handle the given resourcePath.
-
-
-
Constructor Detail
-
ExportDownloadResourceManager
public ExportDownloadResourceManager(BootstrapManager bootstrapManager, GateKeeper gateKeeper, PermissionManager permissionManager)
-
-
Method Detail
-
matches
public boolean matches(String resourcePath)
Description copied from interface:DownloadResourceManagerReturns a boolean to indicate whether the current DownloadResourceManager will know how to handle the given resourcePath.- Specified by:
matchesin interfaceDownloadResourceManager- Parameters:
resourcePath- the relative URL of the resource including the application context path. For example, "/confluence/download/attachments/12345/temp.png".- Returns:
- true if the manager can handle the given resource path
-
getResourceReader
public DownloadResourceReader getResourceReader(String userName, String resourcePath, Map parameters) throws UnauthorizedDownloadResourceException, DownloadResourceNotFoundException
Returns aFileDownloadResourceReaderfor reading the stored output of the previous execution of a macro. Typically used by HTML and PDF export, macro content downloads.- Specified by:
getResourceReaderin interfaceDownloadResourceManager- Parameters:
userName- the user who is viewing the macro output. Must be the same as the user who created the macro output withgetResourceWriter(String, String, String), or an UnauthorizedDownloadResourceException will be thrown.resourcePath- the relative URL of the resource including the application context path. For example, "/confluence/download/export/chart1756.png". It must be the same path from theDownloadResourceWriter.parameters- a map of url paramaters for the resource- Returns:
- a DownloadResourceReader to read the resource content from
- Throws:
UnauthorizedDownloadResourceException- if the user requesting the macro output is different to the user who created itDownloadResourceNotFoundException- if a stored macro output associated with this resource path cannot be found
-
getResourceWriter
public DownloadResourceWriter getResourceWriter(String userName, String prefix, String suffix)
Returns aFileDownloadResourceWriterfor storing output of a macro in a temporary location. This should be typically called by macros that generate output such as images and would like their output to be exported correctly.- Specified by:
getResourceWriterin interfaceWritableDownloadResourceManager- Parameters:
userName- the user who is creating the macro output.prefix- the prefix of the macro output's namesuffix- the suffix of the macro output
-
-