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

    https://github.com/apache/nifi/pull/695#discussion_r72713616
  
    --- Diff: 
nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/TlsToolkitMain.java
 ---
    @@ -0,0 +1,121 @@
    +/*
    + * 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.toolkit.tls;
    +
    +import org.apache.nifi.toolkit.tls.commandLine.CommandLineParseException;
    +import org.apache.nifi.toolkit.tls.commandLine.TlsToolkitCommandLine;
    +import 
org.apache.nifi.toolkit.tls.configuration.TlsHostConfigurationBuilder;
    +import org.apache.nifi.toolkit.tls.properties.NiFiPropertiesWriterFactory;
    +import org.apache.nifi.toolkit.tls.util.TlsHelper;
    +import org.bouncycastle.openssl.jcajce.JcaMiscPEMGenerator;
    +import org.bouncycastle.operator.OperatorCreationException;
    +import org.bouncycastle.util.io.pem.PemWriter;
    +
    +import java.io.File;
    +import java.io.FileWriter;
    +import java.io.IOException;
    +import java.security.GeneralSecurityException;
    +import java.security.KeyPair;
    +import java.security.KeyStore;
    +import java.security.SecureRandom;
    +import java.security.cert.X509Certificate;
    +import java.util.List;
    +
    +import static 
org.apache.nifi.toolkit.tls.commandLine.TlsToolkitCommandLine.ERROR_GENERATING_CONFIG;
    +
    +/**
    + * Command line utility for generating a certificate authority and using 
it to issue certificates for all nifi nodes
    + */
    +public class TlsToolkitMain {
    +    public static final String NIFI_KEY = "nifi-key";
    +    public static final String NIFI_CERT = "nifi-cert";
    +    public static final String ROOT_CERT_PRIVATE_KEY = "rootCert.key";
    +    public static final String ROOT_CERT_CRT = "rootCert.crt";
    +    public static final String NIFI_PROPERTIES = "nifi.properties";
    +
    +    private final TlsHelper tlsHelper;
    +    private final File baseDir;
    +    private final NiFiPropertiesWriterFactory niFiPropertiesWriterFactory;
    +
    +    public TlsToolkitMain(TlsHelper tlsHelper, File baseDir, 
NiFiPropertiesWriterFactory niFiPropertiesWriterFactory) {
    +        this.tlsHelper = tlsHelper;
    +        this.baseDir = baseDir;
    +        this.niFiPropertiesWriterFactory = niFiPropertiesWriterFactory;
    +    }
    +
    +    public static void main(String[] args) {
    --- End diff --
    
    I believe this is being refactored to remove the tight coupling between 
`Main` and `CommandLine` -- i.e. the business logic will be in a class that can 
be invoked in a number of ways: other Java class instantiating the constructor, 
command line arguments being parsed and then passed, etc. This is inline with 
the client tool architecture. 


---
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.
---

Reply via email to