Package org.glassfish.deployment.common
Class Artifacts
java.lang.Object
org.glassfish.deployment.common.Artifacts
Records information about artifacts (files) that a deployer might need to
track. For example, a deployer might generate artifacts as it runs, and these
might need to be cleaned up at some point. Also, a deployer might need to
flag certain files for download to the client as part of "deploy --retrieve" or
"get-client-stubs."
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.
- Author:
- Tim Quinn
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents 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). -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArtifact(URI full, String part) Adds an artifact.voidaddArtifact(URI full, URI part) Adds an artifact.voidaddArtifact(URI full, URI part, boolean isTemporary) Adds an artifact.voidaddArtifacts(Collection<Artifacts.FullAndPartURIs> urisCollection) Adds multiple artifacts at once.voidClears the URI pairs recorded in this Artifacts object.static Artifactsget(Properties props, String keyPrefix) Gets the artifacts matching the key prefix from the application properties of the specified application.static ArtifactsReturns 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.voidrecord(Properties props) Records the artifacts in the provided Properties object.voidrecord(org.glassfish.api.deployment.DeploymentContext dc) Records the Artifacts object into the specified deployment context.
-
Method Details
-
record
public void record(org.glassfish.api.deployment.DeploymentContext dc) Records the Artifacts object into the specified deployment context.- Parameters:
dc- the DeploymentContent in which to persist the Artifacts object
-
addArtifact
Adds an artifact.- Parameters:
full- the full URI to the file to be trackedpart- the (typically) relative URI, expressed as a String, to be associated with the part
-
addArtifact
Adds an artifact.- Parameters:
full- the full URI to the file to be trackedpart- the (typically) relative URI to be associated with the part
-
addArtifact
Adds an artifact.- Parameters:
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)
-
addArtifacts
Adds multiple artifacts at once.- Parameters:
urisCollection- the URI pairs to add
-
getArtifacts
- Returns:
- the actual artifacts tracked - the part URI and the full URI
-
record
Records the artifacts in the provided Properties object.- Parameters:
props-- Throws:
URISyntaxException
-
clearArtifacts
public void clearArtifacts()Clears the URI pairs recorded in this Artifacts object. -
get
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.- Parameters:
dc- the deployment contextkeyPrefix- key prefix by which to look up or store the artifacts- Returns:
- never null
-
get
Gets the artifacts matching the key prefix from the application properties of the specified application.- Parameters:
props-keyPrefix- type of artifacts of interest (e.g., downloadable, generated)- Returns:
- never null
-