Class WebappStructure

java.lang.Object
org.apache.maven.plugins.war.util.WebappStructure

public class WebappStructure extends Object
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).
  • Field Details

  • Constructor Details

    • WebappStructure

      public WebappStructure(List<org.apache.maven.model.Dependency> dependencies)
      Creates a new empty instance.
      Parameters:
      dependencies - the dependencies of the project
  • Method Details

    • getDependenciesInfo

      public List<DependencyInfo> getDependenciesInfo()
      Returns the list of DependencyInfo for the project.
      Returns:
      the dependencies information of the project
    • getDependencies

      public List<org.apache.maven.model.Dependency> getDependencies()
      Returns the dependencies of the project.
      Returns:
      the dependencies of the project
    • isRegistered

      public boolean isRegistered(String path)
      Specify if the specified path is registered or not.
      Parameters:
      path - the relative path from the webapp root directory
      Returns:
      true if the path is registered, false otherwise
    • registerFile

      public boolean registerFile(String id, String path)
      Registers the specified path for the specified owner. Returns true if the path is not already registered, false otherwise.
      Parameters:
      id - the owner of the path
      path - the relative path from the webapp root directory
      Returns:
      true if the file was registered successfully
    • registerFileForced

      public boolean registerFileForced(String id, String path)
      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); returns true if an owner replacement was made and false if the file was simply registered for the first time.

      Parameters:
      id - the owner of the path
      path - 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 the callback with the result of the registration.
      Parameters:
      id - the owner of the path
      path - the relative path from the webapp root directory
      callback - the callback to invoke with the result of the registration
      Throws:
      IOException - if the callback invocation throws an IOException
    • getOwner

      public String getOwner(String path)
      Returns the owner of the specified path. If the file is not registered, returns null
      Parameters:
      path - the relative path from the webapp root directory
      Returns:
      the owner or null.
    • getOwners

      public Set<String> getOwners()
      Returns the owners.
      Returns:
      the list of owners
    • getFullStructure

      public PathSet getFullStructure()
      Returns all paths that have been registered so far.
      Returns:
      all registered path
    • getStructure

      public PathSet getStructure(String id)
      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 artifact
      targetFileName - the target file name
    • doRegister

      private void doRegister(String id, String path)
    • createDependenciesInfoList

      private List<DependencyInfo> createDependenciesInfoList(List<org.apache.maven.model.Dependency> dependencies)
    • readResolve

      private Object readResolve()