public class WebappStructure
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
WebappStructure.DependenciesAnalysisCallback
Callback interface to handle events related to dependencies analysis.
|
static interface |
WebappStructure.RegistrationCallback
Callback interface to handle events related to filepath registration in the webapp.
|
Modifier and Type | Field and Description |
---|---|
private PathSet |
allFiles |
private WebappStructure |
cache |
private java.util.List<DependencyInfo> |
dependenciesInfo |
private java.util.Map<java.lang.String,PathSet> |
registeredFiles |
Constructor and Description |
---|
WebappStructure(java.util.List<org.apache.maven.model.Dependency> dependencies)
Creates a new empty instance.
|
WebappStructure(java.util.List<org.apache.maven.model.Dependency> dependencies,
WebappStructure cache)
Creates a new instance with the specified cache.
|
Modifier and Type | Method and Description |
---|---|
void |
analyseDependencies(WebappStructure.DependenciesAnalysisCallback callback)
Analyze the dependencies of the project using the specified callback.
|
private java.util.List<DependencyInfo> |
createDependenciesInfoList(java.util.List<org.apache.maven.model.Dependency> dependencies) |
private void |
doRegister(java.lang.String id,
java.lang.String path) |
private org.apache.maven.model.Dependency |
findDependency(org.apache.maven.model.Dependency dependency,
java.util.List<org.apache.maven.model.Dependency> dependencies)
Find a dependency that is similar from the specified dependency.
|
java.lang.String |
getCachedTargetFileName(org.apache.maven.model.Dependency dependency)
Returns the cached target file name that matches the specified dependency, that is the target file name of the
previous run.
|
java.util.List<org.apache.maven.model.Dependency> |
getDependencies()
Returns the dependencies of the project.
|
java.util.List<DependencyInfo> |
getDependenciesInfo()
Returns the list of
DependencyInfo for the project. |
PathSet |
getFullStructure()
Returns all paths that have been registered so far.
|
java.lang.String |
getOwner(java.lang.String path)
Returns the owner of the specified path.
|
java.util.Set<java.lang.String> |
getOwners()
Returns the owners.
|
PathSet |
getStructure(java.lang.String id)
Returns the list of registered files for the specified owner.
|
boolean |
isRegistered(java.lang.String path)
Specify if the specified path is registered or not.
|
private org.apache.maven.model.Dependency |
matchDependency(java.util.List<org.apache.maven.model.Dependency> dependencies,
org.apache.maven.model.Dependency dependency) |
private java.lang.Object |
readResolve() |
boolean |
registerFile(java.lang.String id,
java.lang.String path)
Registers the specified path for the specified owner.
|
void |
registerFile(java.lang.String id,
java.lang.String path,
WebappStructure.RegistrationCallback callback)
Registers the specified path for the specified owner.
|
boolean |
registerFileForced(java.lang.String id,
java.lang.String path)
Forces the registration of the specified path for the specified owner.
|
void |
registerTargetFileName(org.apache.maven.artifact.Artifact artifact,
java.lang.String targetFileName)
Registers the target file name for the specified artifact.
|
private java.util.Map<java.lang.String,PathSet> registeredFiles
private java.util.List<DependencyInfo> dependenciesInfo
private transient PathSet allFiles
private transient WebappStructure cache
public WebappStructure(java.util.List<org.apache.maven.model.Dependency> dependencies)
dependencies
- the dependencies of the projectpublic WebappStructure(java.util.List<org.apache.maven.model.Dependency> dependencies, WebappStructure cache)
dependencies
- the dependencies of the projectcache
- the cachepublic java.util.List<DependencyInfo> getDependenciesInfo()
DependencyInfo
for the project.public java.util.List<org.apache.maven.model.Dependency> getDependencies()
public boolean isRegistered(java.lang.String path)
path
- the relative path from the webapp root directorypublic boolean registerFile(java.lang.String id, java.lang.String path)
id
- the owner of the pathpath
- the relative path from the webapp root directorypublic boolean registerFileForced(java.lang.String id, java.lang.String path)
Beware that the semantic of the return boolean is different than the one from
registerFile(String, String)
; returns true if an owner replacement was made and false
if the file was simply registered for the first time.
id
- the owner of the pathpath
- the relative path from the webapp root directorypublic void registerFile(java.lang.String id, java.lang.String path, WebappStructure.RegistrationCallback callback) throws java.io.IOException
id
- the owner of the pathpath
- the relative path from the webapp root directorycallback
- the callback to invoke with the result of the registrationjava.io.IOException
- if the callback invocation throws an IOExceptionpublic java.lang.String getOwner(java.lang.String path)
path
- the relative path from the webapp root directorypublic java.util.Set<java.lang.String> getOwners()
Set
may be inconsistent since it represents a persistent
cache across multiple invocations.
For instance, if an overlay was removed in this execution, it will be still be there till the cache is cleaned. This happens when the clean mojo is invoked.
public PathSet getFullStructure()
public PathSet getStructure(java.lang.String id)
id
- the ownerpublic void analyseDependencies(WebappStructure.DependenciesAnalysisCallback callback)
callback
- the callback to use to report the result of the analysispublic void registerTargetFileName(org.apache.maven.artifact.Artifact artifact, java.lang.String targetFileName)
artifact
- the artifacttargetFileName
- the target file namepublic java.lang.String getCachedTargetFileName(org.apache.maven.model.Dependency dependency)
The dependency object may have changed so the comparison is based on basic attributes of the dependency.
dependency
- a dependencyprivate void doRegister(java.lang.String id, java.lang.String path)
private org.apache.maven.model.Dependency findDependency(org.apache.maven.model.Dependency dependency, java.util.List<org.apache.maven.model.Dependency> dependencies)
dependency
- the dependency to finddependencies
- a list of dependenciesprivate org.apache.maven.model.Dependency matchDependency(java.util.List<org.apache.maven.model.Dependency> dependencies, org.apache.maven.model.Dependency dependency)
private java.util.List<DependencyInfo> createDependenciesInfoList(java.util.List<org.apache.maven.model.Dependency> dependencies)
private java.lang.Object readResolve()