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 classPackagedProgram.BuilderA Builder ForPackagedProgram.
-
Field Summary
Fields Modifier and Type Field Description static StringMANIFEST_ATTRIBUTE_ASSEMBLER_CLASSProperty name of the entry in JAR manifest file that describes the Flink specific entry point.static StringMANIFEST_ATTRIBUTE_MAIN_CLASSProperty 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 voidclose()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.StringgetDescription()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.StringgetMainClassName()org.apache.flink.runtime.jobgraph.SavepointRestoreSettingsgetSavepointSettings()ClassLoadergetUserCodeClassLoader()Gets theClassLoaderthat must be used to load user code classes.voidinvokeInteractiveModeForExecution()This method assumes that the context environment is prepared, or the execution will be a local execution by default.static PackagedProgram.BuildernewBuilder()
-
-
-
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 org.apache.flink.runtime.jobgraph.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 ProgramInvocationExceptionThis 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 theClassLoaderthat 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:
closein interfaceAutoCloseable
-
newBuilder
public static PackagedProgram.Builder newBuilder()
-
-