nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JPercivall <...@git.apache.org>
Subject [GitHub] nifi-minifi pull request: MINIFI-15 Created a config file format w...
Date Fri, 15 Apr 2016 22:35:55 GMT
Github user JPercivall commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi/pull/8#discussion_r59950579
  
    --- Diff: minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/util/ConfigTransformer.java
---
    @@ -0,0 +1,566 @@
    +/*
    + * 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.bootstrap.util;
    +
    +
    +import org.apache.nifi.controller.FlowSerializationException;
    +import org.w3c.dom.DOMException;
    +import org.w3c.dom.Document;
    +import org.w3c.dom.Element;
    +import org.yaml.snakeyaml.Yaml;
    +
    +import javax.xml.parsers.DocumentBuilder;
    +import javax.xml.parsers.DocumentBuilderFactory;
    +import javax.xml.parsers.ParserConfigurationException;
    +import javax.xml.transform.OutputKeys;
    +import javax.xml.transform.Transformer;
    +import javax.xml.transform.TransformerException;
    +import javax.xml.transform.TransformerFactory;
    +import javax.xml.transform.TransformerFactoryConfigurationError;
    +import javax.xml.transform.dom.DOMSource;
    +import javax.xml.transform.stream.StreamResult;
    +import java.io.File;
    +import java.io.FileInputStream;
    +import java.io.FileNotFoundException;
    +import java.io.InputStream;
    +import java.io.OutputStream;
    +import java.io.PrintWriter;
    +import java.io.UnsupportedEncodingException;
    +import java.nio.file.Files;
    +import java.nio.file.Paths;
    +import java.util.Collection;
    +import java.util.HashMap;
    +import java.util.Map;
    +import java.util.zip.GZIPOutputStream;
    +
    +public final class ConfigTransformer {
    +    // Underlying version NIFI POC will be using
    +    public static final String NIFI_VERSION = "0.6.0";
    +
    +    public static final String NAME_KEY = "name";
    +    public static final String COMMENT_KEY = "comment";
    +    public static final String ALWAYS_SYNC_KEY = "always sync";
    +    public static final String YIELD_PERIOD_KEY = "yield period";
    +    public static final String MAX_CONCURRENT_TASKS_KEY = "max concurrent tasks";
    +    public static final String ID_KEY = "id";
    +
    +    public static final String FLOW_CONTROLLER_PROPS_KEY = "Flow Controller";
    +
    +    public static final String CORE_PROPS_KEY = "Core Properties";
    +    public static final String FLOW_CONTROLLER_SHUTDOWN_PERIOD_KEY = "flow controller
graceful shutdown period";
    +    public static final String FLOW_SERVICE_WRITE_DELAY_INTERVAL_KEY = "flow service
write delay interval";
    +    public static final String ADMINISTRATIVE_YIELD_DURATION_KEY = "administrative yield
duration";
    +    public static final String BORED_YIELD_DURATION_KEY = "bored yield duration";
    +
    +    public static final String FLOWFILE_REPO_KEY = "FlowFile Repository";
    +    public static final String PARTITIONS_KEY = "partitions";
    +    public static final String CHECKPOINT_INTERVAL_KEY = "checkpoint interval";
    +    public static final String THRESHOLD_KEY = "queue swap threshold";
    +    public static final String SWAP_PROPS_KEY = "Swap";
    +    public static final String IN_PERIOD_KEY = "in period";
    +    public static final String IN_THREADS_KEY = "in threads";
    +    public static final String OUT_PERIOD_KEY = "out period";
    +    public static final String OUT_THREADS_KEY = "out threads";
    +
    +
    +    public static final String CONTENT_REPO_KEY = "Content Repository";
    +    public static final String CONTENT_CLAIM_MAX_APPENDABLE_SIZE_KEY = "content claim
max appendable size";
    +    public static final String CONTENT_CLAIM_MAX_FLOW_FILES_KEY = "content claim max
flow files";
    +
    +    public static final String COMPONENT_STATUS_REPO_KEY = "Component Status Repository";
    +    public static final String BUFFER_SIZE_KEY = "buffer size";
    +    public static final String SNAPSHOT_FREQUENCY_KEY = "snapshot frequency";
    +
    +    public static final String SECURITY_PROPS_KEY = "Security Properties";
    +    public static final String KEYSTORE_KEY = "keystore";
    +    public static final String KEYSTORE_TYPE_KEY = "keystore type";
    +    public static final String KEYSTORE_PASSWORD_KEY = "keystore password";
    +    public static final String KEY_PASSWORD_KEY = "key password";
    +    public static final String TRUSTSTORE_KEY = "truststore";
    +    public static final String TRUSTSTORE_TYPE_KEY = "truststore type";
    +    public static final String TRUSTSTORE_PASSWORD_KEY = "truststore password";
    +    public static final String SENSITIVE_PROPS_KEY = "Sensitive Props";
    +    public static final String SENSITIVE_PROPS_KEY__KEY = "key";
    +    public static final String SENSITIVE_PROPS_ALGORITHM_KEY = "algorithm";
    +    public static final String SENSITIVE_PROPS_PROVIDER_KEY = "provider";
    +
    +    public static final String PROCESSOR_CONFIG_KEY = "Processor Configuration";
    +    public static final String CLASS_KEY = "class";
    +    public static final String SCHEDULING_PERIOD_KEY = "scheduling period";
    +    public static final String PENALIZATION_PERIOD_KEY = "penalization period";
    +    public static final String SCHEDULING_STRATEGY_KEY = "scheduling strategy";
    +    public static final String RUN_DURATION_NANOS_KEY = "run duration nanos";
    +    public static final String AUTO_TERMINATED_RELATIONSHIPS_LIST_KEY = "auto-terminated
relationships list";
    +
    +    public static final String PROCESSOR_PROPS_KEY = "Properties";
    +
    +    public static final String CONNECTION_PROPS_KEY = "Connection Properties";
    +    public static final String MAX_WORK_QUEUE_SIZE_KEY = "max work queue size";
    +    public static final String MAX_WORK_QUEUE_DATA_SIZE_KEY = "max work queue data size";
    +    public static final String FLOWFILE_EXPIRATION__KEY = "flowfile expiration";
    +    public static final String QUEUE_PRIORITIZER_CLASS_KEY = "queue prioritizer class";
    +
    +    public static final String REMOTE_PROCESSING_GROUP_KEY = "Remote Processing Group";
    +    public static final String URL_KEY = "url";
    +    public static final String TIMEOUT_KEY = "timeout";
    +
    +    public static final String INPUT_PORT_KEY = "Input Port";
    +    public static final String USE_COMPRESSION_KEY = "use compression";
    +
    +    public static final String PROVENANCE_REPORTING_KEY = "Provenance Reporting";
    +    public static final String DESTINATION_URL_KEY = "destination url";
    +    public static final String PORT_NAME_KEY = "port name";
    +    public static final String ORIGINATING_URL_KEY = "originating url";
    +    public static final String BATCH_SIZE_KEY = "batch size";
    +
    +    public static final String SSL_PROTOCOL_KEY = "ssl protocol";
    +
    +    // Final util classes should have private constructor
    +    private ConfigTransformer() {}
    +
    +    public static void transformConfigFile(String sourceFile, String destPath) throws
Exception {
    +        Yaml yaml = new Yaml();
    +        File ymlConfigFile = new File(sourceFile);
    +        InputStream ios = new FileInputStream(ymlConfigFile);
    --- End diff --
    
    Good catch, I always forget to close my streams


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message