Class WebappStructure
java.lang.Object
org.apache.maven.plugins.war.util.WebappStructure
Represents the structure of a web application composed of multiple overlays. Each overlay is registered within this
structure with the set of files it holds.
Note that this structure is persisted to disk at each invocation to store which owner holds which path (file).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Callback interface to handle events related to filepath registration in the webapp. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWebappStructure
(List<org.apache.maven.model.Dependency> dependencies) Creates a new empty instance. -
Method Summary
Modifier and TypeMethodDescriptionprivate List
<DependencyInfo> createDependenciesInfoList
(List<org.apache.maven.model.Dependency> dependencies) private void
doRegister
(String id, String path) List
<org.apache.maven.model.Dependency> Returns the dependencies of the project.Returns the list ofDependencyInfo
for the project.Returns all paths that have been registered so far.Returns the owner of the specifiedpath
.Returns the owners.getStructure
(String id) Returns the list of registered files for the specified owner.boolean
isRegistered
(String path) Specify if the specifiedpath
is registered or not.private Object
boolean
registerFile
(String id, String path) Registers the specified path for the specified owner.void
registerFile
(String id, String path, WebappStructure.RegistrationCallback callback) Registers the specified path for the specified owner.boolean
registerFileForced
(String id, String path) Forces the registration of the specified path for the specified owner.void
registerTargetFileName
(org.apache.maven.artifact.Artifact artifact, String targetFileName) Registers the target file name for the specified artifact.
-
Field Details
-
registeredFiles
-
dependenciesInfo
-
allFiles
-
-
Constructor Details
-
WebappStructure
Creates a new empty instance.- Parameters:
dependencies
- the dependencies of the project
-
-
Method Details
-
getDependenciesInfo
Returns the list ofDependencyInfo
for the project.- Returns:
- the dependencies information of the project
-
getDependencies
Returns the dependencies of the project.- Returns:
- the dependencies of the project
-
isRegistered
Specify if the specifiedpath
is registered or not.- Parameters:
path
- the relative path from the webapp root directory- Returns:
- true if the path is registered, false otherwise
-
registerFile
Registers the specified path for the specified owner. Returnstrue
if the path is not already registered,false
otherwise.- Parameters:
id
- the owner of the pathpath
- the relative path from the webapp root directory- Returns:
- true if the file was registered successfully
-
registerFileForced
Forces the registration of the specified path for the specified owner. If the file is not registered yet, a simple registration is performed. If the file already exists, the owner changes to the specified one.Beware that the semantic of the return boolean is different than the one from
registerFile(String, String)
; returnstrue
if an owner replacement was made andfalse
if the file was simply registered for the first time.- Parameters:
id
- the owner of the pathpath
- the relative path from the webapp root directory- Returns:
- false if the file did not exist, true if the owner was replaced
-
registerFile
public void registerFile(String id, String path, WebappStructure.RegistrationCallback callback) throws IOException Registers the specified path for the specified owner. Invokes thecallback
with the result of the registration.- Parameters:
id
- the owner of the pathpath
- the relative path from the webapp root directorycallback
- the callback to invoke with the result of the registration- Throws:
IOException
- if the callback invocation throws an IOException
-
getOwner
Returns the owner of the specifiedpath
. If the file is not registered, returnsnull
- Parameters:
path
- the relative path from the webapp root directory- Returns:
- the owner or
null
.
-
getOwners
Returns the owners.- Returns:
- the list of owners
-
getFullStructure
Returns all paths that have been registered so far.- Returns:
- all registered path
-
getStructure
Returns the list of registered files for the specified owner.- Parameters:
id
- the owner- Returns:
- the list of files registered for that owner
-
registerTargetFileName
public void registerTargetFileName(org.apache.maven.artifact.Artifact artifact, String targetFileName) Registers the target file name for the specified artifact.- Parameters:
artifact
- the artifacttargetFileName
- the target file name
-
doRegister
-
createDependenciesInfoList
private List<DependencyInfo> createDependenciesInfoList(List<org.apache.maven.model.Dependency> dependencies) -
readResolve
-