Class ClientArtifactsManager
- java.lang.Object
-
- org.glassfish.deployment.common.ClientArtifactsManager
-
public class ClientArtifactsManager extends Object
Records artifacts generated during deployment that need to be included inside the generated app client JAR so they are accessible on the runtime classpath.An example: jaxrpc classes from web services deployment
Important node: Artifacts added to this manager are NOT downloaded to the client as separate files. In contrast, they are added to the generated client JAR file. That generated JAR, along with other files needed by the client, are downloaded.
A Deployer that needs to request for files to be downloaded to the client as part of the payload in the http command response should instead use DownloadableArtifactsManager.
The various
add
methods permit adding content in a variety of ways. Ultimately we need to know two things: where is the physical file on the server the content of which needs to be included in the client JAR, and what is the relative path within the client JAR where the content should reside. Look carefully at the doc for eachadd
method when choosing which to use.An instance of this class can be stored in the deployment context's transient app metadata so the various deployers can add to the same collection and so the app client deployer can find it and act on its contents.
Because other modules should add their artifacts before the the artifacts have been consumed and placed into the client JAR file, the
add
methods do not permit further additions once theartifacts
method has been invoked.- Author:
- tjuinn
-
-
Field Summary
Fields Modifier and Type Field Description static Logger
deplLogger
-
Constructor Summary
Constructors Constructor Description ClientArtifactsManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(File baseFile, File artifactFile)
Adds a new artifact to the collection of artifacts to be added to the client facade JAR file so they can be delivered to the client during a download.void
add(File artifactFile, String relativePath, boolean isTemporary)
Adds a new artifact to the collection of artifacts to be added to the client JAR file so they can be delivered to the client during a download.void
add(URI baseURI, URI artifactURI)
Adds a new artifact to the collection of artifacts to be included in the client JAR file so they can be delivered to the client during a download.void
add(Artifacts.FullAndPartURIs artifact)
Adds a new artifact to the collection of artifacts to be added to the client JAR file so they can be delivered to the client during a download.void
addAll(File baseFile, Collection<File> artifactFiles)
Adds all artifacts in Collection to those to be added to the client facade JAR.Collection<Artifacts.FullAndPartURIs>
artifacts()
Returns the set (in unmodifiable form) of FullAndPartURIs for the accumulated artifacts.boolean
contains(File baseFile, File artifactFile)
boolean
contains(URI baseURI, URI artifactURI)
protected void
finalize()
static ClientArtifactsManager
get(DeploymentContext dc)
Retrieves the client artifacts store from the provided deployment context, creating one and storing it back into the DC if none is there yet.boolean
isEmpty()
-
-
-
Field Detail
-
deplLogger
public static final Logger deplLogger
-
-
Method Detail
-
get
public static ClientArtifactsManager get(DeploymentContext dc)
Retrieves the client artifacts store from the provided deployment context, creating one and storing it back into the DC if none is there yet.- Parameters:
dc
- the deployment context to hold the ClientArtifactsManager object- Returns:
- the ClientArtifactsManager object from the deployment context (created and stored in the DC if needed)
-
add
public void add(URI baseURI, URI artifactURI)
Adds a new artifact to the collection of artifacts to be included in the client JAR file so they can be delivered to the client during a download.- Parameters:
baseURI
- absolute URI of the base directory within which the artifact liesartifactURI
- absolute or relative URI where the artifact file resides- Throws:
IllegalStateException
- if invokes after the accumulated artifacts have been consumed
-
add
public void add(File baseFile, File artifactFile)
Adds a new artifact to the collection of artifacts to be added to the client facade JAR file so they can be delivered to the client during a download.The relative path within the client JAR will be computed using the position of the artifact file relative to the base file.
- Parameters:
baseFile
- File for the base directory within which the artifact liesartifactFile
- File for the artifact itself- Throws:
IllegalStateException
- if invoked after the accumulated artifacts have been consumed
-
add
public void add(File artifactFile, String relativePath, boolean isTemporary)
Adds a new artifact to the collection of artifacts to be added to the client JAR file so they can be delivered to the client during a download.This method helps when the contents of a temporary file are to be included in the client JAR, in which case the temp file might not reside in a useful place relative to a base directory. The caller can just specify the relative path directly.
- Parameters:
artifactFile
- file to be included in the client JARrelativePath
- relative path within the JAR where the file's contents should appearisTemporary
- whether the artifact file is a temporary file or not
-
isEmpty
public boolean isEmpty()
-
add
public void add(Artifacts.FullAndPartURIs artifact)
Adds a new artifact to the collection of artifacts to be added to the client JAR file so they can be delivered to the client during a download.Note that the "full" part of the FullAndPartURIs object can be of the form "jar:path-to-jar!entry-within-jar"
- Parameters:
artifact
-
-
addAll
public void addAll(File baseFile, Collection<File> artifactFiles)
Adds all artifacts in Collection to those to be added to the client facade JAR.- Parameters:
baseFile
- File for the base directory within which each artifact liesartifactFiles
- Collection of File objects for the artifacts to be included- Throws:
IllegalStateException
- if invoked after the accumulated artifacts have been consumed
-
artifacts
public Collection<Artifacts.FullAndPartURIs> artifacts()
Returns the set (in unmodifiable form) of FullAndPartURIs for the accumulated artifacts.Note: Intended for use only by the app client deployer.
- Returns:
- all client artifacts reported by various deployers
-
-