Package org.apache.flink.client.program
Class PackagedProgram
- java.lang.Object
-
- org.apache.flink.client.program.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PackagedProgram.Builder
A Builder ForPackagedProgram
.
-
Field Summary
Fields Modifier and Type Field Description static String
MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS
Property name of the entry in JAR manifest file that describes the Flink specific entry point.static String
MANIFEST_ATTRIBUTE_MAIN_CLASS
Property name of the entry in JAR manifest file that describes the class with the main method.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static List<File>
extractContainedLibraries(URL jarFile)
Takes all JAR files that are contained in this program's JAR file and extracts them to the system's temp directory.String[]
getArguments()
List<URL>
getClasspaths()
Returns the classpaths that are required by the program.String
getDescription()
Returns the description provided by the Program class.List<URL>
getJobJarAndDependencies()
Returns all provided libraries needed to run the program.static List<URL>
getJobJarAndDependencies(File jarFile, String entryPointClassName)
Returns all provided libraries needed to run the program.String
getMainClassName()
SavepointRestoreSettings
getSavepointSettings()
ClassLoader
getUserCodeClassLoader()
Gets theClassLoader
that must be used to load user code classes.void
invokeInteractiveModeForExecution()
This method assumes that the context environment is prepared, or the execution will be a local execution by default.static PackagedProgram.Builder
newBuilder()
-
-
-
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
-
getSavepointSettings
public SavepointRestoreSettings getSavepointSettings()
-
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
URL
s.
-
getUserCodeClassLoader
public ClassLoader getUserCodeClassLoader()
Gets theClassLoader
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.
-
getJobJarAndDependencies
public static List<URL> getJobJarAndDependencies(File jarFile, @Nullable String entryPointClassName) throws ProgramInvocationException
Returns all provided libraries needed to run the program.- Throws:
ProgramInvocationException
-
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.
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
newBuilder
public static PackagedProgram.Builder newBuilder()
-
-