Class BinaryScannerUtil


  • public abstract class BinaryScannerUtil
    extends Object
    • Constructor Detail

      • BinaryScannerUtil

        public BinaryScannerUtil​(File binaryScanner)
    • Method Detail

      • debug

        public abstract void debug​(String message)
      • error

        public abstract void error​(String message)
      • warn

        public abstract void warn​(String message)
      • info

        public abstract void info​(String message)
      • isDebugEnabled

        public abstract boolean isDebugEnabled()
      • reRunBinaryScanner

        public Set<String> reRunBinaryScanner​(Set<String> allClassesDirectories,
                                              String logLocation,
                                              String targetJavaEE,
                                              String targetMicroProfile)
                                       throws PluginExecutionException
        The method is intended to call the binary scanner to generate a list of the optimal features for an application. This optimal list can be reported to the user as a suggested list of features. In order to generate the optimal list we must scan all classes in the application and we do not consider the features already specified in the server configuration (server.xml).
        Parameters:
        allClassesDirectories - - the scanner will find all the class files in this set of directories
        logLocation - - directory name relative to project or absolute path passed to binary scanner
        targetJavaEE - - generate features valid for the indicated version of EE
        targetMicroProfile - - generate features valid for the indicated version of MicroProfile
        Returns:
        - a set of features that will allow the application to run in a Liberty server
        Throws:
        PluginExecutionException - - any exception that prevents the scanner from running
      • composeEEVersion

        public static String composeEEVersion​(String ver)
        Create the string required by the binary scanner parameter targetJavaEE E.g. ee7, ee8 etc
        Parameters:
        ver - the String value version number read from the build file (pom.xml, build.gradle) E.g. 8, 8.0, 8.0.0 etc. This is verified by the parser and cannot be blank.
        Returns:
        String parameter passed to binary scanner
      • composeMPVersion

        public static String composeMPVersion​(String ver)
        Create the string required by the binary scanner parameter targetMicroProfile E.g. mp1.3, mp4.1 etc
        Parameters:
        ver - the String value version number read from the build file (pom.xml, build.gradle) E.g. 1, 2.1 etc. This is verified by the parser and cannot be blank.
        Returns:
        String parameter passed to binary scanner or null in case of error
      • buildInvalidArgExceptionMessage

        public static String buildInvalidArgExceptionMessage​(String invalidEEArg,
                                                             String invalidMPArg,
                                                             String eeVersion,
                                                             String mpVersion)
        Convenience method to build the string reported to the user when the exception is detected. This is used after the caller has analyzed the Java or Jakarta EE version number and the MicroProfile version number and generated argument values to pass to the binary scanner. If the binary scanner detects a problem and throws an exception it reports the invalid arguments. We must map the invalid arguments back to the user specified version number in order to fix the problem.
        Parameters:
        invalidEEArg - - the argument passed to the binary scanner which may be returned as invalid.
        invalidMPArg - - the argument passed to the binary scanner which may be returned as invalid.
        eeVersion - - the user specified version string from the build file used to generate the arg.
        mpVersion - - the user specified version string from the build file used to generate the arg.
        Returns:
        a string we can report to the user to report an error or errors and guide the effort to fix it.