Class JavaArchiveUtils


  • public final class JavaArchiveUtils
    extends Object
    General Java Archive manipulation utilities.
    • Method Detail

      • hasJavaArchiveExtension

        public static boolean hasJavaArchiveExtension​(String fileName,
                                                      boolean processEar)
        Tests whether a file name has the Java archive extension.
        Parameters:
        fileName - the file name to test.
        processEar - if true, tests the EAR extension.
        Returns:
        true if the file name is not null and has Java archive extension; false otherwise.
      • removeJavaArchiveExtension

        public static String removeJavaArchiveExtension​(String fileName,
                                                        boolean processEar)
        Removes the Java archive extension from the file name.
        Parameters:
        fileName - the file name.
        processEar - if true, removes the EAR extension.
        Returns:
        The file name without extension.
      • hasWebArchiveExtension

        public static boolean hasWebArchiveExtension​(String fileName)
        Tests whether a file name has the Web archive extension.
        Parameters:
        fileName - the file name to test.
        Returns:
        true if the file name has Web archive extension; false otherwise.
      • hasWebInf

        public static boolean hasWebInf​(File archive)
        Tests whether archive contains WEB-INF subdirectory.
        Parameters:
        archive - the archive to test.
        Returns:
        true if the archive contains WEB-INF subdirectory; false otherwise.
      • hasContextRoot

        public static boolean hasContextRoot​(File archive)
        Tests whether archive has context root.

        Note: now tests only Web archives.

        Parameters:
        archive - the archive to test.
        Returns:
        true if the archive has context root; false otherwise.