From fb8689a20bef83b8fe4cb810fdab39602cca9c6f Mon Sep 17 00:00:00 2001 From: kw Date: Thu, 10 Oct 2019 00:25:05 +0800 Subject: [PATCH 1/4] source converter support configure --- .../salesforce/mirus/config/TaskConfig.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/salesforce/mirus/config/TaskConfig.java b/src/main/java/com/salesforce/mirus/config/TaskConfig.java index 6f51f04..96953f9 100644 --- a/src/main/java/com/salesforce/mirus/config/TaskConfig.java +++ b/src/main/java/com/salesforce/mirus/config/TaskConfig.java @@ -78,8 +78,11 @@ public Converter getKeyConverter() { SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); - return config.getConfiguredInstance( - SourceConfigDefinition.SOURCE_KEY_CONVERTER.key, Converter.class); + Converter converter = config.getConfiguredInstance( + SourceConfigDefinition.SOURCE_KEY_CONVERTER.key, Converter.class); + converter.configure( + config.originalsWithPrefix(SourceConfigDefinition.SOURCE_KEY_CONVERTER.key + "."),true); + return converter; } public Converter getValueConverter() { @@ -88,8 +91,11 @@ public Converter getValueConverter() { SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); - return config.getConfiguredInstance( - SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key, Converter.class); + Converter converter = config.getConfiguredInstance( + SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key, Converter.class); + converter.configure( + config.originalsWithPrefix(SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key + "."),false); + return converter; } public HeaderConverter getHeaderConverter() { @@ -98,7 +104,10 @@ public HeaderConverter getHeaderConverter() { SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); - return config.getConfiguredInstance( - SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key, HeaderConverter.class); + HeaderConverter headerConverter = config.getConfiguredInstance( + SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key, HeaderConverter.class); + headerConverter.configure( + config.originalsWithPrefix(SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key + ".")); + return headerConverter; } } From 923b8b922db440dd64126f6d0aed1efebd68004b Mon Sep 17 00:00:00 2001 From: kw Date: Thu, 10 Oct 2019 22:48:24 +0800 Subject: [PATCH 2/4] source converter support configure --- .../salesforce/mirus/config/TaskConfig.java | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/salesforce/mirus/config/TaskConfig.java b/src/main/java/com/salesforce/mirus/config/TaskConfig.java index 96953f9..5b7a152 100644 --- a/src/main/java/com/salesforce/mirus/config/TaskConfig.java +++ b/src/main/java/com/salesforce/mirus/config/TaskConfig.java @@ -74,40 +74,32 @@ public boolean getEnablePartitionMatching() { public Converter getKeyConverter() { Map conf = simpleConfig.originals(); - conf.put(StringConverterConfig.TYPE_CONFIG, ConverterType.KEY.getName()); + conf.putAll(simpleConfig.originalsWithPrefix(SourceConfigDefinition.SOURCE_KEY_CONVERTER.key + ".")); - SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); - - Converter converter = config.getConfiguredInstance( + Converter converter = simpleConfig.getConfiguredInstance( SourceConfigDefinition.SOURCE_KEY_CONVERTER.key, Converter.class); - converter.configure( - config.originalsWithPrefix(SourceConfigDefinition.SOURCE_KEY_CONVERTER.key + "."),true); + converter.configure(conf,true); return converter; } public Converter getValueConverter() { Map conf = simpleConfig.originals(); - conf.put(StringConverterConfig.TYPE_CONFIG, ConverterType.VALUE.getName()); - - SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); + conf.putAll(simpleConfig.originalsWithPrefix(SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key + ".")); - Converter converter = config.getConfiguredInstance( + Converter converter = simpleConfig.getConfiguredInstance( SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key, Converter.class); - converter.configure( - config.originalsWithPrefix(SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key + "."),false); + converter.configure(conf,false); return converter; } public HeaderConverter getHeaderConverter() { Map conf = simpleConfig.originals(); conf.put(StringConverterConfig.TYPE_CONFIG, ConverterType.HEADER.getName()); + conf.putAll(simpleConfig.originalsWithPrefix(SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key + ".")); - SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); - - HeaderConverter headerConverter = config.getConfiguredInstance( + HeaderConverter headerConverter = simpleConfig.getConfiguredInstance( SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key, HeaderConverter.class); - headerConverter.configure( - config.originalsWithPrefix(SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key + ".")); + headerConverter.configure(conf); return headerConverter; } } From 8cac8bf7c13149bd6d731491948ea17585cc01ab Mon Sep 17 00:00:00 2001 From: kw Date: Thu, 10 Oct 2019 22:50:40 +0800 Subject: [PATCH 3/4] source converter support configure --- src/main/java/com/salesforce/mirus/config/TaskConfig.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/salesforce/mirus/config/TaskConfig.java b/src/main/java/com/salesforce/mirus/config/TaskConfig.java index 5b7a152..6383eea 100644 --- a/src/main/java/com/salesforce/mirus/config/TaskConfig.java +++ b/src/main/java/com/salesforce/mirus/config/TaskConfig.java @@ -74,6 +74,7 @@ public boolean getEnablePartitionMatching() { public Converter getKeyConverter() { Map conf = simpleConfig.originals(); + conf.put(StringConverterConfig.TYPE_CONFIG, ConverterType.KEY.getName()); conf.putAll(simpleConfig.originalsWithPrefix(SourceConfigDefinition.SOURCE_KEY_CONVERTER.key + ".")); Converter converter = simpleConfig.getConfiguredInstance( @@ -84,6 +85,7 @@ public Converter getKeyConverter() { public Converter getValueConverter() { Map conf = simpleConfig.originals(); + conf.put(StringConverterConfig.TYPE_CONFIG, ConverterType.VALUE.getName()); conf.putAll(simpleConfig.originalsWithPrefix(SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key + ".")); Converter converter = simpleConfig.getConfiguredInstance( From 2bd6ee9bcaea2ad33fcb3f71349b43674b3c6a1d Mon Sep 17 00:00:00 2001 From: kw Date: Thu, 10 Oct 2019 22:58:48 +0800 Subject: [PATCH 4/4] source converter support configure --- .../salesforce/mirus/config/TaskConfig.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/salesforce/mirus/config/TaskConfig.java b/src/main/java/com/salesforce/mirus/config/TaskConfig.java index 6383eea..efc70d9 100644 --- a/src/main/java/com/salesforce/mirus/config/TaskConfig.java +++ b/src/main/java/com/salesforce/mirus/config/TaskConfig.java @@ -77,10 +77,10 @@ public Converter getKeyConverter() { conf.put(StringConverterConfig.TYPE_CONFIG, ConverterType.KEY.getName()); conf.putAll(simpleConfig.originalsWithPrefix(SourceConfigDefinition.SOURCE_KEY_CONVERTER.key + ".")); - Converter converter = simpleConfig.getConfiguredInstance( - SourceConfigDefinition.SOURCE_KEY_CONVERTER.key, Converter.class); - converter.configure(conf,true); - return converter; + SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); + + return config.getConfiguredInstance( + SourceConfigDefinition.SOURCE_KEY_CONVERTER.key, Converter.class); } public Converter getValueConverter() { @@ -88,10 +88,10 @@ public Converter getValueConverter() { conf.put(StringConverterConfig.TYPE_CONFIG, ConverterType.VALUE.getName()); conf.putAll(simpleConfig.originalsWithPrefix(SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key + ".")); - Converter converter = simpleConfig.getConfiguredInstance( - SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key, Converter.class); - converter.configure(conf,false); - return converter; + SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); + + return config.getConfiguredInstance( + SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key, Converter.class); } public HeaderConverter getHeaderConverter() { @@ -99,9 +99,9 @@ public HeaderConverter getHeaderConverter() { conf.put(StringConverterConfig.TYPE_CONFIG, ConverterType.HEADER.getName()); conf.putAll(simpleConfig.originalsWithPrefix(SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key + ".")); - HeaderConverter headerConverter = simpleConfig.getConfiguredInstance( - SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key, HeaderConverter.class); - headerConverter.configure(conf); - return headerConverter; + SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf); + + return config.getConfiguredInstance( + SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key, HeaderConverter.class); } }