demo-apps/demo-kda-app/src/main/java/com/amazonaws/services/kinesisanalytics/utils/ParameterToolUtils.java [11:33]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class ParameterToolUtils {
    public static ParameterTool fromApplicationProperties(Properties properties) {
        Map<String, String> map = new HashMap<>(properties.size());

        properties.forEach((k, v) -> map.put((String) k, (String) v));

        return ParameterTool.fromMap(map);
    }

    public static ParameterTool fromArgsAndApplicationProperties(String[] args) throws IOException {
        //read parameters from command line arguments (for debugging)
        ParameterTool parameter = ParameterTool.fromArgs(args);

        //read the parameters from the Kinesis Analytics environment
        Map<String, Properties> applicationProperties = KinesisAnalyticsRuntime.getApplicationProperties();

        Properties flinkProperties = applicationProperties.get("FlinkApplicationProperties");

        if (flinkProperties != null) {
            parameter = parameter.mergeWith(ParameterToolUtils.fromApplicationProperties(flinkProperties));
        }

        return parameter;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



demo-apps/demo-kinesis-driver/src/main/java/com/amazonaws/services/kinesisanalytics/utils/ParameterToolUtils.java [11:33]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class ParameterToolUtils {
    public static ParameterTool fromApplicationProperties(Properties properties) {
        Map<String, String> map = new HashMap<>(properties.size());

        properties.forEach((k, v) -> map.put((String) k, (String) v));

        return ParameterTool.fromMap(map);
    }

    public static ParameterTool fromArgsAndApplicationProperties(String[] args) throws IOException {
        //read parameters from command line arguments (for debugging)
        ParameterTool parameter = ParameterTool.fromArgs(args);

        //read the parameters from the Kinesis Analytics environment
        Map<String, Properties> applicationProperties = KinesisAnalyticsRuntime.getApplicationProperties();

        Properties flinkProperties = applicationProperties.get("FlinkApplicationProperties");

        if (flinkProperties != null) {
            parameter = parameter.mergeWith(ParameterToolUtils.fromApplicationProperties(flinkProperties));
        }

        return parameter;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



