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).
- Author:
- Stephane Nicoll
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback interface to handle events related to filepath registration in the webapp. -
Constructor Summary
ConstructorsConstructorDescriptionWebappStructure(List<org.apache.maven.model.Dependency> dependencies) Creates a new empty instance. -
Method Summary
Modifier and TypeMethodDescriptionList<org.apache.maven.model.Dependency> Returns the dependencies of the project.Returns the list ofDependencyInfofor 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.booleanisRegistered(String path) Specify if the specifiedpathis registered or not.booleanregisterFile(String id, String path) Registers the specified path for the specified owner.voidregisterFile(String id, String path, WebappStructure.RegistrationCallback callback) Registers the specified path for the specified owner.booleanregisterFileForced(String id, String path) Forces the registration of the specified path for the specified owner.voidregisterTargetFileName(org.apache.maven.artifact.Artifact artifact, String targetFileName) Registers the target file name for the specified artifact.
-
Constructor Details
-
WebappStructure
Creates a new empty instance.- Parameters:
dependencies- the dependencies of the project
-
-
Method Details
-
getDependenciesInfo
Returns the list ofDependencyInfofor 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 specifiedpathis 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. Returnstrueif the path is not already registered,falseotherwise.- 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); returnstrueif an owner replacement was made andfalseif 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 thecallbackwith 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
-