[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69371933 --- 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 MapcommandMap; +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
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69352051 --- Diff: minifi-toolkit/minifi-toolkit-configuration/src/test/resources/Splunk_Processors_with_Listen_TCP.xml --- @@ -0,0 +1,18 @@ + + +Splunk Processors with Listen TCP420ccabf-c795-4a5f-a502-3deead673de3f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f699882610d65054-5258-4cc4-9589-bd1185b07f85PROCESSOR0 sec1failuref1bee4e8-470b-41b7-97af-ada9f69988260ac7aebc-7692-4f37-804d-a7f03d2ddd1bPROCESSOR0b171f7c1-c640-4d17-8a4a-9cee8a0c49a6f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f69988260ac7aebc-7692-4f37-804d-a7f03d2ddd1bPROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f69988266c7f545e-c272-4f45-893e-0838b75d744ePROCESSOR00c10de1c-4917-4bb7-94e3-d346d3a736c2f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f6998826889f8d28-f936-457a-addb-c49ef7eed23bPROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f699882641eb952d-e8c8-4d9d-85a7-0aabb542ec56PROCESSOR0c6000652-74be-4bf8-b01f-7fcb1dd0b48cf1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f69988269fafd271-dcbd-4a6c-9625-29f28259fa4aPROCESSOR0 sec1failuref1bee4e8-470b-41b7-97af-ada9f6998826ff3b49ee-8535-4084-82e2-3aa22a10629dPROCESSOR0c6529f3f-b4f5-49cb-9a7a-93b9e52c71 faf1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f69988266c7f545e-c272-4f45-893e-0838b75d744ePROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f69988268bae21ad-6c89-4c01-9e71-b26340c50052PROCESSOR0fdbe0740-4be6-4712-917a-77613bb6089af1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f6998826ff3b49ee-8535 -4084-82e2-3aa22a10629dPROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f699882673212a32-1340-4423-a302-a884df0231b4PROCESSOR067557f37-c2f5-42b0-b2de-e7660ebc8145f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f699882678471344-9f3d-4eb5-94f9-e25ee9a35f79PROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f6998826ed0fa412-fe42-47 7c-b799-eb3270287221PROCESSOR080944451-d3b5-45d8-a23d-ab214f6420b4f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f6998826792bf873-97f4-4af1-8aa9-0534e79da810PROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f69988262ddc92dd-5f5b-4b3e-911d-d0aac1823b71PROCESSOR0871f7215-56c4-4733-927c-00236e82486eKeystore FilenameThe fully-qualified filename of the Keystore Keystore FilenamefalseKeystore FilenamefalsefalsefalseKeystore PasswordThe password for the KeystoreKeystore PasswordfalseKeystore PasswordfalsetruefalseKeystore TypeJKSJKSPKCS12PKCS12The Type of the KeystoreKeystore TypefalseKeystore TypefalsefalsefalseTruststore FilenameThe fully-qualified filename of the TruststoreTruststore FilenamefalseTruststore FilenamefalsefalsefalseTruststore PasswordThe password for the TruststoreTruststore PasswordfalseTruststore PasswordfalsetruefalseTruststore TypeJKSJKSPKCS12PKCS12The Type of the Truststore. Either JKS or PKCS12Truststore TypefalseTruststore TypefalsefalsefalseSSL ProtocolSSLSSLSSLv2HelloSSLv2HelloSSLv3SSLv3TLSTLSTLSv1TLSv1TLSv1.1TLSv1.1TLSv1.2TLSv1.2TLSThe algorithm to use for this SSL contextSSL ProtocolfalseSSL ProtocolfalsefalsefalseStandardSSLContextServiceKeystore Filename/home/osboxes/Dev/certs/distro-1.p12Keystore PasswordKeystore TypePKCS12Truststore Filename/home/osboxes/Dev/certs/truststore.jksTruststore PasswordTruststore TypeJKSSSL ProtocolTLS0PortThe port to listen on for communication.PortfalsePorttruefalsefalseReceive Buffer Size65507 BThe size of eac h buffer used to receive messages. Adjust this value appropriately based on the expected size of the incoming messages.Receive Buffer SizefalseReceive Buffer SizetruefalsefalseMax Size of Message Queue1The maximum size of the internal queue used to buffer messages being transferred from the underlying channel to the processor. Setting this value higher allows more messages to be buffered in memory during surges of incoming messages, but increases the total memory used by the processor.Max Size of Message QueuefalseMax Size of Message QueuetruefalsefalseMax Size of Socket Buffer< defaultValue>1 MBThe maximum size of the socket buffer that should be used. This is a suggestion to the Operating System to indicate how big the socket buffer should be. If this value is set too low, the buffer may fill up before the data can be read, and incoming data will be dropped.Max Size of Socket BufferfalseMax Size of Socket BuffertruefalsefalseCharacter SetUTF-8Specifies the character set of the received data.Character SetfalseCharacter SettruefalsefalseMax Number of TCP Connections2The maximum number of concurrent TCP connections to accept.Max Number of TCP ConnectionsfalseMax Number of TCP ConnectionstruefalsefalseMax Batch Size1The maximum number of messages to add to a single
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user brosander commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69346935 --- Diff: minifi-toolkit/minifi-toolkit-configuration/src/test/resources/Splunk_Processors_with_Listen_TCP.xml --- @@ -0,0 +1,18 @@ + + +Splunk Processors with Listen TCP420ccabf-c795-4a5f-a502-3deead673de3f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f699882610d65054-5258-4cc4-9589-bd1185b07f85PROCESSOR0 sec1failuref1bee4e8-470b-41b7-97af-ada9f69988260ac7aebc-7692-4f37-804d-a7f03d2ddd1bPROCESSOR0b171f7c1-c640-4d17-8a4a-9cee8a0c49a6f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f69988260ac7aebc-7692-4f37-804d-a7f03d2ddd1bPROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f69988266c7f545e-c272-4f45-893e-0838b75d744ePROCESSOR00c10de1c-4917-4bb7-94e3-d346d3a736c2f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f6998826889f8d28-f936-457a-addb-c49ef7eed23bPROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f699882641eb952d-e8c8-4d9d-85a7-0aabb542ec56PROCESSOR0c6000652-74be-4bf8-b01f-7fcb1dd0b48cf1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f69988269fafd271-dcbd-4a6c-9625-29f28259fa4aPROCESSOR0 sec1failuref1bee4e8-470b-41b7-97af-ada9f6998826ff3b49ee-8535-4084-82e2-3aa22a10629dPROCESSOR0c6529f3f-b4f5-49cb-9a7a-93b9e52c71 faf1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f69988266c7f545e-c272-4f45-893e-0838b75d744ePROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f69988268bae21ad-6c89-4c01-9e71-b26340c50052PROCESSOR0fdbe0740-4be6-4712-917a-77613bb6089af1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f6998826ff3b49ee-8535 -4084-82e2-3aa22a10629dPROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f699882673212a32-1340-4423-a302-a884df0231b4PROCESSOR067557f37-c2f5-42b0-b2de-e7660ebc8145f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f699882678471344-9f3d-4eb5-94f9-e25ee9a35f79PROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f6998826ed0fa412-fe42-47 7c-b799-eb3270287221PROCESSOR080944451-d3b5-45d8-a23d-ab214f6420b4f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f6998826792bf873-97f4-4af1-8aa9-0534e79da810PROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f69988262ddc92dd-5f5b-4b3e-911d-d0aac1823b71PROCESSOR0871f7215-56c4-4733-927c-00236e82486eKeystore FilenameThe fully-qualified filename of the Keystore Keystore FilenamefalseKeystore FilenamefalsefalsefalseKeystore PasswordThe password for the KeystoreKeystore PasswordfalseKeystore PasswordfalsetruefalseKeystore TypeJKSJKSPKCS12PKCS12The Type of the KeystoreKeystore TypefalseKeystore TypefalsefalsefalseTruststore FilenameThe fully-qualified filename of the TruststoreTruststore FilenamefalseTruststore FilenamefalsefalsefalseTruststore PasswordThe password for the TruststoreTruststore PasswordfalseTruststore PasswordfalsetruefalseTruststore TypeJKSJKSPKCS12PKCS12The Type of the Truststore. Either JKS or PKCS12Truststore TypefalseTruststore TypefalsefalsefalseSSL ProtocolSSLSSLSSLv2HelloSSLv2HelloSSLv3SSLv3TLSTLSTLSv1TLSv1TLSv1.1TLSv1.1TLSv1.2TLSv1.2TLSThe algorithm to use for this SSL contextSSL ProtocolfalseSSL ProtocolfalsefalsefalseStandardSSLContextServiceKeystore Filename/home/osboxes/Dev/certs/distro-1.p12Keystore PasswordKeystore TypePKCS12Truststore Filename/home/osboxes/Dev/certs/truststore.jksTruststore PasswordTruststore TypeJKSSSL ProtocolTLS0PortThe port to listen on for communication.PortfalsePorttruefalsefalseReceive Buffer Size65507 BThe size of eac h buffer used to receive messages. Adjust this value appropriately based on the expected size of the incoming messages.Receive Buffer SizefalseReceive Buffer SizetruefalsefalseMax Size of Message Queue1The maximum size of the internal queue used to buffer messages being transferred from the underlying channel to the processor. Setting this value higher allows more messages to be buffered in memory during surges of incoming messages, but increases the total memory used by the processor.Max Size of Message QueuefalseMax Size of Message QueuetruefalsefalseMax Size of Socket Buffer< defaultValue>1 MBThe maximum size of the socket buffer that should be used. This is a suggestion to the Operating System to indicate how big the socket buffer should be. If this value is set too low, the buffer may fill up before the data can be read, and incoming data will be dropped.Max Size of Socket BufferfalseMax Size of Socket BuffertruefalsefalseCharacter SetUTF-8Specifies the character set of the received data.Character SetfalseCharacter SettruefalsefalseMax Number of TCP Connections2The maximum number of concurrent TCP connections to accept.Max Number of TCP ConnectionsfalseMax Number of TCP ConnectionstruefalsefalseMax Batch Size1The maximum number of messages to add to a single
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69342080 --- Diff: minifi-toolkit/minifi-toolkit-configuration/src/test/resources/Splunk_Processors_with_Listen_TCP.xml --- @@ -0,0 +1,18 @@ + + +Splunk Processors with Listen TCP420ccabf-c795-4a5f-a502-3deead673de3f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f699882610d65054-5258-4cc4-9589-bd1185b07f85PROCESSOR0 sec1failuref1bee4e8-470b-41b7-97af-ada9f69988260ac7aebc-7692-4f37-804d-a7f03d2ddd1bPROCESSOR0b171f7c1-c640-4d17-8a4a-9cee8a0c49a6f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f69988260ac7aebc-7692-4f37-804d-a7f03d2ddd1bPROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f69988266c7f545e-c272-4f45-893e-0838b75d744ePROCESSOR00c10de1c-4917-4bb7-94e3-d346d3a736c2f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f6998826889f8d28-f936-457a-addb-c49ef7eed23bPROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f699882641eb952d-e8c8-4d9d-85a7-0aabb542ec56PROCESSOR0c6000652-74be-4bf8-b01f-7fcb1dd0b48cf1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f69988269fafd271-dcbd-4a6c-9625-29f28259fa4aPROCESSOR0 sec1failuref1bee4e8-470b-41b7-97af-ada9f6998826ff3b49ee-8535-4084-82e2-3aa22a10629dPROCESSOR0c6529f3f-b4f5-49cb-9a7a-93b9e52c71 faf1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f69988266c7f545e-c272-4f45-893e-0838b75d744ePROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f69988268bae21ad-6c89-4c01-9e71-b26340c50052PROCESSOR0fdbe0740-4be6-4712-917a-77613bb6089af1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f6998826ff3b49ee-8535 -4084-82e2-3aa22a10629dPROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f699882673212a32-1340-4423-a302-a884df0231b4PROCESSOR067557f37-c2f5-42b0-b2de-e7660ebc8145f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f699882678471344-9f3d-4eb5-94f9-e25ee9a35f79PROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f6998826ed0fa412-fe42-47 7c-b799-eb3270287221PROCESSOR080944451-d3b5-45d8-a23d-ab214f6420b4f1bee4e8-470b-41b7-97af-ada9f69988260 MB0f1bee4e8-470b-41b7-97af-ada9f6998826792bf873-97f4-4af1-8aa9-0534e79da810PROCESSOR0 sec1successf1bee4e8-470b-41b7-97af-ada9f69988262ddc92dd-5f5b-4b3e-911d-d0aac1823b71PROCESSOR0871f7215-56c4-4733-927c-00236e82486eKeystore FilenameThe fully-qualified filename of the Keystore Keystore FilenamefalseKeystore FilenamefalsefalsefalseKeystore PasswordThe password for the KeystoreKeystore PasswordfalseKeystore PasswordfalsetruefalseKeystore TypeJKSJKSPKCS12PKCS12The Type of the KeystoreKeystore TypefalseKeystore TypefalsefalsefalseTruststore FilenameThe fully-qualified filename of the TruststoreTruststore FilenamefalseTruststore FilenamefalsefalsefalseTruststore PasswordThe password for the TruststoreTruststore PasswordfalseTruststore PasswordfalsetruefalseTruststore TypeJKSJKSPKCS12PKCS12The Type of the Truststore. Either JKS or PKCS12Truststore TypefalseTruststore TypefalsefalsefalseSSL ProtocolSSLSSLSSLv2HelloSSLv2HelloSSLv3SSLv3TLSTLSTLSv1TLSv1TLSv1.1TLSv1.1TLSv1.2TLSv1.2TLSThe algorithm to use for this SSL contextSSL ProtocolfalseSSL ProtocolfalsefalsefalseStandardSSLContextServiceKeystore Filename/home/osboxes/Dev/certs/distro-1.p12Keystore PasswordKeystore TypePKCS12Truststore Filename/home/osboxes/Dev/certs/truststore.jksTruststore PasswordTruststore TypeJKSSSL ProtocolTLS0PortThe port to listen on for communication.PortfalsePorttruefalsefalseReceive Buffer Size65507 BThe size of eac h buffer used to receive messages. Adjust this value appropriately based on the expected size of the incoming messages.Receive Buffer SizefalseReceive Buffer SizetruefalsefalseMax Size of Message Queue1The maximum size of the internal queue used to buffer messages being transferred from the underlying channel to the processor. Setting this value higher allows more messages to be buffered in memory during surges of incoming messages, but increases the total memory used by the processor.Max Size of Message QueuefalseMax Size of Message QueuetruefalsefalseMax Size of Socket Buffer< defaultValue>1 MBThe maximum size of the socket buffer that should be used. This is a suggestion to the Operating System to indicate how big the socket buffer should be. If this value is set too low, the buffer may fill up before the data can be read, and incoming data will be dropped.Max Size of Socket BufferfalseMax Size of Socket BuffertruefalsefalseCharacter SetUTF-8Specifies the character set of the received data.Character SetfalseCharacter SettruefalsefalseMax Number of TCP Connections2The maximum number of concurrent TCP connections to accept.Max Number of TCP ConnectionsfalseMax Number of TCP ConnectionstruefalsefalseMax Batch Size1The maximum number of messages to add to a single
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69218372 --- Diff: minifi-commons/minifi-commons-schema/pom.xml --- @@ -0,0 +1,46 @@ + + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> +4.0.0 + +org.apache.nifi.minifi +minifi-commons +0.0.1-SNAPSHOT + + +minifi-commons-schema +jar + + + +org.yaml +snakeyaml +1.17 + + +org.apache.nifi +nifi-framework-core +0.6.0 + + --- End diff -- (Accidentally commented on the wrong pom originally) This should probably be removed from this pom too since it will be used in both assemblies. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69214705 --- Diff: minifi-toolkit/minifi-toolkit-configuration/pom.xml --- @@ -0,0 +1,42 @@ + + +http://maven.apache.org/POM/4.0.0; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> +4.0.0 + +minifi-toolkit +org.apache.nifi.minifi +0.0.1-SNAPSHOT + +minifi-toolkit-configuration +jar + + + +org.apache.nifi.minifi +minifi-commons-schema +${project.version} + + +org.apache.nifi +nifi-framework-core +0.6.0 --- End diff -- This should be added to the Dependency Management portion of the root pom so that it shares the nifi version set there. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69210176 --- Diff: minifi-toolkit/minifi-toolkit-assembly/src/main/resources/config.sh --- @@ -0,0 +1,133 @@ +#!/bin/sh +# +#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. +# +# chkconfig: 2345 20 80 +# description: Apache NiFi - MiNiFi +# + +# Script structure inspired from Apache Karaf and other Apache projects with similar startup approaches + +SCRIPT_DIR=$(dirname "$0") +SCRIPT_NAME=$(basename "$0") +MINIFI_TOOLKIT_HOME=$(cd "${SCRIPT_DIR}" && cd .. && pwd) +PROGNAME=$(basename "$0") + + +warn() { +echo "${PROGNAME}: $*" +} + +die() { +warn "$*" +exit 1 +} + +detectOS() { +# OS specific support (must be 'true' or 'false'). +cygwin=false; +aix=false; +os400=false; +darwin=false; +case "$(uname)" in +CYGWIN*) +cygwin=true +;; +AIX*) +aix=true +;; +OS400*) +os400=true +;; +Darwin) +darwin=true +;; +esac +# For AIX, set an environment variable +if ${aix}; then + export LDR_CNTRL=MAXDATA=0xB000@DSA + echo ${LDR_CNTRL} +fi +} + +locateJava() { +# Setup the Java Virtual Machine +if $cygwin ; then +[ -n "${JAVA}" ] && JAVA=$(cygpath --unix "${JAVA}") +[ -n "${JAVA_HOME}" ] && JAVA_HOME=$(cygpath --unix "${JAVA_HOME}") +fi + +if [ "x${JAVA}" = "x" ] && [ -r /etc/gentoo-release ] ; then +JAVA_HOME=$(java-config --jre-home) +fi +if [ "x${JAVA}" = "x" ]; then +if [ "x${JAVA_HOME}" != "x" ]; then +if [ ! -d "${JAVA_HOME}" ]; then +die "JAVA_HOME is not valid: ${JAVA_HOME}" +fi +JAVA="${JAVA_HOME}/bin/java" +else +warn "JAVA_HOME not set; results may vary" +JAVA=$(type java) +JAVA=$(expr "${JAVA}" : '.* \(/.*\)$') +if [ "x${JAVA}" = "x" ]; then +die "java command not found" +fi +fi +fi +# if command is env, attempt to add more to the classpath +if [ "$1" = "env" ]; then +[ "x${TOOLS_JAR}" = "x" ] && [ -n "${JAVA_HOME}" ] && TOOLS_JAR=$(find -H "${JAVA_HOME}" -name "tools.jar") +[ "x${TOOLS_JAR}" = "x" ] && [ -n "${JAVA_HOME}" ] && TOOLS_JAR=$(find -H "${JAVA_HOME}" -name "classes.jar") +if [ "x${TOOLS_JAR}" = "x" ]; then + warn "Could not locate tools.jar or classes.jar. Please set manually to avail all command features." +fi +fi --- End diff -- Is this block left over from the minifi.sh? I tried running it and got this: Joseph-Percivall:bin jpercivall$ ./config.sh env Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home MiNiFi Toolkit home: /Users/jpercivall/projects/edge/nifi-minifi/minifi-toolkit/minifi-toolkit-assembly/target/minifi-0.0.1-SNAPSHOT-bin/minifi-toolkit-0.0.1-SNAPSHOT Usage: java org.apache.nifi.minifi.toolkit.configuration.ConfigMain options Valid commands include: transform: Transform template xml into MiNiFi config YAML validate: Validate config YAML --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user brosander commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69183488 --- Diff: minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/BaseSchema.java --- @@ -15,13 +15,17 @@ * limitations under the License. */ -package org.apache.nifi.minifi.bootstrap.util.schema.common; +package org.apache.nifi.minifi.commons.schema; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import java.util.Collections; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; public class BaseSchema { --- End diff -- Using map supplier to instantiate maps, toMap() is static now, as well as the helper methods that don't need the state of the schema to do their job. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69180850 --- Diff: minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/BaseSchema.java --- @@ -15,13 +15,17 @@ * limitations under the License. */ -package org.apache.nifi.minifi.bootstrap.util.schema.common; +package org.apache.nifi.minifi.commons.schema; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import java.util.Collections; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; public class BaseSchema { --- End diff -- Ah very true, ok I'm on board with not making them static. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69178841 --- Diff: minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/BaseSchema.java --- @@ -15,13 +15,17 @@ * limitations under the License. */ -package org.apache.nifi.minifi.bootstrap.util.schema.common; +package org.apache.nifi.minifi.commons.schema; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import java.util.Collections; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; public class BaseSchema { --- End diff -- Right the "Validation Issue helper methods" access the validation issues, which is something every schema will have, so it's good to keep them implemented how they are. The "Value Access/Interpretation helper methods" are all methods that do not necessarily rely on the internal representation of each schema but instead are helper methods for accessing/interpreting values. So they can be static. For toMap I agree that it's good to encourage the use of LinkedHashMap. Maybe a protected method getMap for the schemas to use. Then toMap would be abstract. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user brosander commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69177842 --- Diff: minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/BaseSchema.java --- @@ -15,13 +15,17 @@ * limitations under the License. */ -package org.apache.nifi.minifi.bootstrap.util.schema.common; +package org.apache.nifi.minifi.commons.schema; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import java.util.Collections; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; public class BaseSchema { --- End diff -- So those helper methods do access the internal state (validation issues). I can tweak them to take that as an argument but it seems like leaving them as instance methods makes sense for now. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user brosander commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69166911 --- Diff: minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/BaseSchema.java --- @@ -15,13 +15,17 @@ * limitations under the License. */ -package org.apache.nifi.minifi.bootstrap.util.schema.common; +package org.apache.nifi.minifi.commons.schema; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import java.util.Collections; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; public class BaseSchema { --- End diff -- So I agree that the toMap method is a little light atm, the one thing I liked about defining it in the superclass was to centralize the decision to use a LinkedHashMap (to preserve insertion order and allow YAML to have attributes in the desired order). I figured that it was possible we would want to add common attributes at the top level at some point in which case that would be a good place for it. In terms of the helper methods, I don't have a problem with making them static. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user brosander commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69165446 --- Diff: minifi-toolkit/minifi-toolkit-assembly/NOTICE --- @@ -0,0 +1,21 @@ +Apache NiFi +Copyright 2014-2016 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +=== +Apache Software License v2 +=== + +The following binary components are provided under the Apache Software License v2 + + (ASLv2) Apache NiFi +The following NOTICE information applies: + Apache NiFi + Copyright 2014-2016 The Apache Software Foundation + + (ASLv2) Jetty +The following NOTICE information applies: + Jetty Web Container --- End diff -- Nope, removing --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user brosander commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69164484 --- Diff: minifi-commons/minifi-commons-schema/pom.xml --- @@ -0,0 +1,46 @@ + + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> +4.0.0 + +org.apache.nifi.minifi +minifi-commons +0.0.1-SNAPSHOT + + +minifi-commons-schema +jar + + + +org.yaml +snakeyaml +1.17 + + +org.apache.nifi +nifi-framework-core +0.6.0 + + --- End diff -- Good point, removed --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69162642 --- Diff: minifi-toolkit/minifi-toolkit-assembly/NOTICE --- @@ -0,0 +1,21 @@ +Apache NiFi +Copyright 2014-2016 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +=== +Apache Software License v2 +=== + +The following binary components are provided under the Apache Software License v2 + + (ASLv2) Apache NiFi +The following NOTICE information applies: + Apache NiFi + Copyright 2014-2016 The Apache Software Foundation + + (ASLv2) Jetty +The following NOTICE information applies: + Jetty Web Container --- End diff -- Is Jetty packaged in the toolkit-assembly? --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nifi-minifi pull request #21: MINIFI-41 - CLI utility for template.xml -> YA...
Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/21#discussion_r69159093 --- Diff: minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/SchemaLoader.java --- @@ -0,0 +1,52 @@ +/* + * 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.commons.schema; + +import org.apache.nifi.minifi.commons.schema.exception.SchemaLoaderException; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.error.YAMLException; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +public class SchemaLoader { +public static MaploadYamlAsMap(InputStream sourceStream) throws IOException, SchemaLoaderException { +try { +Yaml yaml = new Yaml(); + +// Parse the YAML file +final Object loadedObject = yaml.load(sourceStream); + +// Verify the parsed object is a Map structure +if (loadedObject instanceof Map) { +return (Map ) loadedObject; +} else { +throw new SchemaLoaderException("Provided YAML configuration is not a Map"); +} +} catch (YAMLException e ) { +throw new IOException(e); +} finally { +sourceStream.close(); +} +} + +public static ConfigSchema loadConfigSchema(InputStream sourceStream) throws IOException, SchemaLoaderException { --- End diff -- Since this is just a wrapper around loadYamlAsMap and has the requirement that the input is Yaml, I'd prefer to have "Yaml" in somewhere in the method name. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---