accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] mikewalch commented on a change in pull request #361: ACCUMULO-4784 - Create builder for Connector
Date Thu, 01 Jan 1970 00:00:00 GMT
mikewalch commented on a change in pull request #361: ACCUMULO-4784 - Create builder for Connector
URL: https://github.com/apache/accumulo/pull/361#discussion_r167098051
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/core/conf/ClientConfigGenerate.java
 ##########
 @@ -0,0 +1,193 @@
+/*
+ * 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.accumulo.core.conf;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import java.io.FileNotFoundException;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Objects;
+import java.util.Set;
+import java.util.TreeMap;
+
+import com.google.common.collect.Sets;
+
+/**
+ * Generates client-properties.md for documentation on Accumulo website and accumulo-client.properties
for Accumulo distribution tarball
+ */
+class ClientConfigGenerate {
+
+  private abstract class Format {
+
+    abstract void beginSection(String section);
+
+    abstract void pageHeader();
+
+    abstract void property(ClientProperty prop);
+
+    void generate() {
+      pageHeader();
+
+      generateSection("Instance", "instance.");
+      generateSection("Authentication", "auth.", "auth.method", "auth.username");
+      generateSection("Batch Writer", "batch.writer.");
+      generateSection("SSL", "ssl.");
+      generateSection("SASL", "sasl.");
+      generateSection("Tracing", "trace.");
+
+      doc.close();
+    }
+
+    void generateSection(String section, String prefix, String... prefixProps) {
+      beginSection(section);
+      for (String prop : prefixProps) {
+        ClientProperty cp = sortedProps.get(prop);
+        if (cp != null) {
+          property(cp);
+        }
+      }
+      Set<String> prefixSet = Sets.newHashSet(prefixProps);
+      for (ClientProperty prop : sortedProps.values()) {
+        if (prop.getKey().startsWith(prefix) && !prefixSet.contains(prop.getKey()))
{
+          property(prop);
+        }
+      }
+    }
+
+    void generateSection(String section, String prefix) {
+      generateSection(section, prefix, "");
+    }
+  }
+
+  private class Markdown extends Format {
+
+    @Override
+    void beginSection(String section) {}
+
+    @Override
+    void pageHeader() {
+      doc.println("---");
+      doc.println("title: Client Properties");
+      doc.println("category: development");
+      doc.println("order: 9");
+      doc.println("---\n");
+      doc.println("<!-- WARNING: Do not edit this file. It is a generated file that is
copied from Accumulo build (from core/target/generated-docs) -->\n");
 
 Review comment:
   Added in ce512a93bfa9

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message