Class PackagedProgram

  • All Implemented Interfaces:
    AutoCloseable

    public class PackagedProgram
    extends Object
    implements AutoCloseable
    This class encapsulates represents a program, packaged in a jar file. It supplies functionality to extract nested libraries, search for the program entry point, and extract a program plan.
    • Field Detail

      • MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS

        public static final String MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS
        Property name of the entry in JAR manifest file that describes the Flink specific entry point.
        See Also:
        Constant Field Values
      • MANIFEST_ATTRIBUTE_MAIN_CLASS

        public static final String MANIFEST_ATTRIBUTE_MAIN_CLASS
        Property name of the entry in JAR manifest file that describes the class with the main method.
        See Also:
        Constant Field Values
    • Method Detail

      • getArguments

        public String[] getArguments()
      • getMainClassName

        public String getMainClassName()
      • getDescription

        @Nullable
        public String getDescription()
                              throws ProgramInvocationException
        Returns the description provided by the Program class. This may contain a description of the plan itself and its arguments.
        Returns:
        The description of the PactProgram's input parameters.
        Throws:
        ProgramInvocationException - This invocation is thrown if the Program can't be properly loaded. Causes may be a missing / wrong class or manifest files.
      • invokeInteractiveModeForExecution

        public void invokeInteractiveModeForExecution()
                                               throws ProgramInvocationException
        This method assumes that the context environment is prepared, or the execution will be a local execution by default.
        Throws:
        ProgramInvocationException
      • getClasspaths

        public List<URL> getClasspaths()
        Returns the classpaths that are required by the program.
        Returns:
        List of URLs.
      • getUserCodeClassLoader

        public ClassLoader getUserCodeClassLoader()
        Gets the ClassLoader that must be used to load user code classes.
        Returns:
        The user code ClassLoader.
      • getJobJarAndDependencies

        public List<URL> getJobJarAndDependencies()
        Returns all provided libraries needed to run the program.
      • extractContainedLibraries

        public static List<File> extractContainedLibraries​(URL jarFile)
                                                    throws ProgramInvocationException
        Takes all JAR files that are contained in this program's JAR file and extracts them to the system's temp directory.
        Returns:
        The file names of the extracted temporary files.
        Throws:
        ProgramInvocationException - Thrown, if the extraction process failed.