You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/09/27 12:07:16 UTC
[camel] 12/16: CAMEL-13998 - code review (use isNotEmpty)
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 62a557b5b7d250f35364f85e233ea4ea6ea36f7e
Author: marius cornescu <ma...@yahoo.com>
AuthorDate: Mon Sep 23 15:37:51 2019 +0200
CAMEL-13998 - code review (use isNotEmpty)
---
.../apache/camel/component/hdfs/HdfsConfiguration.java | 15 ++++-----------
.../hdfs/springboot/HdfsComponentConfiguration.java | 15 +++++++++++++++
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
index d48161e..c938dfa 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
@@ -24,8 +24,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-import static java.util.Objects.nonNull;
-
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriParams;
@@ -33,6 +31,8 @@ import org.apache.camel.spi.UriPath;
import org.apache.camel.util.URISupport;
import org.apache.hadoop.io.SequenceFile;
+import static org.apache.camel.util.ObjectHelper.isNotEmpty;
+
@UriParams
public class HdfsConfiguration {
@@ -189,7 +189,7 @@ public class HdfsConfiguration {
splitStrategy = getString(hdfsSettings, "splitStrategy", kerberosNamedNodes);
- if (nonNull(splitStrategy)) {
+ if (isNotEmpty(splitStrategy)) {
String[] strstrategies = splitStrategy.split(",");
for (String strstrategy : strstrategies) {
String[] tokens = strstrategy.split(":");
@@ -585,14 +585,7 @@ public class HdfsConfiguration {
}
public boolean isKerberosAuthentication() {
- return nonNullKerberosProperties() && nonEmptyKerberosProperties();
+ return isNotEmpty(kerberosNamedNodes) && isNotEmpty(kerberosConfigFileLocation) && isNotEmpty(kerberosUsername) && isNotEmpty(kerberosKeytabLocation);
}
- private boolean nonNullKerberosProperties() {
- return nonNull(kerberosNamedNodes) && nonNull(kerberosConfigFileLocation) && nonNull(kerberosUsername) && nonNull(kerberosKeytabLocation);
- }
-
- private boolean nonEmptyKerberosProperties() {
- return !kerberosNamedNodes.isEmpty() && !kerberosConfigFileLocation.isEmpty() && !kerberosUsername.isEmpty() && !kerberosKeytabLocation.isEmpty();
- }
}
diff --git a/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentConfiguration.java
index ea88324..8642528 100644
--- a/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentConfiguration.java
@@ -42,6 +42,13 @@ public class HdfsComponentConfiguration
*/
private String jAASConfiguration;
/**
+ * To use kerberos authentication, set the value of the
+ * 'java.security.krb5.conf' environment variable to an existing file. If
+ * the environment variable is already set, warn if different than the
+ * specified parameter
+ */
+ private String kerberosConfigFile;
+ /**
* Whether the component should use basic property binding (Camel 2.x) or
* the newer property binding with additional capabilities
*/
@@ -55,6 +62,14 @@ public class HdfsComponentConfiguration
this.jAASConfiguration = jAASConfiguration;
}
+ public String getKerberosConfigFile() {
+ return kerberosConfigFile;
+ }
+
+ public void setKerberosConfigFile(String kerberosConfigFile) {
+ this.kerberosConfigFile = kerberosConfigFile;
+ }
+
public Boolean getBasicPropertyBinding() {
return basicPropertyBinding;
}