Class MergedWarArchive

    • Method Detail

      • firstWarFile

        protected WarArchive firstWarFile()
        Returns:
        the first war file in the merge list
      • addProcessor

        public void addProcessor​(String path,
                                 MergeProcessor merger)
        Parameters:
        path - in the path to merge to
        merger - in the processor to add
      • getWebXmlMerger

        public WebXmlMerger getWebXmlMerger()
                                     throws IOException,
                                            org.jdom2.JDOMException
        Get the web XML merger.
        Returns:
        the WebXml merger
        Throws:
        IOException - on an IO Exception
        org.jdom2.JDOMException - on a XML Parse Exception
      • getWebXml

        public WebXml getWebXml()
                         throws IOException,
                                org.jdom2.JDOMException
        Returns the deployment descriptor of the web application.
        Specified by:
        getWebXml in interface WarArchive
        Returns:
        The parsed deployment descriptor
        Throws:
        IOException - If there was a problem reading the deployment descriptor in the WAR
        org.jdom2.JDOMException - If the deployment descriptor of the WAR could not be parsed
      • executeMergeProcessors

        protected void executeMergeProcessors​(File assembleDir)
                                       throws MergeException,
                                              IOException
        Parameters:
        assembleDir - in the directory to output the merge data to
        Throws:
        MergeException - when there is a problem
        IOException - if an IO exception
      • store

        public void store​(File warFile)
                   throws MergeException,
                          IOException,
                          org.jdom2.JDOMException
        Here we do actual merge and store resulting war file into the new location. Stores the war archive to file. Changes to the descriptors of the war archive will be stored as well.
        Specified by:
        store in interface WarArchive
        Parameters:
        warFile - file to store the war in.
        Throws:
        IOException - If there was a problem reading the deployment descriptor in the WAR
        org.jdom2.JDOMException - If the deployment descriptor of the WAR could not be parsed
        MergeException
      • merge

        public void merge​(String assembleDir)
                   throws MergeException,
                          IOException,
                          org.jdom2.JDOMException
        Here we write combined archive file structure out into the new location.
        Parameters:
        assembleDir - target directory to write to
        Throws:
        IOException - If there was a problem reading the deployment descriptor in the WAR
        org.jdom2.JDOMException - If the deployment descriptor of the WAR could not be parsed
        MergeException - If one of merge processors fails
      • containsClass

        public boolean containsClass​(String theClassName)
                              throws IOException
        Returns whether a class of the specified name is contained in the archive.
        Specified by:
        containsClass in interface JarArchive
        Parameters:
        theClassName - The name of the class to search for
        Returns:
        Whether the class was found
        Throws:
        IOException - If an I/O error occurred reading the archive
      • findResource

        public String findResource​(String theName)
                            throws IOException
        Returns the full path of a named resource in the archive.
        Specified by:
        findResource in interface JarArchive
        Parameters:
        theName - The name of the resource
        Returns:
        The full path to the resource inside the archive
        Throws:
        IOException - If an I/O error occurred reading the archive
      • getResource

        public InputStream getResource​(String thePath)
                                throws IOException
        Returns a resource from the archive as input stream.
        Specified by:
        getResource in interface JarArchive
        Parameters:
        thePath - The path to the resource in the archive
        Returns:
        An input stream containing the specified resource, or null if the resource was not found in the JAR
        Throws:
        IOException - If an I/O error occurs
      • getResources

        public List<String> getResources​(String thePath)
                                  throws IOException
        Returns the list of resources in the specified directory in the archive.
        Specified by:
        getResources in interface JarArchive
        Parameters:
        thePath - The directory
        Returns:
        The list of resources
        Throws:
        IOException - If an I/O error occurs
      • expandToPath

        public void expandToPath​(String path)
                          throws IOException
        Expand the archive to the specified directory.
        Specified by:
        expandToPath in interface JarArchive
        Parameters:
        path - The path to expand to
        Throws:
        IOException - If an I/O error occurs
      • mergeJarFiles

        public void mergeJarFiles​(boolean mergeJarFiles)
        Control whether to also merge the JAR files.
        Parameters:
        mergeJarFiles - true if we do (default)