Repository: nifi Updated Branches: refs/heads/master d8d29811f -> 7c5bd876b
http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java index 091f00e..1fd4d32 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java @@ -24,8 +24,6 @@ import com.sun.jersey.api.client.ClientResponse.Status; import com.sun.jersey.api.client.UniformInterfaceException; import java.io.File; import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -91,10 +89,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { private final String id; - private final URI targetUri; - private final URI apiUri; - private final String host; - private final String protocol; + private final String targetUris; private final ProcessScheduler scheduler; private final EventReporter eventReporter; private final NiFiProperties nifiProperties; @@ -136,30 +131,18 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { private final ScheduledExecutorService backgroundThreadExecutor; - public StandardRemoteProcessGroup(final String id, final String targetUri, final ProcessGroup processGroup, - final FlowController flowController, final SSLContext sslContext, final NiFiProperties nifiProperties) { + public StandardRemoteProcessGroup(final String id, final String targetUris, final ProcessGroup processGroup, + final FlowController flowController, final SSLContext sslContext, final NiFiProperties nifiProperties) { this.nifiProperties = nifiProperties; this.id = requireNonNull(id); this.flowController = requireNonNull(flowController); - final URI uri; - try { - uri = new URI(requireNonNull(targetUri.trim())); - - final String apiPath = SiteToSiteRestApiClient.resolveBaseUrl(uri); - - apiUri = new URI(apiPath); - } catch (final URISyntaxException e) { - throw new IllegalArgumentException(e); - } - this.host = uri.getHost(); - this.protocol = uri.getAuthority(); - this.targetUri = uri; + this.targetUris = targetUris; this.targetId = null; this.processGroup = new AtomicReference<>(processGroup); this.sslContext = sslContext; this.scheduler = flowController.getProcessScheduler(); - this.authorizationIssue = "Establishing connection to " + targetUri; + this.authorizationIssue = "Establishing connection to " + targetUris; final BulletinRepository bulletinRepository = flowController.getBulletinRepository(); eventReporter = new EventReporter() { @@ -176,7 +159,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { }; final Runnable checkAuthorizations = new InitializationTask(); - backgroundThreadExecutor = new FlowEngine(1, "Remote Process Group " + id + ": " + targetUri); + backgroundThreadExecutor = new FlowEngine(1, "Remote Process Group " + id + ": " + targetUris); backgroundThreadExecutor.scheduleWithFixedDelay(checkAuthorizations, 5L, 30L, TimeUnit.SECONDS); } @@ -298,14 +281,10 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { return targetId; } - public String getProtocol() { - return protocol; - } - @Override public String getName() { final String name = this.name.get(); - return name == null ? targetUri.toString() : name; + return name == null ? getTargetUri() : name; } @Override @@ -361,17 +340,18 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { } @Override - public URI getTargetUri() { - return targetUri; + public String getTargetUri() { + return SiteToSiteRestApiClient.getFirstUrl(targetUris); } @Override - public String getAuthorizationIssue() { - return authorizationIssue; + public String getTargetUris() { + return targetUris; } - public String getHost() { - return host; + @Override + public String getAuthorizationIssue() { + return authorizationIssue; } public int getInputPortCount() { @@ -739,7 +719,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { @Override public String toString() { - return "RemoteProcessGroup[" + targetUri + "]"; + return "RemoteProcessGroup[" + targetUris + "]"; } @Override @@ -786,7 +766,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { // perform the request final ControllerDTO dto; try (final SiteToSiteRestApiClient apiClient = getSiteToSiteRestApiClient()) { - dto = apiClient.getController(); + dto = apiClient.getController(targetUris); } catch (IOException e) { writeLock.lock(); try { @@ -807,7 +787,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { writeLock.unlock(); } - throw new CommunicationsException("Unable to communicate with Remote NiFi at URI " + getApiUri() + " due to: " + e.getMessage()); + throw new CommunicationsException("Unable to communicate with Remote NiFi at URI " + targetUris + " due to: " + e.getMessage()); } writeLock.lock(); @@ -878,16 +858,11 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { private SiteToSiteRestApiClient getSiteToSiteRestApiClient() { SiteToSiteRestApiClient apiClient = new SiteToSiteRestApiClient(sslContext, new HttpProxy(proxyHost, proxyPort, proxyUser, proxyPassword), getEventReporter()); - apiClient.setBaseUrl(getApiUri()); apiClient.setConnectTimeoutMillis(getCommunicationsTimeout(TimeUnit.MILLISECONDS)); apiClient.setReadTimeoutMillis(getCommunicationsTimeout(TimeUnit.MILLISECONDS)); return apiClient; } - protected String getApiUri() { - return apiUri.toString(); - } - /** * Converts a set of ports into a set of remote process group ports. * @@ -1092,10 +1067,6 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { } } - private boolean isWebApiSecure() { - return targetUri.toString().toLowerCase().startsWith("https"); - } - @Override public boolean isSiteToSiteEnabled() { readLock.lock(); @@ -1117,7 +1088,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { public void run() { try (final SiteToSiteRestApiClient apiClient = getSiteToSiteRestApiClient()) { try { - final ControllerDTO dto = apiClient.getController(); + final ControllerDTO dto = apiClient.getController(targetUris); if (dto.getRemoteSiteListeningPort() == null && SiteToSiteTransportProtocol.RAW.equals(transportProtocol)) { authorizationIssue = "Remote instance is not configured to allow RAW Site-to-Site communications at this time."; @@ -1140,8 +1111,9 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { if (e.getResponseCode() == UNAUTHORIZED_STATUS_CODE) { try { // attempt to issue a registration request in case the target instance is a 0.x - final RemoteNiFiUtils utils = new RemoteNiFiUtils(isWebApiSecure() ? sslContext : null); - final ClientResponse requestAccountResponse = utils.issueRegistrationRequest(apiUri.toString()); + final boolean isApiSecure = apiClient.getBaseUrl().toLowerCase().startsWith("https"); + final RemoteNiFiUtils utils = new RemoteNiFiUtils(isApiSecure ? sslContext : null); + final ClientResponse requestAccountResponse = utils.issueRegistrationRequest(apiClient.getBaseUrl()); if (Response.Status.Family.SUCCESSFUL.equals(requestAccountResponse.getStatusInfo().getFamily())) { logger.info("{} Issued a Request to communicate with remote instance", this); } else { @@ -1169,7 +1141,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { } catch (final Exception e) { logger.warn(String.format("Unable to connect to %s due to %s", StandardRemoteProcessGroup.this, e)); getEventReporter().reportEvent(Severity.WARNING, "Site to Site", String.format("Unable to connect to %s due to %s", - StandardRemoteProcessGroup.this.getTargetUri().toString(), e)); + StandardRemoteProcessGroup.this.getTargetUris(), e)); } } } http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/remote/TestStandardRemoteProcessGroup.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/remote/TestStandardRemoteProcessGroup.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/remote/TestStandardRemoteProcessGroup.java deleted file mode 100644 index 69d38e9..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/remote/TestStandardRemoteProcessGroup.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.nifi.remote; - -import static org.junit.Assert.assertEquals; - -import org.apache.nifi.controller.FlowController; -import org.apache.nifi.groups.ProcessGroup; -import org.apache.nifi.util.NiFiProperties; -import org.junit.Test; -import org.mockito.Mockito; - -public class TestStandardRemoteProcessGroup { - - @Test - public void testApiUri() { - final NiFiProperties properties = Mockito.mock(NiFiProperties.class); - final FlowController controller = Mockito.mock(FlowController.class); - final ProcessGroup group = Mockito.mock(ProcessGroup.class); - - final String expectedUri = "http://localhost:8080/nifi-api"; - StandardRemoteProcessGroup rpg = new StandardRemoteProcessGroup("id", "http://localhost:8080/nifi", group, controller, null, properties); - assertEquals(expectedUri, rpg.getApiUri()); - - rpg = new StandardRemoteProcessGroup("id", "http://localhost:8080/nifi/", group, controller, null, properties); - assertEquals(expectedUri, rpg.getApiUri()); - - rpg = new StandardRemoteProcessGroup("id", "http://localhost:8080/nifi/ ", group, controller, null, properties); - assertEquals(expectedUri, rpg.getApiUri()); - - rpg = new StandardRemoteProcessGroup("id", " http://localhost:8080/nifi/ ", group, controller, null, properties); - assertEquals(expectedUri, rpg.getApiUri()); - - rpg = new StandardRemoteProcessGroup("id", "http://localhost:8080/", group, controller, null, properties); - assertEquals(expectedUri, rpg.getApiUri()); - - rpg = new StandardRemoteProcessGroup("id", "http://localhost:8080", group, controller, null, properties); - assertEquals(expectedUri, rpg.getApiUri()); - - rpg = new StandardRemoteProcessGroup("id", "http://localhost:8080 ", group, controller, null, properties); - assertEquals(expectedUri, rpg.getApiUri()); - } - -} http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java index 48d60d6..3a23601 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java @@ -49,6 +49,7 @@ import org.apache.nifi.remote.exception.ProtocolException; import org.apache.nifi.remote.exception.UnknownPortException; import org.apache.nifi.remote.protocol.DataPacket; import org.apache.nifi.remote.protocol.http.HttpProxy; +import org.apache.nifi.remote.util.SiteToSiteRestApiClient; import org.apache.nifi.remote.util.StandardDataPacket; import org.apache.nifi.reporting.Severity; import org.apache.nifi.scheduling.SchedulingStrategy; @@ -143,7 +144,7 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { final long penalizationMillis = FormatUtils.getTimeDuration(remoteGroup.getYieldDuration(), TimeUnit.MILLISECONDS); final SiteToSiteClient client = new SiteToSiteClient.Builder() - .url(remoteGroup.getTargetUri().toString()) + .urls(SiteToSiteRestApiClient.parseClusterUrls(remoteGroup.getTargetUris())) .portIdentifier(getIdentifier()) .sslContext(sslContext) .useCompression(isUseCompression()) @@ -169,7 +170,7 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { return; } - final String url = getRemoteProcessGroup().getTargetUri().toString(); + final String url = getRemoteProcessGroup().getTargetUri(); // If we are sending data, we need to ensure that we have at least 1 FlowFile to send. Otherwise, // we don't want to create a transaction at all. @@ -433,7 +434,7 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { @Override public String toString() { - return "RemoteGroupPort[name=" + getName() + ",target=" + remoteGroup.getTargetUri().toString() + "]"; + return "RemoteGroupPort[name=" + getName() + ",targets=" + remoteGroup.getTargetUris() + "]"; } @Override http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/TestStandardRemoteGroupPort.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/TestStandardRemoteGroupPort.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/TestStandardRemoteGroupPort.java index b44f118..23d3fda 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/TestStandardRemoteGroupPort.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/TestStandardRemoteGroupPort.java @@ -39,7 +39,6 @@ import org.junit.BeforeClass; import org.junit.Test; import java.io.InputStream; -import java.net.URI; import java.nio.channels.SocketChannel; import java.util.HashMap; import java.util.Map; @@ -108,7 +107,7 @@ public class TestStandardRemoteGroupPort { doReturn(true).when(remoteGroup).isTransmitting(); doReturn(protocol).when(remoteGroup).getTransportProtocol(); - doReturn(new URI(REMOTE_CLUSTER_URL)).when(remoteGroup).getTargetUri(); + doReturn(REMOTE_CLUSTER_URL).when(remoteGroup).getTargetUri(); doReturn(siteToSiteClient).when(port).getSiteToSiteClient(); doReturn(transaction).when(siteToSiteClient).createTransaction(eq(direction)); doReturn(eventReporter).when(remoteGroup).getEventReporter(); http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java index d9a5df6..e119437 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java @@ -236,7 +236,7 @@ public class RemoteProcessGroupAuditor extends NiFiAuditor { // create the remote process group details FlowChangeRemoteProcessGroupDetails remoteProcessGroupDetails = new FlowChangeRemoteProcessGroupDetails(); - remoteProcessGroupDetails.setUri(remoteProcessGroup.getTargetUri().toString()); + remoteProcessGroupDetails.setUri(remoteProcessGroup.getTargetUri()); // save the actions if necessary if (!details.isEmpty()) { http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java index 8b9366f..5809a06 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java @@ -36,6 +36,7 @@ import org.apache.nifi.authorization.TemplateAuthorizable; import org.apache.nifi.authorization.resource.Authorizable; import org.apache.nifi.authorization.user.NiFiUser; import org.apache.nifi.authorization.user.NiFiUserUtils; +import org.apache.nifi.remote.util.SiteToSiteRestApiClient; import org.apache.nifi.web.NiFiServiceFacade; import org.apache.nifi.web.ResourceNotFoundException; import org.apache.nifi.web.Revision; @@ -1356,31 +1357,12 @@ public class ProcessGroupResource extends ApplicationResource { // set the processor id as appropriate remoteProcessGroupDTO.setId(generateUuid()); - // parse the uri - final URI uri; - try { - uri = URI.create(remoteProcessGroupDTO.getTargetUri()); - } catch (final IllegalArgumentException e) { - throw new IllegalArgumentException("The specified remote process group URL is malformed: " + remoteProcessGroupDTO.getTargetUri()); - } - - // validate each part of the uri - if (uri.getScheme() == null || uri.getHost() == null) { - throw new IllegalArgumentException("The specified remote process group URL is malformed: " + remoteProcessGroupDTO.getTargetUri()); - } - - if (!(uri.getScheme().equalsIgnoreCase("http") || uri.getScheme().equalsIgnoreCase("https"))) { - throw new IllegalArgumentException("The specified remote process group URL is invalid because it is not http or https: " + remoteProcessGroupDTO.getTargetUri()); - } - - // normalize the uri to the other controller - String controllerUri = uri.toString(); - if (controllerUri.endsWith("/")) { - controllerUri = StringUtils.substringBeforeLast(controllerUri, "/"); - } + // parse the uri to check if the uri is valid + final String targetUris = remoteProcessGroupDTO.getTargetUris(); + SiteToSiteRestApiClient.parseClusterUrls(targetUris); - // since the uri is valid, use the normalized version - remoteProcessGroupDTO.setTargetUri(controllerUri); + // since the uri is valid, use it + remoteProcessGroupDTO.setTargetUris(targetUris); // create the remote process group final Revision revision = getRevision(remoteProcessGroupEntity, remoteProcessGroupDTO.getId()); http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java index 3f48128..ec0392d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java @@ -1533,7 +1533,7 @@ public final class DtoFactory { dto.setCommunicationsTimeout(group.getCommunicationsTimeout()); dto.setYieldDuration(group.getYieldDuration()); dto.setParentGroupId(group.getProcessGroup().getIdentifier()); - dto.setTargetUri(group.getTargetUri().toString()); + dto.setTargetUris(group.getTargetUris()); dto.setFlowRefreshed(group.getLastRefreshTime()); dto.setContents(contents); dto.setTransportProtocol(group.getTransportProtocol().name()); @@ -2857,7 +2857,7 @@ public final class DtoFactory { copy.setActiveRemoteOutputPortCount(original.getActiveRemoteOutputPortCount()); copy.setInactiveRemoteOutputPortCount(original.getInactiveRemoteOutputPortCount()); copy.setParentGroupId(original.getParentGroupId()); - copy.setTargetUri(original.getTargetUri()); + copy.setTargetUris(original.getTargetUris()); copy.setTransportProtocol(original.getTransportProtocol()); copy.setProxyHost(original.getProxyHost()); copy.setProxyPort(original.getProxyPort()); http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java index 30fcbd7..2db2bbe 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java @@ -1805,7 +1805,7 @@ public class ControllerFacade implements Authorizable { addIfAppropriate(searchStr, group.getIdentifier(), "Id", matches); addIfAppropriate(searchStr, group.getName(), "Name", matches); addIfAppropriate(searchStr, group.getComments(), "Comments", matches); - addIfAppropriate(searchStr, group.getTargetUri().toString(), "URL", matches); + addIfAppropriate(searchStr, group.getTargetUris(), "URLs", matches); // consider the transmission status if ((StringUtils.containsIgnoreCase("transmitting", searchStr) || StringUtils.containsIgnoreCase("transmission enabled", searchStr)) && group.isTransmitting()) { http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardRemoteProcessGroupDAO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardRemoteProcessGroupDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardRemoteProcessGroupDAO.java index bf4c96e..d022b15 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardRemoteProcessGroupDAO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardRemoteProcessGroupDAO.java @@ -75,13 +75,13 @@ public class StandardRemoteProcessGroupDAO extends ComponentDAO implements Remot throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Remote Process Group is being added."); } - final String rawTargetUri = remoteProcessGroupDTO.getTargetUri(); - if (rawTargetUri == null) { - throw new IllegalArgumentException("Cannot add a Remote Process Group without specifying the Target URI"); + final String targetUris = remoteProcessGroupDTO.getTargetUris(); + if (targetUris == null || targetUris.length() == 0) { + throw new IllegalArgumentException("Cannot add a Remote Process Group without specifying the Target URI(s)"); } // create the remote process group - RemoteProcessGroup remoteProcessGroup = flowController.createRemoteProcessGroup(remoteProcessGroupDTO.getId(), rawTargetUri); + RemoteProcessGroup remoteProcessGroup = flowController.createRemoteProcessGroup(remoteProcessGroupDTO.getId(), targetUris); // set other properties updateRemoteProcessGroup(remoteProcessGroup, remoteProcessGroupDTO); http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-remote-process-group-dialog.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-remote-process-group-dialog.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-remote-process-group-dialog.jsp index ab6c3ae..4af046e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-remote-process-group-dialog.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-remote-process-group-dialog.jsp @@ -18,9 +18,11 @@ <div id="new-remote-process-group-dialog" class="hidden large-dialog"> <div class="dialog-content"> <div class="setting"> - <div class="setting-name">URL</div> + <div class="setting-name">URLs + <div class="fa fa-question-circle" alt="Info" title="Specify the remote target NiFi URLs. Multiple URLs can be specified in comma-separated format. Different protocols cannot be mixed. If remote NiFi is a cluster, two or more node URLs are recommended for better connection establishment availability."></div> + </div> <div class="setting-field"> - <input id="new-remote-process-group-uri" type="text" placeholder="https://remotehost:8080/nifi"/> + <input id="new-remote-process-group-uris" type="text" placeholder="https://remotehost:8080/nifi"/> </div> </div> <div class="setting"> http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-configuration.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-configuration.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-configuration.jsp index 8ad6a73..c8af6d3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-configuration.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-configuration.jsp @@ -30,9 +30,9 @@ </div> </div> <div class="setting"> - <div class="setting-name">URL</div> + <div class="setting-name">URLs</div> <div class="setting-field"> - <span id="remote-process-group-url"></span> + <span id="remote-process-group-urls"></span> </div> </div> <div class="setting"> http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-details.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-details.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-details.jsp index e368d46..6f7f992 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-details.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-details.jsp @@ -30,9 +30,9 @@ </div> </div> <div class="setting"> - <div class="setting-name">URL</div> + <div class="setting-name">URLs</div> <div class="setting-field"> - <span id="read-only-remote-process-group-url"></span> + <span id="read-only-remote-process-group-urls"></span> </div> </div> <div class="setting"> http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-ports.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-ports.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-ports.jsp index 8899f33..672800c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-ports.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/remote-process-group-ports.jsp @@ -33,9 +33,9 @@ <div class="spacer"> </div> <div class="settings-right"> <div class="setting"> - <div class="setting-name">URL</div> + <div class="setting-name">URLs</div> <div class="setting-field"> - <span id="remote-process-group-ports-url"></span> + <span id="remote-process-group-ports-urls"></span> </div> </div> <div class="remote-port-header"> http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-remote-process-group-component.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-remote-process-group-component.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-remote-process-group-component.js index 7bf2633..90e67b6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-remote-process-group-component.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-remote-process-group-component.js @@ -34,7 +34,7 @@ nf.ng.RemoteProcessGroupComponent = function (serviceProvider) { } }), 'component': { - 'targetUri': $('#new-remote-process-group-uri').val(), + 'targetUris': $('#new-remote-process-group-uris').val(), 'position': { 'x': pt.x, 'y': pt.y @@ -125,7 +125,7 @@ nf.ng.RemoteProcessGroupComponent = function (serviceProvider) { headerText: 'Add Remote Process Group', handler: { close: function () { - $('#new-remote-process-group-uri').val(''); + $('#new-remote-process-group-uris').val(''); $('#new-remote-process-group-timeout').val(defaultTimeout); $('#new-remote-process-group-yield-duration').val(defaultYieldDuration); $('#new-remote-process-group-transport-protocol-combo').combo('setSelectedOption', { @@ -265,7 +265,7 @@ nf.ng.RemoteProcessGroupComponent = function (serviceProvider) { this.modal.show(); // set the focus and key handlers - $('#new-remote-process-group-uri').focus().off('keyup').on('keyup', function (e) { + $('#new-remote-process-group-uris').focus().off('keyup').on('keyup', function (e) { var code = e.keyCode ? e.keyCode : e.which; if (code === $.ui.keyCode.ENTER) { addRemoteProcessGroup(); http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-configuration.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-configuration.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-configuration.js index 6a33af7..ece8be6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-configuration.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-configuration.js @@ -106,7 +106,7 @@ nf.RemoteProcessGroupConfiguration = (function () { // clear the remote process group details $('#remote-process-group-id').text(''); $('#remote-process-group-name').text(''); - $('#remote-process-group-url').text(''); + $('#remote-process-group-urls').text(''); $('#remote-process-group-timeout').val(''); $('#remote-process-group-yield-duration').val(''); $('#remote-process-group-transport-protocol-combo').combo('setSelectedOption', { @@ -144,7 +144,7 @@ nf.RemoteProcessGroupConfiguration = (function () { // populate the port settings $('#remote-process-group-id').text(selectionData.id); $('#remote-process-group-name').text(selectionData.component.name); - $('#remote-process-group-url').text(selectionData.component.targetUri); + $('#remote-process-group-urls').text(selectionData.component.targetUris); // populate the text fields $('#remote-process-group-timeout').val(selectionData.component.communicationsTimeout); http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-details.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-details.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-details.js index d757496..ebe116c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-details.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-details.js @@ -41,7 +41,7 @@ nf.RemoteProcessGroupDetails = (function () { // clear the remote process group details nf.Common.clearField('read-only-remote-process-group-id'); nf.Common.clearField('read-only-remote-process-group-name'); - nf.Common.clearField('read-only-remote-process-group-url'); + nf.Common.clearField('read-only-remote-process-group-urls'); nf.Common.clearField('read-only-remote-process-group-timeout'); nf.Common.clearField('read-only-remote-process-group-yield-duration'); nf.Common.clearField('read-only-remote-process-group-transport-protocol'); @@ -67,7 +67,7 @@ nf.RemoteProcessGroupDetails = (function () { // populate the port settings nf.Common.populateField('read-only-remote-process-group-id', selectionData.id); nf.Common.populateField('read-only-remote-process-group-name', selectionData.component.name); - nf.Common.populateField('read-only-remote-process-group-url', selectionData.component.targetUri); + nf.Common.populateField('read-only-remote-process-group-urls', selectionData.component.targetUris); nf.Common.populateField('read-only-remote-process-group-timeout', selectionData.component.communicationsTimeout); nf.Common.populateField('read-only-remote-process-group-yield-duration', selectionData.component.yieldDuration); nf.Common.populateField('read-only-remote-process-group-transport-protocol', selectionData.component.transportProtocol); http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js index 634a65f..529cda7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js @@ -179,7 +179,7 @@ nf.RemoteProcessGroupPorts = (function () { // clear the remote process group details $('#remote-process-group-ports-id').text(''); $('#remote-process-group-ports-name').text(''); - $('#remote-process-group-ports-url').text(''); + $('#remote-process-group-ports-urls').text(''); // clear any tooltips var dialog = $('#remote-process-group-ports'); @@ -484,7 +484,7 @@ nf.RemoteProcessGroupPorts = (function () { // populate the port settings $('#remote-process-group-ports-id').text(remoteProcessGroup.id); $('#remote-process-group-ports-name').text(remoteProcessGroup.name); - $('#remote-process-group-ports-url').text(remoteProcessGroup.targetUri); + $('#remote-process-group-ports-urls').text(remoteProcessGroup.targetUris); // get the contents var remoteProcessGroupContents = remoteProcessGroup.contents; http://git-wip-us.apache.org/repos/asf/nifi/blob/7c5bd876/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js index 6e14bf6..1903e44 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js @@ -499,7 +499,7 @@ nf.RemoteProcessGroup = (function () { remoteProcessGroupUri.text(null).selectAll('title').remove(); // apply ellipsis to the remote process group name as necessary - nf.CanvasUtils.ellipsis(remoteProcessGroupUri, d.component.targetUri); + nf.CanvasUtils.ellipsis(remoteProcessGroupUri, d.component.targetUris); }).append('title').text(function (d) { return d.component.name; });
