http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-email-bundle/nifi-email-nar/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-email-bundle/nifi-email-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-email-bundle/nifi-email-nar/src/main/resources/META-INF/NOTICE index 5ced9df..881f8d0 100644 --- a/nifi-nar-bundles/nifi-email-bundle/nifi-email-nar/src/main/resources/META-INF/NOTICE +++ b/nifi-nar-bundles/nifi-email-bundle/nifi-email-nar/src/main/resources/META-INF/NOTICE @@ -86,6 +86,28 @@ The following binary components are provided under the Apache Software License v This product includes software developed by Joda.org (http://www.joda.org/). + (ASLv2) Jackson JSON processor + The following NOTICE information applies: + # Jackson JSON processor + + Jackson is a high-performance, Free/Open Source JSON processing library. + It was originally written by Tatu Saloranta ([email protected]), and has + been in development since 2007. + It is currently developed by a community of developers, as well as supported + commercially by FasterXML.com. + + ## Licensing + + Jackson core and extension components may licensed under different licenses. + To find the details that apply to this artifact see the accompanying LICENSE file. + For more information, including possible other licensing options, contact + FasterXML.com (http://fasterxml.com). + + ## Credits + + A list of contributors may be found from CREDITS file, which is included + in some artifacts (usually source distributions); but is always available + from the source code management (SCM) system project uses. ************************ Common Development and Distribution License 1.1
http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-enrich-bundle/nifi-enrich-nar/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-enrich-bundle/nifi-enrich-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-enrich-bundle/nifi-enrich-nar/src/main/resources/META-INF/NOTICE index 43409ca..65b3c47 100644 --- a/nifi-nar-bundles/nifi-enrich-bundle/nifi-enrich-nar/src/main/resources/META-INF/NOTICE +++ b/nifi-nar-bundles/nifi-enrich-bundle/nifi-enrich-nar/src/main/resources/META-INF/NOTICE @@ -65,7 +65,30 @@ The following binary components are provided under the Apache Software License v The following NOTICE information applies: GeoIP2 Java API This software is Copyright (c) 2013 by MaxMind, Inc. - + + (ASLv2) Jackson JSON processor + The following NOTICE information applies: + # Jackson JSON processor + + Jackson is a high-performance, Free/Open Source JSON processing library. + It was originally written by Tatu Saloranta ([email protected]), and has + been in development since 2007. + It is currently developed by a community of developers, as well as supported + commercially by FasterXML.com. + + ## Licensing + + Jackson core and extension components may licensed under different licenses. + To find the details that apply to this artifact see the accompanying LICENSE file. + For more information, including possible other licensing options, contact + FasterXML.com (http://fasterxml.com). + + ## Credits + + A list of contributors may be found from CREDITS file, which is included + in some artifacts (usually source distributions); but is always available + from the source code management (SCM) system project uses. + ************************ Creative Commons Attribution-ShareAlike 3.0 ************************ http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/pom.xml b/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/pom.xml index 7d13506..4f1d088 100644 --- a/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/pom.xml +++ b/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/pom.xml @@ -54,16 +54,16 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> <groupId>org.apache.nifi</groupId> <artifactId>nifi-distributed-cache-client-service-api</artifactId> <scope>provided</scope> </dependency> <dependency> - <groupId>org.codehaus.jackson</groupId> - <artifactId>jackson-mapper-asl</artifactId> - <version>${jackson.old.version}</version> - </dependency> - <dependency> <groupId>org.apache.nifi</groupId> <artifactId>nifi-mock</artifactId> <scope>test</scope> http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java b/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java index 52049ed..76e660d 100644 --- a/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java +++ b/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java @@ -17,23 +17,9 @@ package org.apache.nifi.processor.util.list; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.TreeMap; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.nifi.annotation.behavior.Stateful; import org.apache.nifi.annotation.behavior.TriggerSerially; import org.apache.nifi.annotation.lifecycle.OnScheduled; @@ -55,10 +41,23 @@ import org.apache.nifi.processor.ProcessContext; import org.apache.nifi.processor.ProcessSession; import org.apache.nifi.processor.Relationship; import org.apache.nifi.processor.exception.ProcessException; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.JsonParseException; -import org.codehaus.jackson.map.JsonMappingException; -import org.codehaus.jackson.map.ObjectMapper; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.TreeMap; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; /** * <p> @@ -345,8 +344,7 @@ public abstract class AbstractListProcessor<T extends ListableEntity> extends Ab private EntityListing deserialize(final String serializedState) throws JsonParseException, JsonMappingException, IOException { final ObjectMapper mapper = new ObjectMapper(); - final JsonNode jsonNode = mapper.readTree(serializedState); - return mapper.readValue(jsonNode, EntityListing.class); + return mapper.readValue(serializedState, EntityListing.class); } http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/test/java/org/apache/nifi/processor/util/list/TestAbstractListProcessor.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/test/java/org/apache/nifi/processor/util/list/TestAbstractListProcessor.java b/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/test/java/org/apache/nifi/processor/util/list/TestAbstractListProcessor.java index 1ecbce7..4a376e2 100644 --- a/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/test/java/org/apache/nifi/processor/util/list/TestAbstractListProcessor.java +++ b/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/test/java/org/apache/nifi/processor/util/list/TestAbstractListProcessor.java @@ -17,27 +17,6 @@ package org.apache.nifi.processor.util.list; -import static org.apache.nifi.processor.util.list.AbstractListProcessor.PRECISION_MILLIS; -import static org.apache.nifi.processor.util.list.AbstractListProcessor.PRECISION_MINUTES; -import static org.apache.nifi.processor.util.list.AbstractListProcessor.PRECISION_SECONDS; -import static org.apache.nifi.processor.util.list.AbstractListProcessor.TARGET_SYSTEM_TIMESTAMP_PRECISION; -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -import org.apache.commons.io.Charsets; import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.components.state.Scope; import org.apache.nifi.components.state.StateMap; @@ -60,6 +39,27 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.rules.TestWatcher; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import static org.apache.nifi.processor.util.list.AbstractListProcessor.PRECISION_MILLIS; +import static org.apache.nifi.processor.util.list.AbstractListProcessor.PRECISION_MINUTES; +import static org.apache.nifi.processor.util.list.AbstractListProcessor.PRECISION_SECONDS; +import static org.apache.nifi.processor.util.list.AbstractListProcessor.TARGET_SYSTEM_TIMESTAMP_PRECISION; +import static org.junit.Assert.assertEquals; + public class TestAbstractListProcessor { /** @@ -398,7 +398,7 @@ public class TestAbstractListProcessor { // Create a persistence file of the format anticipated try (FileOutputStream fos = new FileOutputStream(persistenceFile);) { - fos.write(serviceState.getBytes(Charsets.UTF_8)); + fos.write(serviceState.getBytes(StandardCharsets.UTF_8)); } runner.run(); http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework-nar/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework-nar/src/main/resources/META-INF/NOTICE index 22c9ba9..1e9c128 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework-nar/src/main/resources/META-INF/NOTICE +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework-nar/src/main/resources/META-INF/NOTICE @@ -125,23 +125,69 @@ The following binary components are provided under the Apache Software License v Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. Contact GitHub API Training Shop Blog About + (ASLv2) Jackson JSON processor + The following NOTICE information applies: + # Jackson JSON processor + + Jackson is a high-performance, Free/Open Source JSON processing library. + It was originally written by Tatu Saloranta ([email protected]), and has + been in development since 2007. + It is currently developed by a community of developers, as well as supported + commercially by FasterXML.com. + + ## Licensing + + Jackson core and extension components may licensed under different licenses. + To find the details that apply to this artifact see the accompanying LICENSE file. + For more information, including possible other licensing options, contact + FasterXML.com (http://fasterxml.com). + + ## Credits + + A list of contributors may be found from CREDITS file, which is included + in some artifacts (usually source distributions); but is always available + from the source code management (SCM) system project uses. + + (ASLv2) Classmate + The following NOTICE information applies + Java ClassMate library was originally written by Tatu Saloranta ([email protected]) + + Other developers who have contributed code are: + + * Brian Langel + ************************ Common Development and Distribution License 1.1 ************************ The following binary components are provided under the Common Development and Distribution License 1.1. See project link for details. - (CDDL 1.1) (GPL2 w/ CPE) jersey-client (com.sun.jersey:jersey-client:jar:1.19 - https://jersey.java.net/jersey-client/) - (CDDL 1.1) (GPL2 w/ CPE) jersey-core (com.sun.jersey:jersey-core:jar:1.19 - https://jersey.java.net/jersey-core/) - (CDDL 1.1) (GPL2 w/ CPE) jersey-spring (com.sun.jersey:jersey-spring:jar:1.19 - https://jersey.java.net/jersey-spring/) - (CDDL 1.1) (GPL2 w/ CPE) jersey-servlet (com.sun.jersey:jersey-servlet:jar:1.19 - https://jersey.java.net/jersey-servlet/) - (CDDL 1.1) (GPL2 w/ CPE) jersey-multipart (com.sun.jersey:jersey-multipart:jar:1.19 - https://jersey.java.net/jersey-multipart/) - (CDDL 1.1) (GPL2 w/ CPE) jersey-server (com.sun.jersey:jersey-server:jar:1.19 - https://jersey.java.net/jersey-server/) - (CDDL 1.1) (GPL2 w/ CPE) jersey-json (com.sun.jersey:jersey-json:jar:1.19 - https://jersey.java.net/jersey-json/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-client (org.glassfish.jersey.core:jersey-client:jar:2.26 - https://jersey.github.io/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-common (org.glassfish.jersey.core:jersey-common:jar:2.26 - https://jersey.github.io/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-container-servlet-core (org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.26 - https://jersey.github.io/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-entity-filtering (org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.26 - https://jersey.github.io/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-hk2 (org.glassfish.jersey.inject:jersey-hk2:jar:2.26 - https://jersey.github.io/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-media-jaxb (org.glassfish.jersey.media:jersey-media-jaxb:jar:2.26 - https://jersey.github.io/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-media-json-jackson (org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.26 - https://jersey.github.io/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-media-multipart (org.glassfish.jersey.media:jersey-media-multipart:jar:2.26 - https://jersey.github.io/) + (CDDL 1.1) (GPL2 w/ CPE) jersey-server (org.glassfish.jersey.core:jersey-server:jar:2.26 - https://jersey.github.io/) + (CDDL 1.1) (GPL2 w/ CPE) hk2 (org.glassfish.hk2:hk2:jar:2.5.0-b42 - https://javaee.github.io/glassfish/) + (CDDL 1.1) (GPL2 w/ CPE) hk2-api (org.glassfish.hk2:hk2-api:jar:2.5.0-b42 - https://javaee.github.io/glassfish/) + (CDDL 1.1) (GPL2 w/ CPE) hk2-utils (org.glassfish.hk2:hk2-utils:jar:2.5.0-b42 - https://javaee.github.io/glassfish/) + (CDDL 1.1) (GPL2 w/ CPE) hk2-locator (org.glassfish.hk2:hk2-locator:jar:2.5.0-b42 - https://javaee.github.io/glassfish/) + (CDDL 1.1) (GPL2 w/ CPE) hk2-config (org.glassfish.hk2:hk2-config:jar:2.5.0-b42 - https://javaee.github.io/glassfish/) + (CDDL 1.1) (GPL2 w/ CPE) hk2-core (org.glassfish.hk2:hk2-core:jar:2.5.0-b42 - https://javaee.github.io/glassfish/) + (CDDL 1.1) (GPL2 w/ CPE) hk2-runlevel (org.glassfish.hk2:hk2-runlevel:jar:2.5.0-b42 - https://javaee.github.io/glassfish/) + (CDDL 1.1) (GPL2 w/ CPE) config-types (org.glassfish.hk2:config-types:jar:2.5.0-b42 - https://javaee.github.io/glassfish/) + (CDDL 1.1) (GPL2 w/ CPE) class-model (org.glassfish.hk2:class-model:jar:2.5.0-b42 - https://javaee.github.io/glassfish/) + (CDDL 1.1) (GPL2 w/ CPE) asm-all-repackaged (org.glassfish.hk2.external:asm-all-repackaged:jar:2.5.0-b42 - https://javaee.github.io/glassfish/) + (CDDL 1.1) (GPL2 w/ CPE) aopalliance-repackaged (org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b42 - https://javaee.github.io/glassfish/) + (CDDL 1.1) (GPL2 w/ CPE) javax.inject:1 as OSGi bundle (org.glassfish.hk2.external:javax.inject:jar:2.4.0-b25 - https://hk2.java.net/external/javax.inject) (CDDL 1.1) (GPL2 w/ CPE) Old JAXB Runtime (com.sun.xml.bind:jaxb-impl:jar:2.2.3-1 - http://jaxb.java.net/) (CDDL 1.1) (GPL2 w/ CPE) Java Architecture For XML Binding (javax.xml.bind:jaxb-api:jar:2.2.2 - https://jaxb.dev.java.net/) (CDDL 1.1) (GPL2 w/ CPE) MIME Streaming Extension (org.jvnet.mimepull:mimepull:jar:1.9.3 - http://mimepull.java.net) (CDDL 1.1) (GPL2 w/ CPE) JavaMail API (compat) (javax.mail:mail:jar:1.4.7 - http://kenai.com/projects/javamail/mail) + (CDDL 1.1) (GPL2 w/ CPE) javax.ws.rs-api (javax.ws.rs:javax.ws.rs-api:jar:2.1 - http://jax-rs-spec.java.net) ************************ Common Development and Distribution License 1.0 @@ -151,7 +197,6 @@ The following binary components are provided under the Common Development and Di (CDDL 1.0) (GPL3) Streaming API For XML (javax.xml.stream:stax-api:jar:1.0-2 - no url provided) (CDDL 1.0) JavaBeans Activation Framework (JAF) (javax.activation:activation:jar:1.1 - http://java.sun.com/products/javabeans/jaf/index.jsp) - (CDDL 1.0) JSR311 API (javax.ws.rs:jsr311-api:jar:1.1.1 - https://jsr311.dev.java.net) ************************ Eclipse Public License 1.0 http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/pom.xml index 6f0eae3..30f9371 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/pom.xml @@ -109,18 +109,39 @@ <!-- jersey dependencies --> <dependency> - <groupId>com.sun.jersey</groupId> + <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-client</artifactId> </dependency> <dependency> - <groupId>com.sun.jersey</groupId> - <artifactId>jersey-server</artifactId> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-jackson</artifactId> </dependency> <dependency> - <groupId>com.sun.jersey</groupId> - <artifactId>jersey-json</artifactId> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-common</artifactId> </dependency> - + <dependency> + <groupId>org.glassfish.jersey.inject</groupId> + <artifactId>jersey-hk2</artifactId> + </dependency> + + <!-- jackson dependencies --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-jaxb-annotations</artifactId> + <version>${jackson.version}</version> + </dependency> + <!-- spring dependencies --> <dependency> <groupId>org.springframework</groupId> http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/AbstractSingleDTOEndpoint.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/AbstractSingleDTOEndpoint.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/AbstractSingleDTOEndpoint.java index 2ef3129..c9b0bab 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/AbstractSingleDTOEndpoint.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/AbstractSingleDTOEndpoint.java @@ -35,12 +35,12 @@ public abstract class AbstractSingleDTOEndpoint<EntityType extends Entity, DtoTy throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final EntityType responseEntity = clientResponse.getClientResponse().getEntity(getEntityClass()); + final EntityType responseEntity = clientResponse.getClientResponse().readEntity(getEntityClass()); final DtoType dto = getDto(responseEntity); final Map<NodeIdentifier, DtoType> dtoMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final EntityType nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(getEntityClass()); + final EntityType nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(getEntityClass()); final DtoType nodeDto = getDto(nodeResponseEntity); dtoMap.put(nodeResponse.getNodeId(), nodeDto); } http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/AbstractSingleEntityEndpoint.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/AbstractSingleEntityEndpoint.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/AbstractSingleEntityEndpoint.java index a7ea4a1..fb50b6a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/AbstractSingleEntityEndpoint.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/AbstractSingleEntityEndpoint.java @@ -34,11 +34,11 @@ public abstract class AbstractSingleEntityEndpoint<EntityType extends Entity> im throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final EntityType responseEntity = clientResponse.getClientResponse().getEntity(getEntityClass()); + final EntityType responseEntity = clientResponse.getClientResponse().readEntity(getEntityClass()); final Map<NodeIdentifier, EntityType> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final EntityType nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(getEntityClass()); + final EntityType nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(getEntityClass()); entityMap.put(nodeResponse.getNodeId(), nodeResponseEntity); } http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectionsEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectionsEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectionsEndpointMerger.java index 07104f4..76f91df 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectionsEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectionsEndpointMerger.java @@ -44,12 +44,12 @@ public class ConnectionsEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final ConnectionsEntity responseEntity = clientResponse.getClientResponse().getEntity(ConnectionsEntity.class); + final ConnectionsEntity responseEntity = clientResponse.getClientResponse().readEntity(ConnectionsEntity.class); final Set<ConnectionEntity> connectionEntities = responseEntity.getConnections(); final Map<String, Map<NodeIdentifier, ConnectionEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final ConnectionsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(ConnectionsEntity.class); + final ConnectionsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(ConnectionsEntity.class); final Set<ConnectionEntity> nodeConnectionEntities = nodeResponseEntity.getConnections(); for (final ConnectionEntity nodeConnectionEntity : nodeConnectionEntities) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ControllerServiceReferenceEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ControllerServiceReferenceEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ControllerServiceReferenceEndpointMerger.java index 129d36f..50109d6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ControllerServiceReferenceEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ControllerServiceReferenceEndpointMerger.java @@ -48,13 +48,13 @@ public class ControllerServiceReferenceEndpointMerger implements EndpointRespons throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final ControllerServiceReferencingComponentsEntity responseEntity = clientResponse.getClientResponse().getEntity(ControllerServiceReferencingComponentsEntity.class); + final ControllerServiceReferencingComponentsEntity responseEntity = clientResponse.getClientResponse().readEntity(ControllerServiceReferencingComponentsEntity.class); final Set<ControllerServiceReferencingComponentEntity> referencingComponents = responseEntity.getControllerServiceReferencingComponents(); final Map<NodeIdentifier, Set<ControllerServiceReferencingComponentEntity>> resultsMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { final ControllerServiceReferencingComponentsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity - : nodeResponse.getClientResponse().getEntity(ControllerServiceReferencingComponentsEntity.class); + : nodeResponse.getClientResponse().readEntity(ControllerServiceReferencingComponentsEntity.class); final Set<ControllerServiceReferencingComponentEntity> nodeReferencingComponents = nodeResponseEntity.getControllerServiceReferencingComponents(); resultsMap.put(nodeResponse.getNodeId(), nodeReferencingComponents); http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ControllerServicesEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ControllerServicesEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ControllerServicesEndpointMerger.java index 854a027..b63d0ee 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ControllerServicesEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ControllerServicesEndpointMerger.java @@ -45,12 +45,12 @@ public class ControllerServicesEndpointMerger implements EndpointResponseMerger throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final ControllerServicesEntity responseEntity = clientResponse.getClientResponse().getEntity(ControllerServicesEntity.class); + final ControllerServicesEntity responseEntity = clientResponse.getClientResponse().readEntity(ControllerServicesEntity.class); final Set<ControllerServiceEntity> controllerServiceEntities = responseEntity.getControllerServices(); final Map<String, Map<NodeIdentifier, ControllerServiceEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final ControllerServicesEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(ControllerServicesEntity.class); + final ControllerServicesEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(ControllerServicesEntity.class); final Set<ControllerServiceEntity> nodeControllerServiceEntities = nodeResponseEntity.getControllerServices(); for (final ControllerServiceEntity nodeControllerServiceEntity : nodeControllerServiceEntities) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowSnippetEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowSnippetEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowSnippetEndpointMerger.java index 78ccad6..457c56f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowSnippetEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowSnippetEndpointMerger.java @@ -17,12 +17,6 @@ package org.apache.nifi.cluster.coordination.http.endpoints; -import java.net.URI; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - import org.apache.nifi.cluster.coordination.http.EndpointResponseMerger; import org.apache.nifi.cluster.manager.NodeResponse; import org.apache.nifi.cluster.protocol.NodeIdentifier; @@ -31,6 +25,12 @@ import org.apache.nifi.web.api.entity.FlowEntity; import org.apache.nifi.web.api.entity.ProcessorEntity; import org.apache.nifi.web.api.entity.RemoteProcessGroupEntity; +import java.net.URI; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; + public class FlowSnippetEndpointMerger implements EndpointResponseMerger { public static final Pattern TEMPLATE_INSTANCE_URI_PATTERN = Pattern.compile("/nifi-api/process-groups/(?:(?:root)|(?:[a-f0-9\\-]{36}))/template-instance"); public static final Pattern FLOW_SNIPPET_INSTANCE_URI_PATTERN = Pattern.compile("/nifi-api/process-groups/(?:(?:root)|(?:[a-f0-9\\-]{36}))/snippet-instance"); @@ -43,7 +43,7 @@ public class FlowSnippetEndpointMerger implements EndpointResponseMerger { @Override public NodeResponse merge(final URI uri, final String method, Set<NodeResponse> successfulResponses, final Set<NodeResponse> problematicResponses, final NodeResponse clientResponse) { - final FlowEntity responseEntity = clientResponse.getClientResponse().getEntity(FlowEntity.class); + final FlowEntity responseEntity = clientResponse.getClientResponse().readEntity(FlowEntity.class); final FlowDTO flowDto = responseEntity.getFlow(); if (flowDto == null) { @@ -53,7 +53,7 @@ public class FlowSnippetEndpointMerger implements EndpointResponseMerger { final Map<String, Map<NodeIdentifier, RemoteProcessGroupEntity>> remoteProcessGroupMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final FlowEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(FlowEntity.class); + final FlowEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(FlowEntity.class); final FlowDTO nodeContents = nodeResponseEntity.getFlow(); for (final ProcessorEntity nodeProcessor : nodeContents.getProcessors()) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FunnelsEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FunnelsEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FunnelsEndpointMerger.java index bbe394f..b16c48e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FunnelsEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FunnelsEndpointMerger.java @@ -43,12 +43,12 @@ public class FunnelsEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final FunnelsEntity responseEntity = clientResponse.getClientResponse().getEntity(FunnelsEntity.class); + final FunnelsEntity responseEntity = clientResponse.getClientResponse().readEntity(FunnelsEntity.class); final Set<FunnelEntity> funnelEntities = responseEntity.getFunnels(); final Map<String, Map<NodeIdentifier, FunnelEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final FunnelsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(FunnelsEntity.class); + final FunnelsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(FunnelsEntity.class); final Set<FunnelEntity> nodeFunnelEntities = nodeResponseEntity.getFunnels(); for (final FunnelEntity nodeFunnelEntity : nodeFunnelEntities) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/InputPortsEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/InputPortsEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/InputPortsEndpointMerger.java index b206508..22d697e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/InputPortsEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/InputPortsEndpointMerger.java @@ -44,12 +44,12 @@ public class InputPortsEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final InputPortsEntity responseEntity = clientResponse.getClientResponse().getEntity(InputPortsEntity.class); + final InputPortsEntity responseEntity = clientResponse.getClientResponse().readEntity(InputPortsEntity.class); final Set<PortEntity> portEntities = responseEntity.getInputPorts(); final Map<String, Map<NodeIdentifier, PortEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final InputPortsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(InputPortsEntity.class); + final InputPortsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(InputPortsEntity.class); final Set<PortEntity> nodePortEntities = nodeResponseEntity.getInputPorts(); for (final PortEntity nodePortEntity : nodePortEntities) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/LabelsEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/LabelsEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/LabelsEndpointMerger.java index 48574cd..47b330f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/LabelsEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/LabelsEndpointMerger.java @@ -43,12 +43,12 @@ public class LabelsEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final LabelsEntity responseEntity = clientResponse.getClientResponse().getEntity(LabelsEntity.class); + final LabelsEntity responseEntity = clientResponse.getClientResponse().readEntity(LabelsEntity.class); final Set<LabelEntity> labelEntities = responseEntity.getLabels(); final Map<String, Map<NodeIdentifier, LabelEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final LabelsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(LabelsEntity.class); + final LabelsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(LabelsEntity.class); final Set<LabelEntity> nodeLabelEntities = nodeResponseEntity.getLabels(); for (final LabelEntity nodeLabelEntity : nodeLabelEntities) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/OutputPortsEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/OutputPortsEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/OutputPortsEndpointMerger.java index 753c406..1ab5236 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/OutputPortsEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/OutputPortsEndpointMerger.java @@ -44,12 +44,12 @@ public class OutputPortsEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final OutputPortsEntity responseEntity = clientResponse.getClientResponse().getEntity(OutputPortsEntity.class); + final OutputPortsEntity responseEntity = clientResponse.getClientResponse().readEntity(OutputPortsEntity.class); final Set<PortEntity> portEntities = responseEntity.getOutputPorts(); final Map<String, Map<NodeIdentifier, PortEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final OutputPortsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(OutputPortsEntity.class); + final OutputPortsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(OutputPortsEntity.class); final Set<PortEntity> nodePortEntities = nodeResponseEntity.getOutputPorts(); for (final PortEntity nodePortEntity : nodePortEntities) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProcessGroupsEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProcessGroupsEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProcessGroupsEndpointMerger.java index d4f047e..7cd6a44 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProcessGroupsEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProcessGroupsEndpointMerger.java @@ -44,12 +44,12 @@ public class ProcessGroupsEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final ProcessGroupsEntity responseEntity = clientResponse.getClientResponse().getEntity(ProcessGroupsEntity.class); + final ProcessGroupsEntity responseEntity = clientResponse.getClientResponse().readEntity(ProcessGroupsEntity.class); final Set<ProcessGroupEntity> processGroupEntities = responseEntity.getProcessGroups(); final Map<String, Map<NodeIdentifier, ProcessGroupEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final ProcessGroupsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(ProcessGroupsEntity.class); + final ProcessGroupsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(ProcessGroupsEntity.class); final Set<ProcessGroupEntity> nodeProcessGroupEntities = nodeResponseEntity.getProcessGroups(); for (final ProcessGroupEntity nodeProcessGroupEntity : nodeProcessGroupEntities) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProcessorsEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProcessorsEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProcessorsEndpointMerger.java index da84c58..0a9b193 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProcessorsEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProcessorsEndpointMerger.java @@ -44,12 +44,12 @@ public class ProcessorsEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final ProcessorsEntity responseEntity = clientResponse.getClientResponse().getEntity(ProcessorsEntity.class); + final ProcessorsEntity responseEntity = clientResponse.getClientResponse().readEntity(ProcessorsEntity.class); final Set<ProcessorEntity> processorEntities = responseEntity.getProcessors(); final Map<String, Map<NodeIdentifier, ProcessorEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final ProcessorsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(ProcessorsEntity.class); + final ProcessorsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(ProcessorsEntity.class); final Set<ProcessorEntity> nodeProcessorEntities = nodeResponseEntity.getProcessors(); for (final ProcessorEntity nodeProcessorEntity : nodeProcessorEntities) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProvenanceQueryEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProvenanceQueryEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProvenanceQueryEndpointMerger.java index 91dcd79..8a957d1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProvenanceQueryEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ProvenanceQueryEndpointMerger.java @@ -17,6 +17,16 @@ package org.apache.nifi.cluster.coordination.http.endpoints; +import org.apache.nifi.cluster.coordination.http.EndpointResponseMerger; +import org.apache.nifi.cluster.manager.NodeResponse; +import org.apache.nifi.cluster.protocol.NodeIdentifier; +import org.apache.nifi.util.FormatUtils; +import org.apache.nifi.web.api.dto.provenance.ProvenanceDTO; +import org.apache.nifi.web.api.dto.provenance.ProvenanceEventDTO; +import org.apache.nifi.web.api.dto.provenance.ProvenanceRequestDTO; +import org.apache.nifi.web.api.dto.provenance.ProvenanceResultsDTO; +import org.apache.nifi.web.api.entity.ProvenanceEntity; + import java.net.URI; import java.util.ArrayList; import java.util.Collections; @@ -29,16 +39,6 @@ import java.util.Map; import java.util.Set; import java.util.regex.Pattern; -import org.apache.nifi.cluster.coordination.http.EndpointResponseMerger; -import org.apache.nifi.cluster.manager.NodeResponse; -import org.apache.nifi.cluster.protocol.NodeIdentifier; -import org.apache.nifi.util.FormatUtils; -import org.apache.nifi.web.api.dto.provenance.ProvenanceDTO; -import org.apache.nifi.web.api.dto.provenance.ProvenanceEventDTO; -import org.apache.nifi.web.api.dto.provenance.ProvenanceRequestDTO; -import org.apache.nifi.web.api.dto.provenance.ProvenanceResultsDTO; -import org.apache.nifi.web.api.entity.ProvenanceEntity; - public class ProvenanceQueryEndpointMerger implements EndpointResponseMerger { public static final String PROVENANCE_URI = "/nifi-api/provenance"; public static final Pattern PROVENANCE_QUERY_URI = Pattern.compile("/nifi-api/provenance/[a-f0-9\\-]{36}"); @@ -60,12 +60,12 @@ public class ProvenanceQueryEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final ProvenanceEntity responseEntity = clientResponse.getClientResponse().getEntity(ProvenanceEntity.class); + final ProvenanceEntity responseEntity = clientResponse.getClientResponse().readEntity(ProvenanceEntity.class); final ProvenanceDTO dto = responseEntity.getProvenance(); final Map<NodeIdentifier, ProvenanceDTO> dtoMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final ProvenanceEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(ProvenanceEntity.class); + final ProvenanceEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(ProvenanceEntity.class); final ProvenanceDTO nodeDto = nodeResponseEntity.getProvenance(); dtoMap.put(nodeResponse.getNodeId(), nodeDto); } http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/RemoteProcessGroupsEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/RemoteProcessGroupsEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/RemoteProcessGroupsEndpointMerger.java index c95aa9b..79cfa1d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/RemoteProcessGroupsEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/RemoteProcessGroupsEndpointMerger.java @@ -44,12 +44,12 @@ public class RemoteProcessGroupsEndpointMerger implements EndpointResponseMerger throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final RemoteProcessGroupsEntity responseEntity = clientResponse.getClientResponse().getEntity(RemoteProcessGroupsEntity.class); + final RemoteProcessGroupsEntity responseEntity = clientResponse.getClientResponse().readEntity(RemoteProcessGroupsEntity.class); final Set<RemoteProcessGroupEntity> rpgEntities = responseEntity.getRemoteProcessGroups(); final Map<String, Map<NodeIdentifier, RemoteProcessGroupEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final RemoteProcessGroupsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(RemoteProcessGroupsEntity.class); + final RemoteProcessGroupsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(RemoteProcessGroupsEntity.class); final Set<RemoteProcessGroupEntity> nodeRpgEntities = nodeResponseEntity.getRemoteProcessGroups(); for (final RemoteProcessGroupEntity nodeRpgEntity : nodeRpgEntities) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ReportingTasksEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ReportingTasksEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ReportingTasksEndpointMerger.java index 8771722..643630b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ReportingTasksEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ReportingTasksEndpointMerger.java @@ -43,12 +43,12 @@ public class ReportingTasksEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final ReportingTasksEntity responseEntity = clientResponse.getClientResponse().getEntity(ReportingTasksEntity.class); + final ReportingTasksEntity responseEntity = clientResponse.getClientResponse().readEntity(ReportingTasksEntity.class); final Set<ReportingTaskEntity> reportingTasksEntities = responseEntity.getReportingTasks(); final Map<String, Map<NodeIdentifier, ReportingTaskEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final ReportingTasksEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(ReportingTasksEntity.class); + final ReportingTasksEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(ReportingTasksEntity.class); final Set<ReportingTaskEntity> nodeReportingTaskEntities = nodeResponseEntity.getReportingTasks(); for (final ReportingTaskEntity nodeReportingTaskEntity : nodeReportingTaskEntities) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/SearchUsersEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/SearchUsersEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/SearchUsersEndpointMerger.java index 31996cb..76582fe 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/SearchUsersEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/SearchUsersEndpointMerger.java @@ -41,12 +41,12 @@ public class SearchUsersEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final TenantsEntity responseEntity = clientResponse.getClientResponse().getEntity(TenantsEntity.class); + final TenantsEntity responseEntity = clientResponse.getClientResponse().readEntity(TenantsEntity.class); final Collection<TenantEntity> userEntities = responseEntity.getUsers(); final Collection<TenantEntity> userGroupEntities = responseEntity.getUserGroups(); for (final NodeResponse nodeResponse : successfulResponses) { - final TenantsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(TenantsEntity.class); + final TenantsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(TenantsEntity.class); // only retain users/groups that all nodes agree on userEntities.retainAll(nodeResponseEntity.getUsers()); http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/StatusHistoryEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/StatusHistoryEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/StatusHistoryEndpointMerger.java index eb96adb..49e952b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/StatusHistoryEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/StatusHistoryEndpointMerger.java @@ -102,7 +102,7 @@ public class StatusHistoryEndpointMerger implements EndpointResponseMerger { public NodeResponse merge(URI uri, String method, Set<NodeResponse> successfulResponses, Set<NodeResponse> problematicResponses, NodeResponse clientResponse) { final Map<String, MetricDescriptor<?>> metricDescriptors = getStandardMetricDescriptors(uri); - final StatusHistoryEntity responseEntity = clientResponse.getClientResponse().getEntity(StatusHistoryEntity.class); + final StatusHistoryEntity responseEntity = clientResponse.getClientResponse().readEntity(StatusHistoryEntity.class); final Set<StatusDescriptorDTO> fieldDescriptors = new LinkedHashSet<>(); @@ -111,7 +111,7 @@ public class StatusHistoryEndpointMerger implements EndpointResponseMerger { final List<NodeStatusSnapshotsDTO> nodeStatusSnapshots = new ArrayList<>(successfulResponses.size()); LinkedHashMap<String, String> noReadPermissionsComponentDetails = null; for (final NodeResponse nodeResponse : successfulResponses) { - final StatusHistoryEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(StatusHistoryEntity.class); + final StatusHistoryEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(StatusHistoryEntity.class); final StatusHistoryDTO nodeStatus = nodeResponseEntity.getStatusHistory(); lastStatusHistory = nodeStatus; if (noReadPermissionsComponentDetails == null && !nodeResponseEntity.getCanRead()) { http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/TemplatesEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/TemplatesEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/TemplatesEndpointMerger.java index 516cba9..a947da0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/TemplatesEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/TemplatesEndpointMerger.java @@ -17,6 +17,12 @@ package org.apache.nifi.cluster.coordination.http.endpoints; +import org.apache.nifi.cluster.coordination.http.EndpointResponseMerger; +import org.apache.nifi.cluster.manager.NodeResponse; +import org.apache.nifi.web.api.dto.TemplateDTO; +import org.apache.nifi.web.api.entity.TemplateEntity; +import org.apache.nifi.web.api.entity.TemplatesEntity; + import java.net.URI; import java.util.HashMap; import java.util.HashSet; @@ -25,12 +31,6 @@ import java.util.Set; import java.util.regex.Pattern; import java.util.stream.Collectors; -import org.apache.nifi.cluster.coordination.http.EndpointResponseMerger; -import org.apache.nifi.cluster.manager.NodeResponse; -import org.apache.nifi.web.api.dto.TemplateDTO; -import org.apache.nifi.web.api.entity.TemplateEntity; -import org.apache.nifi.web.api.entity.TemplatesEntity; - public class TemplatesEndpointMerger implements EndpointResponseMerger { public static final Pattern TEMPLATES_URI_PATTERN = Pattern.compile("/nifi-api/process-groups/(?:(?:root)|(?:[a-f0-9\\-]{36}))/templates"); @@ -57,14 +57,14 @@ public class TemplatesEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final TemplatesEntity responseEntity = clientResponse.getClientResponse().getEntity(getEntityClass()); + final TemplatesEntity responseEntity = clientResponse.getClientResponse().readEntity(getEntityClass()); // Find the templates that all nodes know about. We do this by mapping Template ID to Template and // then for each node, removing any template whose ID is not known to that node. After iterating over // all of the nodes, we are left with a Map whose contents are those Templates known by all nodes. Map<String, TemplateEntity> templatesById = null; for (final NodeResponse nodeResponse : successfulResponses) { - final TemplatesEntity entity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(TemplatesEntity.class); + final TemplatesEntity entity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(TemplatesEntity.class); final Set<TemplateEntity> templateEntities = entity.getTemplates(); final Map<String, TemplateEntity> nodeTemplatesById = templateEntities.stream().collect(Collectors.toMap(ent -> ent.getId(), ent -> ent)); http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/UserGroupsEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/UserGroupsEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/UserGroupsEndpointMerger.java index 3b18814..51cc915 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/UserGroupsEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/UserGroupsEndpointMerger.java @@ -45,12 +45,12 @@ public class UserGroupsEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final UserGroupsEntity responseEntity = clientResponse.getClientResponse().getEntity(UserGroupsEntity.class); + final UserGroupsEntity responseEntity = clientResponse.getClientResponse().readEntity(UserGroupsEntity.class); final Collection<UserGroupEntity> userGroupEntities = responseEntity.getUserGroups(); final Map<String, Map<NodeIdentifier, UserGroupEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final UserGroupsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(UserGroupsEntity.class); + final UserGroupsEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(UserGroupsEntity.class); final Collection<UserGroupEntity> nodeUserGroupEntities = nodeResponseEntity.getUserGroups(); // only retain user groups that all nodes agree on http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/UsersEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/UsersEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/UsersEndpointMerger.java index 581b359..7984197 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/UsersEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/UsersEndpointMerger.java @@ -45,12 +45,12 @@ public class UsersEndpointMerger implements EndpointResponseMerger { throw new IllegalArgumentException("Cannot use Endpoint Mapper of type " + getClass().getSimpleName() + " to map responses for URI " + uri + ", HTTP Method " + method); } - final UsersEntity responseEntity = clientResponse.getClientResponse().getEntity(UsersEntity.class); + final UsersEntity responseEntity = clientResponse.getClientResponse().readEntity(UsersEntity.class); final Collection<UserEntity> userEntities = responseEntity.getUsers(); final Map<String, Map<NodeIdentifier, UserEntity>> entityMap = new HashMap<>(); for (final NodeResponse nodeResponse : successfulResponses) { - final UsersEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().getEntity(UsersEntity.class); + final UsersEntity nodeResponseEntity = nodeResponse == clientResponse ? responseEntity : nodeResponse.getClientResponse().readEntity(UsersEntity.class); final Collection<UserEntity> nodeUserEntities = nodeResponseEntity.getUsers(); // only retain users that all nodes agree on http://git-wip-us.apache.org/repos/asf/nifi/blob/6baea8cc/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/ThreadPoolRequestReplicator.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/ThreadPoolRequestReplicator.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/ThreadPoolRequestReplicator.java index 6f57ad0..bd7729c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/ThreadPoolRequestReplicator.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/ThreadPoolRequestReplicator.java @@ -17,12 +17,6 @@ package org.apache.nifi.cluster.coordination.http.replication; -import com.sun.jersey.api.client.Client; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.WebResource; -import com.sun.jersey.api.client.config.ClientConfig; -import com.sun.jersey.api.client.filter.GZIPContentEncodingFilter; -import com.sun.jersey.core.util.MultivaluedMapImpl; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.authorization.AccessDeniedException; import org.apache.nifi.authorization.user.NiFiUser; @@ -41,18 +35,28 @@ import org.apache.nifi.cluster.manager.exception.UnknownNodeException; import org.apache.nifi.cluster.manager.exception.UriConstructionException; import org.apache.nifi.cluster.protocol.NodeIdentifier; import org.apache.nifi.events.EventReporter; +import org.apache.nifi.remote.protocol.http.HttpHeaders; import org.apache.nifi.reporting.Severity; import org.apache.nifi.util.ComponentIdGenerator; import org.apache.nifi.util.FormatUtils; import org.apache.nifi.util.NiFiProperties; import org.apache.nifi.web.security.ProxiedEntitiesUtils; import org.apache.nifi.web.security.jwt.JwtAuthenticationFilter; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.filter.EncodingFilter; +import org.glassfish.jersey.message.GZipEncoder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.ws.rs.HttpMethod; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import java.net.URI; import java.net.URISyntaxException; @@ -62,6 +66,7 @@ import java.util.HashSet; import java.util.List; import java.util.LongSummaryStatistics; import java.util.Map; +import java.util.Map.Entry; import java.util.Objects; import java.util.Set; import java.util.UUID; @@ -157,9 +162,9 @@ public class ThreadPoolRequestReplicator implements RequestReplicator { this.callback = callback; this.nifiProperties = nifiProperties; - client.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, connectionTimeoutMs); - client.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, readTimeoutMs); - client.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, Boolean.TRUE); + client.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeoutMs); + client.property(ClientProperties.READ_TIMEOUT, readTimeoutMs); + client.property(ClientProperties.FOLLOW_REDIRECTS, Boolean.TRUE); final AtomicInteger threadId = new AtomicInteger(0); final ThreadFactory threadFactory = r -> { @@ -546,7 +551,7 @@ public class ThreadPoolRequestReplicator implements RequestReplicator { // Check that all nodes responded successfully. for (final NodeResponse response : nodeResponses) { if (response.getStatus() != NODE_CONTINUE_STATUS_CODE) { - final ClientResponse clientResponse = response.getClientResponse(); + final Response clientResponse = response.getClientResponse(); final String message; if (clientResponse == null) { @@ -555,7 +560,7 @@ public class ThreadPoolRequestReplicator implements RequestReplicator { logger.info("Received a status of {} from {} for request {} {} when performing first stage of two-stage commit. The action will not occur", response.getStatus(), response.getNodeId(), method, uri.getPath()); } else { - final String nodeExplanation = clientResponse.getEntity(String.class); + final String nodeExplanation = clientResponse.readEntity(String.class); message = "Node " + response.getNodeId() + " is unable to fulfill this request due to: " + nodeExplanation; logger.info("Received a status of {} from {} for request {} {} when performing first stage of two-stage commit. " @@ -627,38 +632,18 @@ public class ThreadPoolRequestReplicator implements RequestReplicator { } // Visible for testing - overriding this method makes it easy to verify behavior without actually making any web requests - protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method, final URI uri, final String requestId, + protected NodeResponse replicateRequest(final Invocation invocation, final NodeIdentifier nodeId, final String method, final URI uri, final String requestId, final Map<String, String> headers, final StandardAsyncClusterResponse clusterResponse) { - final ClientResponse clientResponse; + final Response response; final long startNanos = System.nanoTime(); logger.debug("Replicating request to {} {}, request ID = {}, headers = {}", method, uri, requestId, headers); - switch (method.toUpperCase()) { - case HttpMethod.DELETE: - clientResponse = resourceBuilder.delete(ClientResponse.class); - break; - case HttpMethod.GET: - clientResponse = resourceBuilder.get(ClientResponse.class); - break; - case HttpMethod.HEAD: - clientResponse = resourceBuilder.head(); - break; - case HttpMethod.OPTIONS: - clientResponse = resourceBuilder.options(ClientResponse.class); - break; - case HttpMethod.POST: - clientResponse = resourceBuilder.post(ClientResponse.class); - break; - case HttpMethod.PUT: - clientResponse = resourceBuilder.put(ClientResponse.class); - break; - default: - throw new IllegalArgumentException("HTTP Method '" + method + "' not supported for request replication."); - } + // invoke the request + response = invocation.invoke(); final long nanos = System.nanoTime() - startNanos; clusterResponse.addTiming("Perform HTTP Request", nodeId.toString(), nanos); - final NodeResponse nodeResponse = new NodeResponse(nodeId, method, uri, clientResponse, System.nanoTime() - startNanos, requestId); + final NodeResponse nodeResponse = new NodeResponse(nodeId, method, uri, response, System.nanoTime() - startNanos, requestId); if (nodeResponse.is2xx()) { final int length = nodeResponse.getClientResponse().getLength(); if (length > 0) { @@ -823,6 +808,7 @@ public class ThreadPoolRequestReplicator implements RequestReplicator { private final NodeRequestCompletionCallback callback; private final StandardAsyncClusterResponse clusterResponse; private final long creationNanos = System.nanoTime(); + private final GZipEncoder gzipEncoder = new GZipEncoder(); private NodeHttpRequest(final NodeIdentifier nodeId, final String method, final URI uri, final Object entity, final Map<String, String> headers, final NodeRequestCompletionCallback callback, final StandardAsyncClusterResponse clusterResponse) { @@ -844,12 +830,30 @@ public class ThreadPoolRequestReplicator implements RequestReplicator { NodeResponse nodeResponse; try { + final String rawAcceptEncoding = headers.get(HttpHeaders.ACCEPT_ENCODING); + + final boolean useGzip; + if (rawAcceptEncoding == null) { + useGzip = false; + } else { + final String[] acceptEncodingTokens = rawAcceptEncoding.split(","); + final Set<String> acceptEncoding = Stream.of(acceptEncodingTokens) + .map(String::trim) + .filter(enc -> StringUtils.isNotEmpty(enc)) + .map(String::toLowerCase) + .collect(Collectors.toSet()); + + final Set<String> supportedEncodings = gzipEncoder.getSupportedEncodings(); + useGzip = supportedEncodings.stream() + .anyMatch(supportedEncoding -> acceptEncoding.contains(supportedEncoding.toLowerCase())); + } + // create and send the request - final WebResource.Builder resourceBuilder = createResourceBuilder(); + final Invocation invocation = createInvocation(useGzip); final String requestId = headers.get("x-nifi-request-id"); logger.debug("Replicating request {} {} to {}", method, uri.getPath(), nodeId); - nodeResponse = replicateRequest(resourceBuilder, nodeId, method, uri, requestId, headers, clusterResponse); + nodeResponse = replicateRequest(invocation, nodeId, method, uri, requestId, headers, clusterResponse); } catch (final Exception e) { nodeResponse = new NodeResponse(nodeId, method, uri, e); logger.warn("Failed to replicate request {} {} to {} due to {}", method, uri.getPath(), nodeId, e.toString()); @@ -862,52 +866,64 @@ public class ThreadPoolRequestReplicator implements RequestReplicator { } } - - @SuppressWarnings({"rawtypes", "unchecked"}) - private WebResource.Builder createResourceBuilder() { + private Invocation createInvocation(final boolean useGzip) { // convert parameters to a more convenient data structure - final MultivaluedMap<String, String> map = new MultivaluedMapImpl(); + final MultivaluedHashMap<String, String> map = new MultivaluedHashMap(); if (entity instanceof MultivaluedMap) { map.putAll((Map) entity); } // create the resource - WebResource resource = client.resource(uri); + WebTarget webTarget = client.target(uri); - if (responseMapper.isResponseInterpreted(uri, method)) { - resource.addFilter(new GZIPContentEncodingFilter(false)); + if (useGzip) { + webTarget = webTarget.register(EncodingFilter.class).register(gzipEncoder); } + final Invocation invocation; + // set the parameters as either query parameters or as request body - final WebResource.Builder builder; if (HttpMethod.DELETE.equalsIgnoreCase(method) || HttpMethod.HEAD.equalsIgnoreCase(method) || HttpMethod.GET.equalsIgnoreCase(method) || HttpMethod.OPTIONS.equalsIgnoreCase(method)) { - resource = resource.queryParams(map); - builder = resource.getRequestBuilder(); - } else { - if (entity == null) { - builder = resource.entity(map); - } else { - builder = resource.entity(entity); + for (final Entry<String, List<String>> queryEntry : map.entrySet()) { + webTarget = webTarget.queryParam(queryEntry.getKey(), queryEntry.getValue().toArray()); } - } - // set headers - boolean foundContentType = false; - for (final Map.Entry<String, String> entry : headers.entrySet()) { - builder.header(entry.getKey(), entry.getValue()); - if (entry.getKey().equalsIgnoreCase("content-type")) { - foundContentType = true; + Invocation.Builder builder = webTarget.request(); + for (final Map.Entry<String, String> entry : headers.entrySet()) { + builder = builder.header(entry.getKey(), entry.getValue()); + } + + invocation = builder.build(method); + } else { + Invocation.Builder builder = webTarget.request(); + + // detect the content type + String contentType = null; + for (final Map.Entry<String, String> entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + + // record the content type + if (entry.getKey().equalsIgnoreCase("content-type")) { + contentType = entry.getValue(); + } + + // never break } - } - // set default content type - if (!foundContentType) { // set default content type - builder.type(MediaType.APPLICATION_FORM_URLENCODED); + if (contentType == null) { + contentType = MediaType.APPLICATION_FORM_URLENCODED; + } + + if (entity == null) { + invocation = builder.build(method, Entity.entity(map, contentType)); + } else { + invocation = builder.build(method, Entity.entity(entity, contentType)); + } } - return builder; + return invocation; } }
