public class Artifacts extends Object
Artifacts can be recorded into a DeploymentContext or into a Properties object. Storing into a Properties object would normally be to store the Artifacts into the application properties of an Application object so they can be persisted into domain.xml. The property names are (keyPrefix)Artifact.(partURI) and the value is the corresponding fullURI.
Artifacts can also be optionally marked as temporary. The intent is that such artifacts will be deleted after they are placed into the response payload for download.
| Modifier and Type | Class and Description |
|---|---|
static class |
Artifacts.FullAndPartURIs
Represents a file to be tracked (the full URI) and a relative URI to be
associated with that file if is to be downloaded (e.g., as a part in
a Payload).
|
| Modifier and Type | Field and Description |
|---|---|
static Logger |
deplLogger |
| Modifier and Type | Method and Description |
|---|---|
void |
addArtifact(URI full,
String part)
Adds an artifact.
|
void |
addArtifact(URI full,
String part,
boolean isTemporary) |
void |
addArtifact(URI full,
URI part)
Adds an artifact.
|
void |
addArtifact(URI full,
URI part,
boolean isTemporary)
Adds an artifact.
|
void |
addArtifacts(Collection<Artifacts.FullAndPartURIs> urisCollection)
Adds multiple artifacts at once.
|
void |
clearArtifacts()
Clears the URI pairs recorded in this Artifacts object.
|
static Artifacts |
get(org.glassfish.api.deployment.DeploymentContext dc,
String keyPrefix)
Returns the Artifacts object from the deployment context with the
sepcified key prefix, creating a new one and storing it in the DC if
no matching Artifacts object already exists.
|
static Artifacts |
get(Properties props,
String keyPrefix)
Gets the artifacts matching the key prefix from the application properties
of the specified application.
|
Set<Artifacts.FullAndPartURIs> |
getArtifacts()
Returns the URI pairs tracked by this Artifacts object.
|
void |
record(org.glassfish.api.deployment.DeploymentContext dc)
Records the Artifacts object into the specified deployment context.
|
void |
record(Properties props)
Records the artifacts in the provided Properties object.
|
public static final Logger deplLogger
public static Artifacts get(org.glassfish.api.deployment.DeploymentContext dc, String keyPrefix)
dc - the deployment contextkeyPrefix - key prefix by which to look up or store the artifactspublic void record(org.glassfish.api.deployment.DeploymentContext dc)
dc - the DeploymentContent in which to persist the Artifacts objectpublic static Artifacts get(Properties props, String keyPrefix)
app - the application of interestkeyPrefix - type of artifacts of interest (e.g., downloadable, generated)public void addArtifact(URI full, URI part, boolean isTemporary)
full - the full URI to the file to be trackedpart - the (typically) relative URI to be associated with the partisTemporary - whether the artifact can be deleted once it is added to an output stream (typically for download)
(a frequent use of Artifacts is for working with Payloads which are
composed of parts - hence the "part" term)public void addArtifact(URI full, String part)
full - the full URI to the file to be trackedpart - the (typically) relative URI, expressed as a String, to be
associated with the partpublic void addArtifacts(Collection<Artifacts.FullAndPartURIs> urisCollection)
urisCollection - the URI pairs to addpublic Set<Artifacts.FullAndPartURIs> getArtifacts()
public void record(Properties props) throws URISyntaxException
props - URISyntaxExceptionpublic void clearArtifacts()
Copyright © 2013. All Rights Reserved.