Class PayloadFilesManager
- java.lang.Object
-
- org.glassfish.admin.payload.PayloadFilesManager
-
- Direct Known Subclasses:
PayloadFilesManager.Perm,PayloadFilesManager.Temp
public abstract class PayloadFilesManager extends Object
Manages transferred files delivered via the request or responsePayload.Callers can process the entire payload at once, treating each Part as a file, using the
processParts(org.glassfish.api.admin.Payload.Inbound)method. Or, the caller can invoke the#processPartmethod to work with a single Part as a file.If the caller wants to extract the payload's content as temporary files it should instantiate
PayloadFilesManager.Tempwhich exposes aPayLoadFilesManager.Temp#cleanupmethod. The caller should invoke this method once it has finished with the transferred files, although the finalizer will invoke cleanup just in case.On the other hand, if the caller wants to keep the transferred files it should instantiate
PayloadFilesManager.Perm.Tempuses a unique temporary directory, then creates one temp file for each part it is asked to deal with, either from an entire payload (processParts(org.glassfish.api.admin.Payload.Inbound)) or a single part (#processPart(org.glassfish.api.admin.Payload.Part)). Recall that each part in the payload has a name which is a relative or absolute URI.- Author:
- tjquinn
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePayloadFilesManager.ActionReportHandlerstatic classPayloadFilesManager.PermExtracts files from a Payload and leaves them on disk.static classPayloadFilesManager.TempExtracts files from a payload, treating them as temporary files.
-
Field Summary
Fields Modifier and Type Field Description protected Map<File,Long>dirTimestampsprotected Loggerloggerstatic LocalStringManagerImplstrings
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected URIgetOutputFileURI(Payload.Part part, String name)protected URIgetParentURI(Payload.Part part)protected FilegetTargetDir()protected abstract voidpostExtract(File extractedFile)protected abstract voidpostProcessParts()List<File>processParts(Payload.Inbound inboundPayload)Returns all Files extracted from the Payload, treating each Part as a separate file.Map<File,Properties>processPartsExtended(Payload.Inbound inboundPayload)Returns all Files extracted from the Payload, treating each Part as a separate file, via a Map from each File to its associated Properties.
-
-
-
Field Detail
-
strings
public static final LocalStringManagerImpl strings
-
logger
protected final Logger logger
-
-
Method Detail
-
getTargetDir
protected File getTargetDir()
-
getParentURI
protected URI getParentURI(Payload.Part part)
-
postExtract
protected abstract void postExtract(File extractedFile)
-
getOutputFileURI
protected URI getOutputFileURI(Payload.Part part, String name) throws IOException
- Throws:
IOException
-
processPartsExtended
public Map<File,Properties> processPartsExtended(Payload.Inbound inboundPayload) throws Exception
Returns all Files extracted from the Payload, treating each Part as a separate file, via a Map from each File to its associated Properties.- Parameters:
inboundPayload- Payload containing file data to be extracted- Returns:
- map from each extracted File to its corresponding Properties
- Throws:
IOExceptionException
-
processParts
public List<File> processParts(Payload.Inbound inboundPayload) throws Exception
Returns all Files extracted from the Payload, treating each Part as a separate file.- Parameters:
inboundPayload- Payload containing file data to be extracted- Returns:
- the Files corresponding to the content of each extracted file
- Throws:
IOExceptionException
-
postProcessParts
protected abstract void postProcessParts()
-
-