* 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.
@@ -31,14 +31,8 @@
import org.apache.tez.tools.javadoc.util.HtmlWriter;
import org.apache.tez.tools.javadoc.util.XmlWriter;
-import com.sun.javadoc.AnnotationDesc;
-import com.sun.javadoc.AnnotationDesc.ElementValuePair;
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.DocErrorReporter;
-import com.sun.javadoc.FieldDoc;
-import com.sun.javadoc.LanguageVersion;
-import com.sun.javadoc.RootDoc;
-import com.sun.tools.doclets.standard.Standard;
+import java.io.IOException;
+import java.util.Map;
public final class ConfigStandardDoclet {
@@ -194,40 +188,34 @@ private static void processDoc(ClassDoc doc) {
}
}
}
- }
- configProperty.description = field.commentText();
-
- }
+ HtmlWriter writer = new HtmlWriter();
+ try {
+ writer.write(config);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
- HtmlWriter writer = new HtmlWriter();
- try {
- writer.write(config);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
+ XmlWriter xmlWriter = new XmlWriter();
+ try {
+ xmlWriter.write(config);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
- XmlWriter xmlWriter = new XmlWriter();
- try {
- xmlWriter.write(config);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
+ private static String stripQuotes (String s){
+ if (s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"') {
+ return s.substring(1, s.length() - 1);
+ }
+ return s;
+ }
- }
+ public static int optionLength (String option){
+ return Standard.optionLength(option);
+ }
- private static String stripQuotes(String s) {
- if (s.charAt(0) == '"' && s.charAt(s.length()-1) == '"') {
- return s.substring(1, s.length()-1);
+ public static boolean validOptions (String options[][],DocErrorReporter reporter){
+ return true;
+ }
}
- return s;
- }
-
- public static int optionLength(String option) {
- return Standard.optionLength(option);
- }
-
- public static boolean validOptions(String options[][], DocErrorReporter reporter) {
- return true;
- }
-}
diff --git a/tez-tools/tez-javadoc-tools/src/main/java/org/apache/tez/tools/javadoc/model/Config.java b/tez-tools/tez-javadoc-tools-base-jdk8/src/main/java/org/apache/tez/tools/javadoc/model/Config.java
similarity index 69%
rename from tez-tools/tez-javadoc-tools/src/main/java/org/apache/tez/tools/javadoc/model/Config.java
rename to tez-tools/tez-javadoc-tools-base-jdk8/src/main/java/org/apache/tez/tools/javadoc/model/Config.java
index 604d48ac5e..d35dfd38e1 100644
--- a/tez-tools/tez-javadoc-tools/src/main/java/org/apache/tez/tools/javadoc/model/Config.java
+++ b/tez-tools/tez-javadoc-tools-base-jdk8/src/main/java/org/apache/tez/tools/javadoc/model/Config.java
@@ -23,18 +23,17 @@
public class Config {
- public final String templateName;
- public final String configName;
- public Map configProperties;
+ public final String templateName;
+ public final String configName;
+ public Map configProperties;
- public Config(String configName, String templateName) {
- this.configName = configName;
- this.templateName = templateName;
- this.configProperties = new TreeMap();
- }
-
- public Config() {
- this(null, null);
- }
+ public Config(String configName, String templateName) {
+ this.configName = configName;
+ this.templateName = templateName;
+ this.configProperties = new TreeMap();
+ }
+ public Config() {
+ this(null, null);
+ }
}
diff --git a/tez-tools/tez-javadoc-tools-base-jdk8/src/main/java/org/apache/tez/tools/javadoc/model/ConfigProperty.java b/tez-tools/tez-javadoc-tools-base-jdk8/src/main/java/org/apache/tez/tools/javadoc/model/ConfigProperty.java
new file mode 100644
index 0000000000..98ab8ae582
--- /dev/null
+++ b/tez-tools/tez-javadoc-tools-base-jdk8/src/main/java/org/apache/tez/tools/javadoc/model/ConfigProperty.java
@@ -0,0 +1,45 @@
+/**
+ * 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.tez.tools.javadoc.model;
+
+public class ConfigProperty {
+
+ public String propertyName;
+ public String defaultValue;
+ public String description;
+ public String type = "string";
+ public boolean isPrivate = false;
+ public boolean isUnstable = false;
+ public boolean isEvolving = false;
+ public boolean isValidConfigProp = false;
+ public String[] validValues;
+ public String inferredType;
+
+ @Override
+ public String toString() {
+ return "name=" + propertyName
+ + ", defaultValue=" + defaultValue
+ + ", description=" + description
+ + ", type=" + type
+ + ", inferredType=" + inferredType
+ + ", private=" + isPrivate
+ + ", validValues=" + (validValues == null ? "null" : validValues)
+ + ", isConfigProp=" + isValidConfigProp;
+ }
+}
diff --git a/tez-tools/tez-javadoc-tools-base-jdk8/src/main/java/org/apache/tez/tools/javadoc/util/HtmlWriter.java b/tez-tools/tez-javadoc-tools-base-jdk8/src/main/java/org/apache/tez/tools/javadoc/util/HtmlWriter.java
new file mode 100644
index 0000000000..f43a54b012
--- /dev/null
+++ b/tez-tools/tez-javadoc-tools-base-jdk8/src/main/java/org/apache/tez/tools/javadoc/util/HtmlWriter.java
@@ -0,0 +1,159 @@
+/**
+ * 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.tez.tools.javadoc.util;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+
+import org.apache.tez.dag.api.TezException;
+import org.apache.tez.tools.javadoc.model.Config;
+import org.apache.tez.tools.javadoc.model.ConfigProperty;
+
+public class HtmlWriter extends Writer {
+
+ private static final String DEFAULT_STYLESHEET = "default-stylesheet.css";
+
+ public void write(Config config) throws IOException {
+ PrintWriter out = null;
+
+ if (config.configName == null || config.configName.isEmpty()) {
+ throw new RuntimeException("Config Name is null or empty");
+ }
+
+ try {
+ File file = new File(config.configName + ".html");
+ out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
+
+ out.println("");
+ out.println("");
+
+ out.println("");
+
+ out.println("");
+ out.println("");
+ out.println("" + config.configName + "");
+// out.println("");
+ out.println("");
+
+ out.println("");
+
+ out.println("");
+
+ out.println("
");
+ // Re-enable after adding values
+ // out.println("
" + configProperty.validValues + "
");
+
+ out.println("
" + configProperty.isPrivate + "
");
+ out.println("
" + configProperty.isEvolving + "
");
+ out.println("
" + configProperty.isUnstable + "
");
+ out.println("
");
+ }
+
+ out.println("
");
+
+ out.println("
");
+ out.println("
");
+ out.println("");
+ out.println("");
+ } finally {
+ if (out != null) {
+ out.close();
+ }
+ }
+ }
+}
diff --git a/tez-tools/tez-javadoc-tools-base/src/main/java/org/apache/tez/tools/javadoc/util/Writer.java b/tez-tools/tez-javadoc-tools-base/src/main/java/org/apache/tez/tools/javadoc/util/Writer.java
new file mode 100644
index 0000000000..6b9bcf9b20
--- /dev/null
+++ b/tez-tools/tez-javadoc-tools-base/src/main/java/org/apache/tez/tools/javadoc/util/Writer.java
@@ -0,0 +1,39 @@
+/**
+ * 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.tez.tools.javadoc.util;
+
+import org.apache.tez.tools.javadoc.model.Config;
+import org.apache.tez.tools.javadoc.model.ConfigProperty;
+
+import java.io.IOException;
+
+public abstract class Writer {
+
+ public abstract void write(Config config) throws IOException;
+
+ public boolean isValidConfigProperty(ConfigProperty configProperty) {
+ if (!configProperty.isValidConfigProp) {
+ return false;
+ }
+ if (configProperty.propertyName == null || configProperty.propertyName.isEmpty()) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/tez-tools/tez-javadoc-tools-base/src/main/java/org/apache/tez/tools/javadoc/util/XmlWriter.java b/tez-tools/tez-javadoc-tools-base/src/main/java/org/apache/tez/tools/javadoc/util/XmlWriter.java
new file mode 100644
index 0000000000..a6b1c06e87
--- /dev/null
+++ b/tez-tools/tez-javadoc-tools-base/src/main/java/org/apache/tez/tools/javadoc/util/XmlWriter.java
@@ -0,0 +1,91 @@
+/**
+ * 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.tez.tools.javadoc.util;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.tez.tools.javadoc.model.Config;
+import org.apache.tez.tools.javadoc.model.ConfigProperty;
+
+import java.io.*;
+
+public class XmlWriter extends Writer {
+
+ public void write(Config config) throws IOException {
+ PrintWriter out = null;
+
+ if (config.configName == null || config.configName.isEmpty()) {
+ throw new RuntimeException("Config Name is null or empty");
+ }
+
+ String fileName = config.templateName == null ||
+ config.templateName.isEmpty() ? config.configName : config.templateName;
+ if (!fileName.endsWith(".xml")) {
+ fileName += ".xml";
+ }
+
+ try {
+ File file = new File(fileName);
+ out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
+
+ out.println("");
+ out.println("");
+ out.println();
+ out.println("");
+ out.println();
+ out.println("");
+
+ for (ConfigProperty configProperty : config.configProperties.values()) {
+ if (!isValidConfigProperty(configProperty)) {
+ continue;
+ }
+ out.println();
+ out.println(" ");
+ out.println(" " + configProperty.propertyName + "");
+ if (configProperty.defaultValue != null && !configProperty.defaultValue.isEmpty()) {
+ out.println(" " + configProperty.defaultValue + "");
+ }
+ if (configProperty.description != null && !configProperty.description.isEmpty()) {
+ out.println(" " + StringEscapeUtils.escapeXml(configProperty.description)
+ + "");
+ }
+ if (configProperty.type != null && !configProperty.type.isEmpty()) {
+ out.println(" " + configProperty.type + "");
+ }
+ if (configProperty.isUnstable) {
+ out.println(" true");
+ }
+ if (configProperty.isEvolving) {
+ out.println(" true");
+ }
+ if (configProperty.isPrivate) {
+ out.println(" true");
+ }
+ out.println(" ");
+ }
+
+ out.println();
+ out.println("");
+ } finally {
+ if (out != null) {
+ out.close();
+ }
+ }
+ }
+}
diff --git a/tez-tools/tez-javadoc-tools/pom.xml b/tez-tools/tez-javadoc-tools/pom.xml
index 8106872c34..e8a47359e1 100644
--- a/tez-tools/tez-javadoc-tools/pom.xml
+++ b/tez-tools/tez-javadoc-tools/pom.xml
@@ -78,6 +78,33 @@
+
+ jdk8-16
+
+ [8,16]
+
+
+
+ org.apache.tez
+ tez-javadoc-tools-base-jdk8
+ ${project.version}
+
+
+
+
+ jdk17plus
+
+
+ [17,)
+
+
+
+ org.apache.tez
+ tez-javadoc-tools-base
+ ${project.version}
+
+
+
diff --git a/tez-tools/tez-javadoc-tools/src/main/java/org/apache/tez/tools/javadoc/util/HtmlWriter.java b/tez-tools/tez-javadoc-tools/src/main/java/org/apache/tez/tools/javadoc/util/HtmlWriter.java
deleted file mode 100644
index 4b531e87e5..0000000000
--- a/tez-tools/tez-javadoc-tools/src/main/java/org/apache/tez/tools/javadoc/util/HtmlWriter.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- * 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.tez.tools.javadoc.util;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-
-import org.apache.tez.dag.api.TezException;
-import org.apache.tez.tools.javadoc.model.Config;
-import org.apache.tez.tools.javadoc.model.ConfigProperty;
-
-public class HtmlWriter extends Writer {
-
- private static final String DEFAULT_STYLESHEET = "default-stylesheet.css";
-
- public void write(Config config) throws IOException {
- PrintWriter out = null;
-
- if (config.configName == null || config.configName.isEmpty()) {
- throw new RuntimeException("Config Name is null or empty");
- }
-
- try {
- File file = new File(config.configName + ".html");
- out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
-
- out.println("");
- out.println("");
-
- out.println("");
-
- out.println("");
- out.println("");
- out.println(""+ config.configName +"");
-// out.println("");
- out.println("");
-
- out.println("");
-
- out.println("");
-
- out.println("