You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2016/04/04 20:14:43 UTC
[1/2] nifi git commit: NIFI-1698 Improving customValidate in
AbstractHadoopProcessor and HBaseClient service to not reload Configuration
unless it changed. This closes #313
Repository: nifi
Updated Branches:
refs/heads/support/nifi-0.6.x 71476b2d3 -> 5364bd2fb
NIFI-1698 Improving customValidate in AbstractHadoopProcessor and HBaseClient service to not reload Configuration unless it changed. This closes #313
Signed-off-by: Matt Gilman <ma...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/14a9e5b6
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/14a9e5b6
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/14a9e5b6
Branch: refs/heads/support/nifi-0.6.x
Commit: 14a9e5b6c22aef20013848884be020d7843aec83
Parents: 71476b2
Author: Bryan Bende <bb...@apache.org>
Authored: Wed Mar 30 15:56:22 2016 -0400
Committer: joewitt <jo...@apache.org>
Committed: Mon Apr 4 14:12:23 2016 -0400
----------------------------------------------------------------------
.../org/apache/nifi/hadoop/SecurityUtil.java | 2 +-
.../hadoop/AbstractHadoopProcessor.java | 35 ++++++++++++++++++--
.../nifi/hbase/HBase_1_1_2_ClientService.java | 35 +++++++++++++++++++-
3 files changed, 68 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/14a9e5b6/nifi-commons/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java b/nifi-commons/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java
index 74197ef..8d8c6e9 100644
--- a/nifi-commons/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java
+++ b/nifi-commons/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java
@@ -79,7 +79,7 @@ public class SecurityUtil {
* @return true if kerberos is enabled on the given configuration, false otherwise
*
*/
- public static synchronized boolean isSecurityEnabled(final Configuration config) {
+ public static boolean isSecurityEnabled(final Configuration config) {
Validate.notNull(config);
return "kerberos".equalsIgnoreCase(config.get("hadoop.security.authentication"));
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/14a9e5b6/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java b/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
index cd9683b..9efc0f6 100644
--- a/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
+++ b/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
@@ -116,6 +116,9 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor {
// Hadoop Configuration, Filesystem, and UserGroupInformation (optional)
private final AtomicReference<HdfsResources> hdfsResources = new AtomicReference<>();
+ // Holder of cached Configuration information so validation does not reload the same config over and over
+ private final AtomicReference<ValidationResources> validationResourceHolder = new AtomicReference<>();
+
@Override
protected void init(ProcessorInitializationContext context) {
hdfsResources.set(new HdfsResources(null, null, null));
@@ -147,12 +150,21 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor {
final List<ValidationResult> results = new ArrayList<>();
if (!StringUtils.isBlank(configResources)) {
- Configuration conf = null;
try {
- conf = getConfigurationFromResources(configResources);
+ ValidationResources resources = validationResourceHolder.get();
+
+ // if no resources in the holder, or if the holder has different resources loaded,
+ // then load the Configuration and set the new resources in the holder
+ if (resources == null || !configResources.equals(resources.getConfigResources())) {
+ getLogger().debug("Reloading validation resources");
+ resources = new ValidationResources(configResources, getConfigurationFromResources(configResources));
+ validationResourceHolder.set(resources);
+ }
+ final Configuration conf = resources.getConfiguration();
results.addAll(KerberosProperties.validatePrincipalAndKeytab(
this.getClass().getSimpleName(), conf, principal, keytab, getLogger()));
+
} catch (IOException e) {
results.add(new ValidationResult.Builder()
.valid(false)
@@ -452,4 +464,23 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor {
return userGroupInformation;
}
}
+
+ static protected class ValidationResources {
+ private final String configResources;
+ private final Configuration configuration;
+
+ public ValidationResources(String configResources, Configuration configuration) {
+ this.configResources = configResources;
+ this.configuration = configuration;
+ }
+
+ public String getConfigResources() {
+ return configResources;
+ }
+
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/14a9e5b6/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java
index 3465135..1791cfe 100644
--- a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java
+++ b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java
@@ -65,6 +65,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
@Tags({ "hbase", "client"})
@CapabilityDescription("Implementation of HBaseClientService for HBase 1.1.2. This service can be configured by providing " +
@@ -90,6 +91,9 @@ public class HBase_1_1_2_ClientService extends AbstractControllerService impleme
private List<PropertyDescriptor> properties;
private KerberosProperties kerberosProperties;
+ // Holder of cached Configuration information so validation does not reload the same config over and over
+ private final AtomicReference<ValidationResources> validationResourceHolder = new AtomicReference<>();
+
@Override
protected void init(ControllerServiceInitializationContext config) throws InitializationException {
this.kerberosProperties = getKerberosProperties();
@@ -145,7 +149,17 @@ public class HBase_1_1_2_ClientService extends AbstractControllerService impleme
if (confFileProvided) {
final String configFiles = validationContext.getProperty(HADOOP_CONF_FILES).getValue();
- final Configuration hbaseConfig = getConfigurationFromFiles(configFiles);
+ ValidationResources resources = validationResourceHolder.get();
+
+ // if no resources in the holder, or if the holder has different resources loaded,
+ // then load the Configuration and set the new resources in the holder
+ if (resources == null || !configFiles.equals(resources.getConfigResources())) {
+ getLogger().debug("Reloading validation resources");
+ resources = new ValidationResources(configFiles, getConfigurationFromFiles(configFiles));
+ validationResourceHolder.set(resources);
+ }
+
+ final Configuration hbaseConfig = resources.getConfiguration();
final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).getValue();
final String keytab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).getValue();
@@ -372,4 +386,23 @@ public class HBase_1_1_2_ClientService extends AbstractControllerService impleme
return table.getScanner(scan);
}
+
+ static protected class ValidationResources {
+ private final String configResources;
+ private final Configuration configuration;
+
+ public ValidationResources(String configResources, Configuration configuration) {
+ this.configResources = configResources;
+ this.configuration = configuration;
+ }
+
+ public String getConfigResources() {
+ return configResources;
+ }
+
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+ }
+
}
[2/2] nifi git commit: NIFI-1695: - Removing hidden control
characters that were affecting graph styles. This closes #311
Posted by jo...@apache.org.
NIFI-1695:
- Removing hidden control characters that were affecting graph styles. This closes #311
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/5364bd2f
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/5364bd2f
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/5364bd2f
Branch: refs/heads/support/nifi-0.6.x
Commit: 5364bd2fb4b82afc9bd5c8cc940596d17442eb88
Parents: 14a9e5b
Author: Matt Gilman <ma...@gmail.com>
Authored: Tue Mar 29 14:07:46 2016 -0400
Committer: joewitt <jo...@apache.org>
Committed: Mon Apr 4 14:13:18 2016 -0400
----------------------------------------------------------------------
.../nifi-web/nifi-web-ui/src/main/webapp/css/graph.css | 4 ++--
.../nifi-web/nifi-web-ui/src/main/webapp/css/main.css | 2 +-
.../nifi-web/nifi-web-ui/src/main/webapp/css/status-history.css | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/5364bd2f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/graph.css
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/graph.css b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/graph.css
index 041476b..8718d27 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/graph.css
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/graph.css
@@ -53,7 +53,7 @@ text.unset {
*/
g.component {
- font-family: Arial, sans-serif;
+ font-family: Arial, sans-serif;
}
g.component.selected rect.border {
@@ -108,7 +108,7 @@ text.processor-stats-info {
*/
g.connection {
- font-family: Arial, sans-serif;
+ font-family: Arial, sans-serif;
}
path.connector {
http://git-wip-us.apache.org/repos/asf/nifi/blob/5364bd2f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/main.css
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/main.css b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/main.css
index 3a6e9d1..f689c98 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/main.css
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/main.css
@@ -69,7 +69,7 @@ div.context-menu-item-text {
margin-left: 4px;
line-height: 16px;
float: left;
- font-family: Arial, sans-serif;
+ font-family: Arial, sans-serif;
font-size: 11px;
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/5364bd2f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/status-history.css
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/status-history.css b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/status-history.css
index c17fa15..2461ffa 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/status-history.css
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/status-history.css
@@ -167,7 +167,7 @@ div.legend-label {
#status-history-chart-container text, #status-history-chart-control-container text {
fill: #527991;
- font-family: Arial, sans-serif;
+ font-family: Arial, sans-serif;
font-size: 10px;
}