Apache Flink is an open source stream processing framework with powerful stream- and batch-processing capabilities
—
Configuration system and utility classes for program execution, memory management, parameter handling, and system integration.
Key-value configuration system for Flink applications.
/**
* Key-value configuration container
*/
class Configuration {
/**
* Create empty configuration
*/
public Configuration();
/**
* Get configuration value
* @param option Configuration option
* @param <T> Value type
* @return Configuration value
*/
public <T> T get(ConfigOption<T> option);
/**
* Set configuration value
* @param option Configuration option
* @param value Value to set
* @param <T> Value type
*/
public <T> void set(ConfigOption<T> option, T value);
/**
* Set string value
* @param key Configuration key
* @param value String value
*/
public void setString(String key, String value);
/**
* Get string value
* @param key Configuration key
* @param defaultValue Default value
* @return String value
*/
public String getString(String key, String defaultValue);
/**
* Set integer value
* @param key Configuration key
* @param value Integer value
*/
public void setInteger(String key, int value);
/**
* Get integer value
* @param key Configuration key
* @param defaultValue Default value
* @return Integer value
*/
public int getInteger(String key, int defaultValue);
/**
* Set boolean value
* @param key Configuration key
* @param value Boolean value
*/
public void setBoolean(String key, boolean value);
/**
* Get boolean value
* @param key Configuration key
* @param defaultValue Default value
* @return Boolean value
*/
public boolean getBoolean(String key, boolean defaultValue);
/**
* Add all from other configuration
* @param other Other configuration
*/
public void addAll(Configuration other);
/**
* Check if key exists
* @param key Configuration key
* @return true if key exists
*/
public boolean containsKey(String key);
/**
* Get all keys
* @return Set of all keys
*/
public Set<String> keySet();
}
/**
* Configuration option with metadata
* @param <T> Option value type
*/
class ConfigOption<T> {
/**
* Get option key
* @return Option key
*/
public String key();
/**
* Get default value
* @return Default value
*/
public T defaultValue();
/**
* Check if option has default value
* @return true if has default
*/
public boolean hasDefaultValue();
/**
* Get option description
* @return Option description
*/
public String description();
}
/**
* Builder for configuration options
*/
class ConfigOptions {
/**
* Create string option key
* @param key Option key
* @return String option builder
*/
public static OptionBuilder key(String key);
/**
* Option builder
*/
public static class OptionBuilder {
/**
* Set option as string type
* @return String option builder
*/
public StringConfigOptionBuilder stringType();
/**
* Set option as integer type
* @return Integer option builder
*/
public IntConfigOptionBuilder intType();
/**
* Set option as boolean type
* @return Boolean option builder
*/
public BooleanConfigOptionBuilder booleanType();
/**
* Set option as long type
* @return Long option builder
*/
public LongConfigOptionBuilder longType();
/**
* Set option as duration type
* @return Duration option builder
*/
public DurationConfigOptionBuilder durationType();
/**
* Set option as memory size type
* @return Memory size option builder
*/
public MemorySizeConfigOptionBuilder memorySizeType();
}
}Utility classes for memory size specifications and management.
/**
* Utility class for memory size specifications
*/
class MemorySize {
/**
* Parse memory size from string
* @param text Memory size text (e.g., "128mb", "1gb")
* @return MemorySize instance
*/
public static MemorySize parse(String text);
/**
* Create memory size from bytes
* @param bytes Number of bytes
* @return MemorySize instance
*/
public static MemorySize ofBytes(long bytes);
/**
* Create memory size from kilobytes
* @param kilobytes Number of kilobytes
* @return MemorySize instance
*/
public static MemorySize ofKibiBytes(long kilobytes);
/**
* Create memory size from megabytes
* @param megabytes Number of megabytes
* @return MemorySize instance
*/
public static MemorySize ofMebiBytes(long megabytes);
/**
* Create memory size from gigabytes
* @param gigabytes Number of gigabytes
* @return MemorySize instance
*/
public static MemorySize ofGibiBytes(long gigabytes);
/**
* Get size in bytes
* @return Size in bytes
*/
public long getBytes();
/**
* Get size in kilobytes
* @return Size in kilobytes
*/
public long getKibiBytes();
/**
* Get size in megabytes
* @return Size in megabytes
*/
public long getMebiBytes();
/**
* Get size in gigabytes
* @return Size in gigabytes
*/
public long getGibiBytes();
/**
* Add memory sizes
* @param other Other memory size
* @return Sum of memory sizes
*/
public MemorySize add(MemorySize other);
/**
* Subtract memory sizes
* @param other Other memory size
* @return Difference of memory sizes
*/
public MemorySize subtract(MemorySize other);
/**
* Multiply memory size
* @param multiplier Multiplier
* @return Multiplied memory size
*/
public MemorySize multiply(double multiplier);
/**
* Divide memory size
* @param divisor Divisor
* @return Divided memory size
*/
public MemorySize divide(long divisor);
}Utility for handling command line parameters and program arguments.
/**
* Utility for handling command line parameters
*/
class ParameterTool {
/**
* Create from program arguments
* @param args Program arguments
* @return ParameterTool instance
*/
public static ParameterTool fromArgs(String[] args);
/**
* Create from properties file
* @param file Properties file
* @return ParameterTool instance
* @throws IOException
*/
public static ParameterTool fromPropertiesFile(String file) throws IOException;
/**
* Create from properties file
* @param file Properties file
* @return ParameterTool instance
* @throws IOException
*/
public static ParameterTool fromPropertiesFile(File file) throws IOException;
/**
* Create from system properties
* @return ParameterTool instance
*/
public static ParameterTool fromSystemProperties();
/**
* Create from map
* @param map Parameter map
* @return ParameterTool instance
*/
public static ParameterTool fromMap(Map<String, String> map);
/**
* Get parameter value
* @param key Parameter key
* @return Parameter value or null
*/
public String get(String key);
/**
* Get parameter value with default
* @param key Parameter key
* @param defaultValue Default value
* @return Parameter value or default
*/
public String get(String key, String defaultValue);
/**
* Get required parameter
* @param key Parameter key
* @return Parameter value
* @throws RuntimeException if key not found
*/
public String getRequired(String key);
/**
* Get integer parameter
* @param key Parameter key
* @param defaultValue Default value
* @return Integer parameter value
*/
public int getInt(String key, int defaultValue);
/**
* Get long parameter
* @param key Parameter key
* @param defaultValue Default value
* @return Long parameter value
*/
public long getLong(String key, long defaultValue);
/**
* Get boolean parameter
* @param key Parameter key
* @param defaultValue Default value
* @return Boolean parameter value
*/
public boolean getBoolean(String key, boolean defaultValue);
/**
* Check if parameter exists
* @param key Parameter key
* @return true if parameter exists
*/
public boolean has(String key);
/**
* Get all parameters as properties
* @return Properties object
*/
public Properties getProperties();
/**
* Convert to configuration
* @return Configuration object
*/
public Configuration getConfiguration();
/**
* Merge with other parameter tool
* @param other Other parameter tool
* @return Merged parameter tool
*/
public ParameterTool mergeWith(ParameterTool other);
}File system abstraction and utilities.
/**
* Abstract file system for various backends
*/
abstract class FileSystem {
/**
* Get file system for path
* @param uri File system URI
* @return File system instance
* @throws IOException
*/
public static FileSystem get(URI uri) throws IOException;
/**
* Get local file system
* @return Local file system
* @throws IOException
*/
public static FileSystem getLocalFileSystem() throws IOException;
/**
* Open file for reading
* @param f File path
* @return Input stream
* @throws IOException
*/
public abstract FSDataInputStream open(Path f) throws IOException;
/**
* Create file for writing
* @param f File path
* @param overwrite Whether to overwrite existing file
* @return Output stream
* @throws IOException
*/
public abstract FSDataOutputStream create(Path f, boolean overwrite) throws IOException;
/**
* Delete file or directory
* @param path Path to delete
* @param recursive Whether to delete recursively
* @return true if successfully deleted
* @throws IOException
*/
public abstract boolean delete(Path path, boolean recursive) throws IOException;
/**
* List files in directory
* @param path Directory path
* @return Array of file statuses
* @throws IOException
*/
public abstract FileStatus[] listStatus(Path path) throws IOException;
/**
* Get file status
* @param path File path
* @return File status
* @throws IOException
*/
public abstract FileStatus getFileStatus(Path path) throws IOException;
/**
* Check if path exists
* @param path Path to check
* @return true if exists
* @throws IOException
*/
public boolean exists(Path path) throws IOException;
/**
* Create directory
* @param path Directory path
* @return true if created
* @throws IOException
*/
public abstract boolean mkdirs(Path path) throws IOException;
}
/**
* File path representation
*/
class Path {
/**
* Create path from string
* @param pathString Path string
*/
public Path(String pathString);
/**
* Create path from URI
* @param uri Path URI
*/
public Path(URI uri);
/**
* Create path with parent
* @param parent Parent path
* @param child Child path
*/
public Path(Path parent, String child);
/**
* Get path name
* @return Path name
*/
public String getName();
/**
* Get parent path
* @return Parent path
*/
public Path getParent();
/**
* Get path suffix
* @param suffix Suffix to add
* @return Path with suffix
*/
public Path suffix(String suffix);
/**
* Convert to URI
* @return Path URI
*/
public URI toUri();
/**
* Get path string
* @return Path string
*/
public String getPath();
/**
* Check if path is absolute
* @return true if absolute
*/
public boolean isAbsolute();
}Time-related utility classes and duration handling.
/**
* Time utility class
*/
class Time {
/**
* Create time from milliseconds
* @param milliseconds Milliseconds
* @return Time instance
*/
public static Time milliseconds(long milliseconds);
/**
* Create time from seconds
* @param seconds Seconds
* @return Time instance
*/
public static Time seconds(long seconds);
/**
* Create time from minutes
* @param minutes Minutes
* @return Time instance
*/
public static Time minutes(long minutes);
/**
* Create time from hours
* @param hours Hours
* @return Time instance
*/
public static Time hours(long hours);
/**
* Create time from days
* @param days Days
* @return Time instance
*/
public static Time days(long days);
/**
* Get time in milliseconds
* @return Milliseconds
*/
public long toMilliseconds();
/**
* Get time size
* @return Time size
*/
public long getSize();
/**
* Get time unit
* @return Time unit
*/
public TimeUnit getUnit();
}Install with Tessl CLI
npx tessl i tessl/maven-org-apache-flink--flink-parent