This is an automated email from the ASF dual-hosted git repository. elek pushed a commit to branch HDDS-1469 in repository https://gitbox.apache.org/repos/asf/hadoop.git
commit 4c7d7f47b76a3244448f6a52ae469d25f5a6f13c Author: Márton Elek <[email protected]> AuthorDate: Fri Apr 26 12:03:50 2019 +0200 address review comments --- .../hadoop/hdds/conf/SimpleConfiguration.java | 15 ++++++++----- .../java/org/apache/hadoop/hdds/conf/Config.java | 4 ++-- .../hadoop/hdds/conf/ConfigFileAppender.java | 4 ++-- .../hadoop/hdds/conf/ConfigFileGenerator.java | 3 +-- .../hadoop/hdds/conf/ConfigurationExample.java | 26 +++++++++++++--------- 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/SimpleConfiguration.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/SimpleConfiguration.java index cb87247..f18fd5e 100644 --- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/SimpleConfiguration.java +++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/SimpleConfiguration.java @@ -35,28 +35,33 @@ public class SimpleConfiguration { private long waitTime = 1; - @Config(key = "address", defaultValue = "localhost") + @Config(key = "address", defaultValue = "localhost", description = "Just " + + "for testing", tags = ConfigTag.MANAGEMENT) public void setClientAddress(String clientAddress) { this.clientAddress = clientAddress; } - @Config(key = "bind.host", defaultValue = "0.0.0.0") + @Config(key = "bind.host", defaultValue = "0.0.0.0", description = "Just " + + "for testing", tags = ConfigTag.MANAGEMENT) public void setBindHost(String bindHost) { this.bindHost = bindHost; } - @Config(key = "enabled", defaultValue = "true") + @Config(key = "enabled", defaultValue = "true", description = "Just for " + + "testing", tags = ConfigTag.MANAGEMENT) public void setEnabled(boolean enabled) { this.enabled = enabled; } - @Config(key = "port", defaultValue = "9878") + @Config(key = "port", defaultValue = "9878", description = "Just for " + + "testing", tags = ConfigTag.MANAGEMENT) public void setPort(int port) { this.port = port; } @Config(key = "wait", type = ConfigType.TIME, timeUnit = - TimeUnit.SECONDS, defaultValue = "10m") + TimeUnit.SECONDS, defaultValue = "10m", description = "Just for " + + "testing", tags = ConfigTag.MANAGEMENT) public void setWaitTime(long waitTime) { this.waitTime = waitTime; } diff --git a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/Config.java b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/Config.java index 15b60ad..70aa58d 100644 --- a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/Config.java +++ b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/Config.java @@ -43,7 +43,7 @@ public @interface Config { /** * Custom description as a help. */ - String description() default ""; + String description(); /** * Type of configuration. Use AUTO to decide it based on the java type. @@ -55,5 +55,5 @@ public @interface Config { */ TimeUnit timeUnit() default TimeUnit.MILLISECONDS; - ConfigTag[] tags() default {ConfigTag.OZONE}; + ConfigTag[] tags(); } diff --git a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileAppender.java b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileAppender.java index d88554a..9463f42 100644 --- a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileAppender.java +++ b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileAppender.java @@ -36,8 +36,8 @@ import org.w3c.dom.Element; /** * Simple DOM based config file writer. * <p> - * This class can init/load existing ozone-site.xml fragments and append - * new entries and write to the file system. + * This class can init/load existing ozone-default-generated.xml fragments + * and append new entries and write to the file system. */ public class ConfigFileAppender { diff --git a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileGenerator.java b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileGenerator.java index a6a5c9a..76cf1f2 100644 --- a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileGenerator.java +++ b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileGenerator.java @@ -37,7 +37,7 @@ import java.util.Set; /** * Annotation processor to generate ozone-site-generated fragments from - * ozone-site.xml. + * @Config annotations. */ @SupportedAnnotationTypes("org.apache.hadoop.hdds.conf.ConfigGroup") public class ConfigFileGenerator extends AbstractProcessor { @@ -52,7 +52,6 @@ public class ConfigFileGenerator extends AbstractProcessor { } Filer filer = processingEnv.getFiler(); - System.out.println("round"); try { diff --git a/hadoop-hdds/config/src/test/java/org/apache/hadoop/hdds/conf/ConfigurationExample.java b/hadoop-hdds/config/src/test/java/org/apache/hadoop/hdds/conf/ConfigurationExample.java index 8ef8191..2dd2669 100644 --- a/hadoop-hdds/config/src/test/java/org/apache/hadoop/hdds/conf/ConfigurationExample.java +++ b/hadoop-hdds/config/src/test/java/org/apache/hadoop/hdds/conf/ConfigurationExample.java @@ -29,34 +29,40 @@ public class ConfigurationExample { private String bindHost; - private boolean enabled; + private boolean compressionEnabled; private int port = 1234; private long waitTime = 1; - @Config(key = "address", defaultValue = "localhost") + @Config(key = "address", defaultValue = "localhost", description = "Client " + + "addres (To test string injection).", tags = ConfigTag.MANAGEMENT) public void setClientAddress(String clientAddress) { this.clientAddress = clientAddress; } - @Config(key = "bind.host", defaultValue = "0.0.0.0") + @Config(key = "bind.host", defaultValue = "0.0.0.0", description = "Bind " + + "host(To test string injection).", tags = ConfigTag.MANAGEMENT) public void setBindHost(String bindHost) { this.bindHost = bindHost; } - @Config(key = "enabled", defaultValue = "true") - public void setEnabled(boolean enabled) { - this.enabled = enabled; + @Config(key = "compression.enabled", defaultValue = "true", description = + "Compression enabled. (Just to test boolean flag)", tags = + ConfigTag.MANAGEMENT) + public void setCompressionEnabled(boolean compressionEnabled) { + this.compressionEnabled = compressionEnabled; } - @Config(key = "port", defaultValue = "1234") + @Config(key = "port", defaultValue = "1234", description = "Port number " + + "config (To test in injection)", tags = ConfigTag.MANAGEMENT) public void setPort(int port) { this.port = port; } @Config(key = "wait", type = ConfigType.TIME, timeUnit = - TimeUnit.SECONDS, defaultValue = "30m") + TimeUnit.SECONDS, defaultValue = "30m", description = "Wait time (To " + + "test TIME config type)", tags = ConfigTag.MANAGEMENT) public void setWaitTime(long waitTime) { this.waitTime = waitTime; } @@ -69,8 +75,8 @@ public class ConfigurationExample { return bindHost; } - public boolean isEnabled() { - return enabled; + public boolean isCompressionEnabled() { + return compressionEnabled; } public int getPort() { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
