[ 
https://issues.apache.org/jira/browse/MINIFI-117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15608778#comment-15608778
 ] 

ASF GitHub Bot commented on MINIFI-117:
---------------------------------------

Github user brosander commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi/pull/45#discussion_r85150335
  
    --- Diff: 
minifi-toolkit/minifi-toolkit-configuration/src/main/java/org/apache/nifi/minifi/toolkit/configuration/ConfigMain.java
 ---
    @@ -235,62 +252,127 @@ private static void 
addRemoteProcessGroupPortDTOs(Map<String, String> connectabl
             }
         }
     
    +    public int upgrade(String[] args) {
    +        if (args.length != 3) {
    +            printUgradeUsage();
    +            return ERR_INVALID_ARGS;
    +        }
    +
    +        ConfigSchema configSchema = null;
    +        try (InputStream inputStream = 
pathInputStreamFactory.create(args[1])) {
    +            try {
    +                configSchema = 
SchemaLoader.loadConfigSchemaFromYaml(inputStream);
    +            } catch (IOException|SchemaLoaderException e) {
    +                return handleErrorLoadingConfiguration(e, 
ConfigMain::printUgradeUsage);
    +            }
    +        } catch (FileNotFoundException e) {
    +            return handleErrorOpeningInput(args[1], 
ConfigMain::printUgradeUsage, e);
    +        } catch (IOException e) {
    +            handleErrorClosingInput(e);
    +        }
    +
    +        try (OutputStream fileOutputStream = 
pathOutputStreamFactory.create(args[2])) {
    +            try {
    +                SchemaSaver.saveConfigSchema(configSchema, 
fileOutputStream);
    +            } catch (IOException e) {
    +                return handleErrorSavingCofiguration(e);
    +            }
    +        } catch (FileNotFoundException e) {
    +            return handleErrorOpeningOutput(args[2], 
ConfigMain::printUgradeUsage, e);
    +        } catch (IOException e) {
    +            handleErrorClosingOutput(e);
    +        }
    +
    +        return SUCCESS;
    --- End diff --
    
    Good point, adding


> Maintainable Configuration Versioning
> -------------------------------------
>
>                 Key: MINIFI-117
>                 URL: https://issues.apache.org/jira/browse/MINIFI-117
>             Project: Apache NiFi MiNiFi
>          Issue Type: Bug
>            Reporter: Bryan Rosander
>            Assignee: Bryan Rosander
>
> In order to avoid a tangled web of if/else statements around every possible 
> permutation of config.yml and an equally complicated validation routine, we 
> need to utilize a versioning strategy that allows for specific parsing and 
> validation code for each version of the ConfigSchema.
> This will allow us to determine if a schema will be compatible with an older 
> MiNiFi instance more easily by validating the structure of the file at a 
> given version while still supporting an upconvert on read to the latest 
> ConfigSchema while parsing at runtime.
> It should also facilitate a deprecation strategy of removing older versions' 
> classes without needing to touch current implementation



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to