mirror of https://github.com/apache/nifi.git
NIFI-2635:
- Fixing contrib check issues. - Clean up pom. - Addressing issue where reporting task property descriptor using wrong scope. NIFI-2635: - Fixing issue with revisions when creating users and user groups. - Forwarding requests to the coordinator instead of replicating. - Tweaking verbage in dialog for removing users and groups. This closes #943
This commit is contained in:
parent
1745c1274b
commit
a6133d4ce3
|
@ -34,10 +34,6 @@
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.jersey</groupId>
|
|
||||||
<artifactId>jersey-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.jersey</groupId>
|
<groupId>com.sun.jersey</groupId>
|
||||||
<artifactId>jersey-client</artifactId>
|
<artifactId>jersey-client</artifactId>
|
||||||
|
|
|
@ -18,7 +18,9 @@ package org.apache.nifi.web.api.entity;
|
||||||
|
|
||||||
import org.apache.nifi.web.api.dto.BulletinDTO;
|
import org.apache.nifi.web.api.dto.BulletinDTO;
|
||||||
import org.apache.nifi.web.api.dto.ReadablePermission;
|
import org.apache.nifi.web.api.dto.ReadablePermission;
|
||||||
|
import org.apache.nifi.web.api.dto.util.TimeAdapter;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,6 +86,7 @@ public class BulletinEntity extends Entity implements ReadablePermission {
|
||||||
/**
|
/**
|
||||||
* @return When this bulletin was generated.
|
* @return When this bulletin was generated.
|
||||||
*/
|
*/
|
||||||
|
@XmlJavaTypeAdapter(TimeAdapter.class)
|
||||||
public Date getTimestamp() {
|
public Date getTimestamp() {
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,6 @@ public interface RequestReplicator {
|
||||||
* @param entity an entity
|
* @param entity an entity
|
||||||
* @param headers any HTTP headers
|
* @param headers any HTTP headers
|
||||||
* @return an AsyncClusterResponse that indicates the current status of the request and provides an identifier for obtaining an updated response later
|
* @return an AsyncClusterResponse that indicates the current status of the request and provides an identifier for obtaining an updated response later
|
||||||
*
|
|
||||||
* @throws ConnectingNodeMutableRequestException if the request attempts to modify the flow and there is a node that is in the CONNECTING state
|
* @throws ConnectingNodeMutableRequestException if the request attempts to modify the flow and there is a node that is in the CONNECTING state
|
||||||
* @throws DisconnectedNodeMutableRequestException if the request attempts to modify the flow and there is a node that is in the DISCONNECTED state
|
* @throws DisconnectedNodeMutableRequestException if the request attempts to modify the flow and there is a node that is in the DISCONNECTED state
|
||||||
*/
|
*/
|
||||||
|
@ -92,7 +91,7 @@ public interface RequestReplicator {
|
||||||
/**
|
/**
|
||||||
* Requests are sent to each node in the given set of Node Identifiers. The returned AsyncClusterResponse object will contain
|
* Requests are sent to each node in the given set of Node Identifiers. The returned AsyncClusterResponse object will contain
|
||||||
* the results that are immediately available, as well as an identifier for obtaining an updated result later.
|
* the results that are immediately available, as well as an identifier for obtaining an updated result later.
|
||||||
*
|
* <p>
|
||||||
* HTTP DELETE, GET, HEAD, and OPTIONS methods will throw an IllegalArgumentException if used.
|
* HTTP DELETE, GET, HEAD, and OPTIONS methods will throw an IllegalArgumentException if used.
|
||||||
*
|
*
|
||||||
* @param nodeIds the node identifiers
|
* @param nodeIds the node identifiers
|
||||||
|
@ -105,7 +104,6 @@ public interface RequestReplicator {
|
||||||
* @param performVerification if <code>true</code>, and the request is mutable, will verify that all nodes are connected before
|
* @param performVerification if <code>true</code>, and the request is mutable, will verify that all nodes are connected before
|
||||||
* making the request and that all nodes are able to perform the request before acutally attempting to perform the task.
|
* making the request and that all nodes are able to perform the request before acutally attempting to perform the task.
|
||||||
* If false, will perform no such verification
|
* If false, will perform no such verification
|
||||||
*
|
|
||||||
* @return an AsyncClusterResponse that indicates the current status of the request and provides an identifier for obtaining an updated response later
|
* @return an AsyncClusterResponse that indicates the current status of the request and provides an identifier for obtaining an updated response later
|
||||||
*/
|
*/
|
||||||
AsyncClusterResponse replicate(Set<NodeIdentifier> nodeIds, String method, URI uri, Object entity, Map<String, String> headers, boolean indicateReplicated, boolean performVerification);
|
AsyncClusterResponse replicate(Set<NodeIdentifier> nodeIds, String method, URI uri, Object entity, Map<String, String> headers, boolean indicateReplicated, boolean performVerification);
|
||||||
|
@ -119,7 +117,6 @@ public interface RequestReplicator {
|
||||||
* @param uri the base request URI (up to, but not including, the query string)
|
* @param uri the base request URI (up to, but not including, the query string)
|
||||||
* @param entity an entity
|
* @param entity an entity
|
||||||
* @param headers any HTTP headers
|
* @param headers any HTTP headers
|
||||||
*
|
|
||||||
* @return an AsyncClusterResponse that indicates the current status of the request and provides an identifier for obtaining an updated response later
|
* @return an AsyncClusterResponse that indicates the current status of the request and provides an identifier for obtaining an updated response later
|
||||||
*/
|
*/
|
||||||
AsyncClusterResponse forwardToCoordinator(NodeIdentifier coordinatorNodeId, String method, URI uri, Object entity, Map<String, String> headers);
|
AsyncClusterResponse forwardToCoordinator(NodeIdentifier coordinatorNodeId, String method, URI uri, Object entity, Map<String, String> headers);
|
||||||
|
|
|
@ -283,7 +283,6 @@ public class ThreadPoolRequestReplicator implements RequestReplicator {
|
||||||
* @param performVerification whether or not to verify that all nodes in the cluster are connected and that all nodes can perform request. Ignored if request is not mutable.
|
* @param performVerification whether or not to verify that all nodes in the cluster are connected and that all nodes can perform request. Ignored if request is not mutable.
|
||||||
* @param response the response to update with the results
|
* @param response the response to update with the results
|
||||||
* @param executionPhase <code>true</code> if this is the execution phase, <code>false</code> otherwise
|
* @param executionPhase <code>true</code> if this is the execution phase, <code>false</code> otherwise
|
||||||
*
|
|
||||||
* @return an AsyncClusterResponse that can be used to obtain the result
|
* @return an AsyncClusterResponse that can be used to obtain the result
|
||||||
*/
|
*/
|
||||||
private AsyncClusterResponse replicate(Set<NodeIdentifier> nodeIds, String method, URI uri, Object entity, Map<String, String> headers, boolean performVerification,
|
private AsyncClusterResponse replicate(Set<NodeIdentifier> nodeIds, String method, URI uri, Object entity, Map<String, String> headers, boolean performVerification,
|
||||||
|
@ -384,7 +383,6 @@ public class ThreadPoolRequestReplicator implements RequestReplicator {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void performVerification(Set<NodeIdentifier> nodeIds, String method, URI uri, Object entity, Map<String, String> headers, StandardAsyncClusterResponse clusterResponse) {
|
private void performVerification(Set<NodeIdentifier> nodeIds, String method, URI uri, Object entity, Map<String, String> headers, StandardAsyncClusterResponse clusterResponse) {
|
||||||
logger.debug("Verifying that mutable request {} {} can be made", method, uri.getPath());
|
logger.debug("Verifying that mutable request {} {} can be made", method, uri.getPath());
|
||||||
|
|
||||||
|
@ -516,9 +514,7 @@ public class ThreadPoolRequestReplicator implements RequestReplicator {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visible for testing - overriding this method makes it easy to verify behavior without actually making any web requests
|
// 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,
|
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method, final URI uri, final String requestId,
|
||||||
final NodeIdentifier nodeId, final String method,
|
|
||||||
final URI uri, final String requestId,
|
|
||||||
final Map<String, String> headers) {
|
final Map<String, String> headers) {
|
||||||
final ClientResponse clientResponse;
|
final ClientResponse clientResponse;
|
||||||
final long startNanos = System.nanoTime();
|
final long startNanos = System.nanoTime();
|
||||||
|
@ -566,7 +562,6 @@ public class ThreadPoolRequestReplicator implements RequestReplicator {
|
||||||
*
|
*
|
||||||
* @param httpMethod the HTTP Method
|
* @param httpMethod the HTTP Method
|
||||||
* @param uriPath the URI Path
|
* @param uriPath the URI Path
|
||||||
*
|
|
||||||
* @throw IllegalClusterStateException if the cluster is not in a state that allows a request to made to the given URI Path using the given HTTP Method
|
* @throw IllegalClusterStateException if the cluster is not in a state that allows a request to made to the given URI Path using the given HTTP Method
|
||||||
*/
|
*/
|
||||||
private void verifyClusterState(final String httpMethod, final String uriPath) {
|
private void verifyClusterState(final String httpMethod, final String uriPath) {
|
||||||
|
@ -662,7 +657,6 @@ public class ThreadPoolRequestReplicator implements RequestReplicator {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void replicateRequest(final Set<NodeIdentifier> nodeIds, final String scheme, final String path,
|
private void replicateRequest(final Set<NodeIdentifier> nodeIds, final String scheme, final String path,
|
||||||
final Function<NodeIdentifier, NodeHttpRequest> callableFactory, final Map<String, String> headers) {
|
final Function<NodeIdentifier, NodeHttpRequest> callableFactory, final Map<String, String> headers) {
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.nifi.cluster.coordination.http.replication;
|
package org.apache.nifi.cluster.coordination.http.replication;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertNull;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import com.sun.jersey.api.client.Client;
|
import com.sun.jersey.api.client.Client;
|
||||||
import com.sun.jersey.api.client.ClientHandlerException;
|
import com.sun.jersey.api.client.ClientHandlerException;
|
||||||
import com.sun.jersey.api.client.ClientResponse;
|
import com.sun.jersey.api.client.ClientResponse;
|
||||||
|
@ -29,19 +23,6 @@ import com.sun.jersey.api.client.ClientResponse.Status;
|
||||||
import com.sun.jersey.api.client.WebResource;
|
import com.sun.jersey.api.client.WebResource;
|
||||||
import com.sun.jersey.core.header.InBoundHeaders;
|
import com.sun.jersey.core.header.InBoundHeaders;
|
||||||
import com.sun.jersey.core.header.OutBoundHeaders;
|
import com.sun.jersey.core.header.OutBoundHeaders;
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.net.SocketTimeoutException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import javax.ws.rs.HttpMethod;
|
|
||||||
import org.apache.commons.collections4.map.MultiValueMap;
|
import org.apache.commons.collections4.map.MultiValueMap;
|
||||||
import org.apache.nifi.cluster.coordination.ClusterCoordinator;
|
import org.apache.nifi.cluster.coordination.ClusterCoordinator;
|
||||||
import org.apache.nifi.cluster.coordination.node.NodeConnectionState;
|
import org.apache.nifi.cluster.coordination.node.NodeConnectionState;
|
||||||
|
@ -62,6 +43,26 @@ import org.mockito.internal.util.reflection.Whitebox;
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
|
|
||||||
|
import javax.ws.rs.HttpMethod;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.net.SocketTimeoutException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class TestThreadPoolRequestReplicator {
|
public class TestThreadPoolRequestReplicator {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
@ -164,10 +165,8 @@ public class TestThreadPoolRequestReplicator {
|
||||||
final ThreadPoolRequestReplicator replicator
|
final ThreadPoolRequestReplicator replicator
|
||||||
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
||||||
@Override
|
@Override
|
||||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder,
|
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method,
|
||||||
final NodeIdentifier nodeId, final String method,
|
final URI uri, final String requestId, Map<String, String> givenHeaders) {
|
||||||
final URI uri, final String requestId,
|
|
||||||
Map<String, String> givenHeaders) {
|
|
||||||
// the resource builder will not expose its headers to us, so we are using Mockito's Whitebox class to extract them.
|
// the resource builder will not expose its headers to us, so we are using Mockito's Whitebox class to extract them.
|
||||||
final OutBoundHeaders headers = (OutBoundHeaders) Whitebox.getInternalState(resourceBuilder, "metadata");
|
final OutBoundHeaders headers = (OutBoundHeaders) Whitebox.getInternalState(resourceBuilder, "metadata");
|
||||||
final Object expectsHeader = headers.getFirst(ThreadPoolRequestReplicator.REQUEST_VALIDATION_HTTP_HEADER);
|
final Object expectsHeader = headers.getFirst(ThreadPoolRequestReplicator.REQUEST_VALIDATION_HTTP_HEADER);
|
||||||
|
@ -288,10 +287,8 @@ public class TestThreadPoolRequestReplicator {
|
||||||
final ThreadPoolRequestReplicator replicator
|
final ThreadPoolRequestReplicator replicator
|
||||||
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
||||||
@Override
|
@Override
|
||||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder,
|
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method,
|
||||||
final NodeIdentifier nodeId, final String method,
|
final URI uri, final String requestId, Map<String, String> givenHeaders) {
|
||||||
final URI uri, final String requestId,
|
|
||||||
Map<String, String> givenHeaders) {
|
|
||||||
// the resource builder will not expose its headers to us, so we are using Mockito's Whitebox class to extract them.
|
// the resource builder will not expose its headers to us, so we are using Mockito's Whitebox class to extract them.
|
||||||
final OutBoundHeaders headers = (OutBoundHeaders) Whitebox.getInternalState(resourceBuilder, "metadata");
|
final OutBoundHeaders headers = (OutBoundHeaders) Whitebox.getInternalState(resourceBuilder, "metadata");
|
||||||
final Object expectsHeader = headers.getFirst(ThreadPoolRequestReplicator.REQUEST_VALIDATION_HTTP_HEADER);
|
final Object expectsHeader = headers.getFirst(ThreadPoolRequestReplicator.REQUEST_VALIDATION_HTTP_HEADER);
|
||||||
|
@ -333,10 +330,8 @@ public class TestThreadPoolRequestReplicator {
|
||||||
final ThreadPoolRequestReplicator replicator
|
final ThreadPoolRequestReplicator replicator
|
||||||
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
||||||
@Override
|
@Override
|
||||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder,
|
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method,
|
||||||
final NodeIdentifier nodeId, final String method,
|
final URI uri, final String requestId, Map<String, String> givenHeaders) {
|
||||||
final URI uri, final String requestId,
|
|
||||||
Map<String, String> givenHeaders) {
|
|
||||||
if (delayMillis > 0L) {
|
if (delayMillis > 0L) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(delayMillis);
|
Thread.sleep(delayMillis);
|
||||||
|
|
|
@ -3029,7 +3029,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
|
||||||
descriptor = new PropertyDescriptor.Builder().name(property).addValidator(Validator.INVALID).dynamic(true).build();
|
descriptor = new PropertyDescriptor.Builder().name(property).addValidator(Validator.INVALID).dynamic(true).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
return dtoFactory.createPropertyDescriptorDto(descriptor, "root");
|
return dtoFactory.createPropertyDescriptorDto(descriptor, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -786,8 +786,7 @@ public abstract class ApplicationResource {
|
||||||
return requestReplicator.replicate(targetNodes, method, path, entity, headers, true, true).awaitMergedResponse().getResponse();
|
return requestReplicator.replicate(targetNodes, method, path, entity, headers, true, true).awaitMergedResponse().getResponse();
|
||||||
} else {
|
} else {
|
||||||
headers.put(RequestReplicator.REPLICATION_TARGET_NODE_UUID_HEADER, nodeId.getId());
|
headers.put(RequestReplicator.REPLICATION_TARGET_NODE_UUID_HEADER, nodeId.getId());
|
||||||
return requestReplicator.replicate(Collections.singleton(getClusterCoordinatorNode()), method,
|
return requestReplicator.forwardToCoordinator(getClusterCoordinatorNode(), method, path, entity, headers).awaitMergedResponse().getResponse();
|
||||||
path, entity, headers, false, true).awaitMergedResponse().getResponse();
|
|
||||||
}
|
}
|
||||||
} catch (final InterruptedException ie) {
|
} catch (final InterruptedException ie) {
|
||||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Request to " + method + " " + path + " was interrupted").type("text/plain").build();
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Request to " + method + " " + path + " was interrupted").type("text/plain").build();
|
||||||
|
@ -820,9 +819,8 @@ public abstract class ApplicationResource {
|
||||||
final Set<NodeIdentifier> nodeIds = Collections.singleton(targetNode);
|
final Set<NodeIdentifier> nodeIds = Collections.singleton(targetNode);
|
||||||
return getRequestReplicator().replicate(nodeIds, method, getAbsolutePath(), entity, getHeaders(), true, true).awaitMergedResponse().getResponse();
|
return getRequestReplicator().replicate(nodeIds, method, getAbsolutePath(), entity, getHeaders(), true, true).awaitMergedResponse().getResponse();
|
||||||
} else {
|
} else {
|
||||||
final Set<NodeIdentifier> coordinatorNode = Collections.singleton(getClusterCoordinatorNode());
|
|
||||||
final Map<String, String> headers = getHeaders(Collections.singletonMap(RequestReplicator.REPLICATION_TARGET_NODE_UUID_HEADER, targetNode.getId()));
|
final Map<String, String> headers = getHeaders(Collections.singletonMap(RequestReplicator.REPLICATION_TARGET_NODE_UUID_HEADER, targetNode.getId()));
|
||||||
return getRequestReplicator().replicate(coordinatorNode, method, getAbsolutePath(), entity, headers, false, true).awaitMergedResponse().getResponse();
|
return requestReplicator.forwardToCoordinator(getClusterCoordinatorNode(), method, getAbsolutePath(), entity, headers).awaitMergedResponse().getResponse();
|
||||||
}
|
}
|
||||||
} catch (final InterruptedException ie) {
|
} catch (final InterruptedException ie) {
|
||||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Request to " + method + " " + getAbsolutePath() + " was interrupted").type("text/plain").build();
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Request to " + method + " " + getAbsolutePath() + " was interrupted").type("text/plain").build();
|
||||||
|
|
|
@ -348,7 +348,8 @@ public class ControllerResource extends ApplicationResource {
|
||||||
throw new IllegalArgumentException("Controller service details must be specified.");
|
throw new IllegalArgumentException("Controller service details must be specified.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestControllerServiceEntity.getRevision() == null || (requestControllerServiceEntity.getRevision().getVersion() == null || requestControllerServiceEntity.getRevision().getVersion() != 0)) {
|
if (requestControllerServiceEntity.getRevision() == null
|
||||||
|
|| (requestControllerServiceEntity.getRevision().getVersion() == null || requestControllerServiceEntity.getRevision().getVersion() != 0)) {
|
||||||
throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Controller service.");
|
throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Controller service.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,8 @@ import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,8 +163,8 @@ public class CountersResource extends ApplicationResource {
|
||||||
if (getReplicationTarget() == ReplicationTarget.CLUSTER_NODES) {
|
if (getReplicationTarget() == ReplicationTarget.CLUSTER_NODES) {
|
||||||
nodeResponse = getRequestReplicator().replicate(HttpMethod.GET, getAbsolutePath(), getRequestParameters(), getHeaders()).awaitMergedResponse();
|
nodeResponse = getRequestReplicator().replicate(HttpMethod.GET, getAbsolutePath(), getRequestParameters(), getHeaders()).awaitMergedResponse();
|
||||||
} else {
|
} else {
|
||||||
final Set<NodeIdentifier> coordinatorNode = Collections.singleton(getClusterCoordinatorNode());
|
nodeResponse = getRequestReplicator().forwardToCoordinator(
|
||||||
nodeResponse = getRequestReplicator().replicate(coordinatorNode, HttpMethod.GET, getAbsolutePath(), getRequestParameters(), getHeaders(), false, true).awaitMergedResponse();
|
getClusterCoordinatorNode(), HttpMethod.GET, getAbsolutePath(), getRequestParameters(), getHeaders()).awaitMergedResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
final CountersEntity entity = (CountersEntity) nodeResponse.getUpdatedEntity();
|
final CountersEntity entity = (CountersEntity) nodeResponse.getUpdatedEntity();
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.apache.nifi.authorization.RequestAction;
|
||||||
import org.apache.nifi.authorization.resource.Authorizable;
|
import org.apache.nifi.authorization.resource.Authorizable;
|
||||||
import org.apache.nifi.authorization.user.NiFiUser;
|
import org.apache.nifi.authorization.user.NiFiUser;
|
||||||
import org.apache.nifi.authorization.user.NiFiUserUtils;
|
import org.apache.nifi.authorization.user.NiFiUserUtils;
|
||||||
import org.apache.nifi.cluster.protocol.NodeIdentifier;
|
|
||||||
import org.apache.nifi.controller.Snippet;
|
import org.apache.nifi.controller.Snippet;
|
||||||
import org.apache.nifi.web.NiFiServiceFacade;
|
import org.apache.nifi.web.NiFiServiceFacade;
|
||||||
import org.apache.nifi.web.ResourceNotFoundException;
|
import org.apache.nifi.web.ResourceNotFoundException;
|
||||||
|
@ -98,7 +97,6 @@ import javax.xml.transform.stream.StreamSource;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -1312,7 +1310,8 @@ public class ProcessGroupResource extends ApplicationResource {
|
||||||
throw new IllegalArgumentException("Remote process group details must be specified.");
|
throw new IllegalArgumentException("Remote process group details must be specified.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestRemoteProcessGroupEntity.getRevision() == null || (requestRemoteProcessGroupEntity.getRevision().getVersion() == null || requestRemoteProcessGroupEntity.getRevision().getVersion() != 0)) {
|
if (requestRemoteProcessGroupEntity.getRevision() == null
|
||||||
|
|| (requestRemoteProcessGroupEntity.getRevision().getVersion() == null || requestRemoteProcessGroupEntity.getRevision().getVersion() != 0)) {
|
||||||
throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Remote process group.");
|
throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Remote process group.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1963,8 +1962,8 @@ public class ProcessGroupResource extends ApplicationResource {
|
||||||
if (getReplicationTarget() == ReplicationTarget.CLUSTER_NODES) {
|
if (getReplicationTarget() == ReplicationTarget.CLUSTER_NODES) {
|
||||||
return getRequestReplicator().replicate(HttpMethod.POST, importUri, entity, getHeaders(headersToOverride)).awaitMergedResponse().getResponse();
|
return getRequestReplicator().replicate(HttpMethod.POST, importUri, entity, getHeaders(headersToOverride)).awaitMergedResponse().getResponse();
|
||||||
} else {
|
} else {
|
||||||
final Set<NodeIdentifier> coordinatorNode = Collections.singleton(getClusterCoordinatorNode());
|
return getRequestReplicator().forwardToCoordinator(
|
||||||
return getRequestReplicator().replicate(coordinatorNode, HttpMethod.POST, importUri, entity, getHeaders(headersToOverride), false, true).awaitMergedResponse().getResponse();
|
getClusterCoordinatorNode(), HttpMethod.POST, importUri, entity, getHeaders(headersToOverride)).awaitMergedResponse().getResponse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2100,7 +2099,8 @@ public class ProcessGroupResource extends ApplicationResource {
|
||||||
throw new IllegalArgumentException("Controller service details must be specified.");
|
throw new IllegalArgumentException("Controller service details must be specified.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestControllerServiceEntity.getRevision() == null || (requestControllerServiceEntity.getRevision().getVersion() == null || requestControllerServiceEntity.getRevision().getVersion() != 0)) {
|
if (requestControllerServiceEntity.getRevision() == null
|
||||||
|
|| (requestControllerServiceEntity.getRevision().getVersion() == null || requestControllerServiceEntity.getRevision().getVersion() != 0)) {
|
||||||
throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Controller service.");
|
throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Controller service.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.apache.nifi.authorization.resource.ResourceFactory;
|
||||||
import org.apache.nifi.authorization.user.NiFiUser;
|
import org.apache.nifi.authorization.user.NiFiUser;
|
||||||
import org.apache.nifi.authorization.user.NiFiUserUtils;
|
import org.apache.nifi.authorization.user.NiFiUserUtils;
|
||||||
import org.apache.nifi.cluster.manager.NodeResponse;
|
import org.apache.nifi.cluster.manager.NodeResponse;
|
||||||
import org.apache.nifi.cluster.protocol.NodeIdentifier;
|
|
||||||
import org.apache.nifi.web.NiFiServiceFacade;
|
import org.apache.nifi.web.NiFiServiceFacade;
|
||||||
import org.apache.nifi.web.api.dto.SystemDiagnosticsDTO;
|
import org.apache.nifi.web.api.dto.SystemDiagnosticsDTO;
|
||||||
import org.apache.nifi.web.api.entity.SystemDiagnosticsEntity;
|
import org.apache.nifi.web.api.entity.SystemDiagnosticsEntity;
|
||||||
|
@ -48,10 +47,8 @@ import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.QueryParam;
|
import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RESTful endpoint for retrieving system diagnostics.
|
* RESTful endpoint for retrieving system diagnostics.
|
||||||
|
@ -143,8 +140,8 @@ public class SystemDiagnosticsResource extends ApplicationResource {
|
||||||
if (getReplicationTarget() == ReplicationTarget.CLUSTER_NODES) {
|
if (getReplicationTarget() == ReplicationTarget.CLUSTER_NODES) {
|
||||||
nodeResponse = getRequestReplicator().replicate(HttpMethod.GET, getAbsolutePath(), getRequestParameters(), getHeaders()).awaitMergedResponse();
|
nodeResponse = getRequestReplicator().replicate(HttpMethod.GET, getAbsolutePath(), getRequestParameters(), getHeaders()).awaitMergedResponse();
|
||||||
} else {
|
} else {
|
||||||
final Set<NodeIdentifier> coordinatorNode = Collections.singleton(getClusterCoordinatorNode());
|
nodeResponse = getRequestReplicator().forwardToCoordinator(
|
||||||
nodeResponse = getRequestReplicator().replicate(coordinatorNode, HttpMethod.GET, getAbsolutePath(), getRequestParameters(), getHeaders(), false, true).awaitMergedResponse();
|
getClusterCoordinatorNode(), HttpMethod.GET, getAbsolutePath(), getRequestParameters(), getHeaders()).awaitMergedResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
final SystemDiagnosticsEntity entity = (SystemDiagnosticsEntity) nodeResponse.getUpdatedEntity();
|
final SystemDiagnosticsEntity entity = (SystemDiagnosticsEntity) nodeResponse.getUpdatedEntity();
|
||||||
|
|
|
@ -167,22 +167,22 @@ public class TenantsResource extends ApplicationResource {
|
||||||
return replicate(HttpMethod.POST, requestUserEntity);
|
return replicate(HttpMethod.POST, requestUserEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get revision from the config
|
|
||||||
final RevisionDTO revisionDTO = requestUserEntity.getRevision();
|
|
||||||
Revision requestRevision = new Revision(revisionDTO.getVersion(), revisionDTO.getClientId(), requestUserEntity.getComponent().getId());
|
|
||||||
return withWriteLock(
|
return withWriteLock(
|
||||||
serviceFacade,
|
serviceFacade,
|
||||||
requestUserEntity,
|
requestUserEntity,
|
||||||
requestRevision,
|
|
||||||
lookup -> {
|
lookup -> {
|
||||||
final Authorizable tenants = lookup.getTenant();
|
final Authorizable tenants = lookup.getTenant();
|
||||||
tenants.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser());
|
tenants.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser());
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
(revision, userEntity) -> {
|
userEntity -> {
|
||||||
// set the user id as appropriate
|
// set the user id as appropriate
|
||||||
userEntity.getComponent().setId(generateUuid());
|
userEntity.getComponent().setId(generateUuid());
|
||||||
|
|
||||||
|
// get revision from the config
|
||||||
|
final RevisionDTO revisionDTO = userEntity.getRevision();
|
||||||
|
Revision revision = new Revision(revisionDTO.getVersion(), revisionDTO.getClientId(), userEntity.getComponent().getId());
|
||||||
|
|
||||||
// create the user and generate the json
|
// create the user and generate the json
|
||||||
final UserEntity entity = serviceFacade.createUser(revision, userEntity.getComponent());
|
final UserEntity entity = serviceFacade.createUser(revision, userEntity.getComponent());
|
||||||
populateRemainingUserEntityContent(entity);
|
populateRemainingUserEntityContent(entity);
|
||||||
|
@ -552,22 +552,22 @@ public class TenantsResource extends ApplicationResource {
|
||||||
return replicate(HttpMethod.POST, requestUserGroupEntity);
|
return replicate(HttpMethod.POST, requestUserGroupEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get revision from the config
|
|
||||||
final RevisionDTO revisionDTO = requestUserGroupEntity.getRevision();
|
|
||||||
Revision requestRevision = new Revision(revisionDTO.getVersion(), revisionDTO.getClientId(), requestUserGroupEntity.getComponent().getId());
|
|
||||||
return withWriteLock(
|
return withWriteLock(
|
||||||
serviceFacade,
|
serviceFacade,
|
||||||
requestUserGroupEntity,
|
requestUserGroupEntity,
|
||||||
requestRevision,
|
|
||||||
lookup -> {
|
lookup -> {
|
||||||
final Authorizable tenants = lookup.getTenant();
|
final Authorizable tenants = lookup.getTenant();
|
||||||
tenants.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser());
|
tenants.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser());
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
(revision, userGroupEntity) -> {
|
userGroupEntity -> {
|
||||||
// set the user group id as appropriate
|
// set the user group id as appropriate
|
||||||
userGroupEntity.getComponent().setId(generateUuid());
|
userGroupEntity.getComponent().setId(generateUuid());
|
||||||
|
|
||||||
|
// get revision from the config
|
||||||
|
final RevisionDTO revisionDTO = userGroupEntity.getRevision();
|
||||||
|
Revision revision = new Revision(revisionDTO.getVersion(), revisionDTO.getClientId(), userGroupEntity.getComponent().getId());
|
||||||
|
|
||||||
// create the user group and generate the json
|
// create the user group and generate the json
|
||||||
final UserGroupEntity entity = serviceFacade.createUserGroup(revision, userGroupEntity.getComponent());
|
final UserGroupEntity entity = serviceFacade.createUserGroup(revision, userGroupEntity.getComponent());
|
||||||
populateRemainingUserGroupEntityContent(entity);
|
populateRemainingUserGroupEntityContent(entity);
|
||||||
|
|
|
@ -16,6 +16,6 @@
|
||||||
<div id="user-delete-dialog" class="hidden">
|
<div id="user-delete-dialog" class="hidden">
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<input type="hidden" id="user-id-delete-dialog"/>
|
<input type="hidden" id="user-id-delete-dialog"/>
|
||||||
Are you sure you want to delete the user account for '<span id="user-identity-delete-dialog"></span>'?
|
Are you sure you want to delete the account for '<span id="user-identity-delete-dialog"></span>'?
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -31,7 +31,7 @@ nf.UsersTable = (function () {
|
||||||
|
|
||||||
var initUserDeleteDialog = function () {
|
var initUserDeleteDialog = function () {
|
||||||
$('#user-delete-dialog').modal({
|
$('#user-delete-dialog').modal({
|
||||||
headerText: 'Delete User',
|
headerText: 'Delete Account',
|
||||||
buttons: [{
|
buttons: [{
|
||||||
buttonText: 'Delete',
|
buttonText: 'Delete',
|
||||||
color: {
|
color: {
|
||||||
|
|
Loading…
Reference in New Issue