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

    https://github.com/apache/nifi-minifi/pull/21#discussion_r69603609
  
    --- Diff: 
minifi-toolkit/minifi-toolkit-configuration/src/main/java/org/apache/nifi/minifi/toolkit/configuration/ConfigMain.java
 ---
    @@ -0,0 +1,342 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.nifi.minifi.toolkit.configuration;
    +
    +import org.apache.nifi.controller.Template;
    +import org.apache.nifi.minifi.commons.schema.ConfigSchema;
    +import org.apache.nifi.minifi.commons.schema.SecurityPropertiesSchema;
    +import org.apache.nifi.minifi.commons.schema.common.BaseSchema;
    +import org.apache.nifi.minifi.commons.schema.serialization.SchemaLoader;
    +import org.apache.nifi.minifi.commons.schema.serialization.SchemaSaver;
    +import 
org.apache.nifi.minifi.commons.schema.exception.SchemaLoaderException;
    +import org.apache.nifi.ssl.StandardSSLContextService;
    +import org.apache.nifi.web.api.dto.ConnectableDTO;
    +import org.apache.nifi.web.api.dto.ConnectionDTO;
    +import org.apache.nifi.web.api.dto.ControllerServiceDTO;
    +import org.apache.nifi.web.api.dto.FlowSnippetDTO;
    +import org.apache.nifi.web.api.dto.NiFiComponentDTO;
    +import org.apache.nifi.web.api.dto.PortDTO;
    +import org.apache.nifi.web.api.dto.ProcessorDTO;
    +import org.apache.nifi.web.api.dto.RemoteProcessGroupContentsDTO;
    +import org.apache.nifi.web.api.dto.RemoteProcessGroupDTO;
    +import org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO;
    +import org.apache.nifi.web.api.dto.TemplateDTO;
    +
    +import javax.xml.bind.JAXBContext;
    +import javax.xml.bind.JAXBException;
    +import java.io.FileInputStream;
    +import java.io.FileNotFoundException;
    +import java.io.FileOutputStream;
    +import java.io.IOException;
    +import java.io.InputStream;
    +import java.io.OutputStream;
    +import java.util.ArrayList;
    +import java.util.Collection;
    +import java.util.HashMap;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.Set;
    +import java.util.TreeMap;
    +import java.util.function.Function;
    +import java.util.stream.Collectors;
    +
    +public class ConfigMain {
    +    public static final int ERR_INVALID_ARGS = 1;
    +    public static final int ERR_UNABLE_TO_OPEN_OUTPUT = 2;
    +    public static final int ERR_UNABLE_TO_OPEN_INPUT = 3;
    +    public static final int ERR_UNABLE_TO_READ_TEMPLATE = 4;
    +    public static final int ERR_UNABLE_TO_TRANFORM_TEMPLATE = 5;
    +    public static final int ERR_UNABLE_TO_PARSE_CONFIG = 6;
    +    public static final int ERR_INVALID_CONFIG = 7;
    +
    +    public static final int SUCCESS = 0;
    +
    +    public static final String TRANSFORM = "transform";
    +    public static final String VALIDATE = "validate";
    +
    +    private final Map<String, Command> commandMap;
    +    private final PathInputStreamFactory pathInputStreamFactory;
    +    private final PathOutputStreamFactory pathOutputStreamFactory;
    +
    +    public ConfigMain() {
    +        this(FileInputStream::new, FileOutputStream::new);
    +    }
    +
    +    public ConfigMain(PathInputStreamFactory pathInputStreamFactory, 
PathOutputStreamFactory pathOutputStreamFactory) {
    +        this.pathInputStreamFactory = pathInputStreamFactory;
    +        this.pathOutputStreamFactory = pathOutputStreamFactory;
    +        this.commandMap = createCommandMap();
    +    }
    +
    +    public static void main(String[] args) {
    +        System.exit(new ConfigMain().execute(args));
    +    }
    +
    +    public static void printValidateUsage() {
    +        System.out.println("Validate Usage:");
    +        System.out.println();
    +        System.out.print("java ");
    +        System.out.print(ConfigMain.class.getCanonicalName());
    +        System.out.println(" validate INPUT_FILE");
    +        System.out.println();
    +    }
    +
    +    public int validate(String[] args) {
    +        if (args.length != 2) {
    +            printValidateUsage();
    +            return ERR_INVALID_ARGS;
    +        }
    +        try (InputStream inputStream = 
pathInputStreamFactory.create(args[1])) {
    +            try {
    +                ConfigSchema configSchema = 
SchemaLoader.loadConfigSchemaFromYaml(inputStream);
    +                if (!configSchema.isValid()) {
    --- End diff --
    
    Unless if I'm missing something, I see a print statement confirmation for 
"transform" but I don't see one for "validate".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to