Class ClientArtifactsManager
- All Implemented Interfaces:
Closeable,AutoCloseable
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 each add 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 the artifacts method has been invoked.
FIXME This class is unable to control open resources and can cause IO leaks.
- Author:
- tjuinn
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds 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.voidAdds 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.voidAdds 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.voidadd(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.voidaddAll(File baseFile, Collection<File> artifactFiles) Adds all artifacts in Collection to those to be added to the client facade JAR.Returns the set (in unmodifiable form) of FullAndPartURIs for the accumulated artifacts.voidclose()booleanbooleanstatic ClientArtifactsManagerget(org.glassfish.api.deployment.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.booleanisEmpty()
-
Constructor Details
-
ClientArtifactsManager
public ClientArtifactsManager()
-
-
Method Details
-
get
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
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
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
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
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
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
-
contains
-
contains
-
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
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-