Class OverlayManager


  • public class OverlayManager
    extends java.lang.Object
    Manages the overlays.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<org.apache.maven.artifact.Artifact> artifactsOverlays  
      private java.util.List<Overlay> overlays  
      private org.apache.maven.project.MavenProject project  
    • Constructor Summary

      Constructors 
      Constructor Description
      OverlayManager​(java.util.List<Overlay> overlays, org.apache.maven.project.MavenProject project, java.lang.String[] defaultIncludes, java.lang.String[] defaultExcludes, Overlay currentProjectOverlay)
      Creates a manager with the specified overlays.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean compareOverlayWithArtifact​(Overlay overlay, org.apache.maven.artifact.Artifact artifact)
      Compare groupId && artifactId && type && classifier.
      (package private) org.apache.maven.artifact.Artifact getAssociatedArtifact​(Overlay overlay)
      Returns the Artifact associated to the specified overlay.
      java.util.List<java.lang.String> getOverlayIds()
      Returns the id of the resolved overlays.
      java.util.List<Overlay> getOverlays()
      Returns the resolved overlays.
      private java.util.List<org.apache.maven.artifact.Artifact> getOverlaysAsArtifacts()
      Returns a list of WAR Artifact describing the overlays of the current project.
      (package private) void initialize​(java.lang.String[] defaultIncludes, java.lang.String[] defaultExcludes, Overlay currentProjectOverlay)
      Initializes the manager and validates the overlays configuration.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • overlays

        private final java.util.List<Overlay> overlays
      • project

        private final org.apache.maven.project.MavenProject project
      • artifactsOverlays

        private final java.util.List<org.apache.maven.artifact.Artifact> artifactsOverlays
    • Constructor Detail

      • OverlayManager

        public OverlayManager​(java.util.List<Overlay> overlays,
                              org.apache.maven.project.MavenProject project,
                              java.lang.String[] defaultIncludes,
                              java.lang.String[] defaultExcludes,
                              Overlay currentProjectOverlay)
                       throws InvalidOverlayConfigurationException
        Creates a manager with the specified overlays. Note that the list is potentially updated by the manager so a new list is created based on the overlays.
        Parameters:
        overlays - the overlays
        project - the maven project
        defaultIncludes - the default includes to use
        defaultExcludes - the default excludes to use
        currentProjectOverlay - the overlay for the current project
        Throws:
        InvalidOverlayConfigurationException - if the config is invalid
    • Method Detail

      • getOverlays

        public java.util.List<Overlay> getOverlays()
        Returns the resolved overlays.
        Returns:
        the overlays
      • getOverlayIds

        public java.util.List<java.lang.String> getOverlayIds()
        Returns the id of the resolved overlays.
        Returns:
        the overlay ids
      • initialize

        void initialize​(java.lang.String[] defaultIncludes,
                        java.lang.String[] defaultExcludes,
                        Overlay currentProjectOverlay)
                 throws InvalidOverlayConfigurationException
        Initializes the manager and validates the overlays configuration.
        Parameters:
        defaultIncludes - the default includes to use
        defaultExcludes - the default excludes to use
        currentProjectOverlay - the overlay for the current project
        Throws:
        InvalidOverlayConfigurationException - if the configuration is invalid
      • getAssociatedArtifact

        org.apache.maven.artifact.Artifact getAssociatedArtifact​(Overlay overlay)
                                                          throws InvalidOverlayConfigurationException
        Returns the Artifact associated to the specified overlay. If the overlay defines the current project, null is returned. If no artifact could not be found for the overlay a InvalidOverlayConfigurationException is thrown.
        Parameters:
        overlay - an overlay
        Returns:
        the artifact associated to the overlay
        Throws:
        InvalidOverlayConfigurationException - if the overlay does not have an associated artifact
      • compareOverlayWithArtifact

        private boolean compareOverlayWithArtifact​(Overlay overlay,
                                                   org.apache.maven.artifact.Artifact artifact)
        Compare groupId && artifactId && type && classifier.
        Parameters:
        overlay - the overlay
        artifact - the artifact
        Returns:
        boolean true if equals
      • getOverlaysAsArtifacts

        private java.util.List<org.apache.maven.artifact.Artifact> getOverlaysAsArtifacts()
        Returns a list of WAR Artifact describing the overlays of the current project.
        Returns:
        the overlays as artifacts objects