NIFI-4436:

- Code clean up.
- Backing out incomplete fix for variable registry two phase commit to address in separate JIRA.
This commit is contained in:
Matt Gilman 2018-01-03 10:46:04 -05:00 committed by Bryan Bende
parent 118667a601
commit fd18eeb84e
No known key found for this signature in database
GPG Key ID: A0DDA9ED50711C39
9 changed files with 37 additions and 57 deletions

View File

@ -28,7 +28,6 @@ public class ControllerConfigurationDTO {
private Integer maxTimerDrivenThreadCount;
private Integer maxEventDrivenThreadCount;
private String registryUrl;
/**
* @return maximum number of timer driven threads this NiFi has available

View File

@ -127,5 +127,4 @@ public class FlowConfigurationDTO {
public void setTimeOffset(Integer timeOffset) {
this.timeOffset = timeOffset;
}
}

View File

@ -21,7 +21,7 @@ import io.swagger.annotations.ApiModelProperty;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "createActiveRequest")
@XmlRootElement(name = "createActiveRequestEntity")
public class CreateActiveRequestEntity extends Entity {
private String processGroupId;

View File

@ -23,7 +23,7 @@ import org.apache.nifi.web.api.dto.VersionedFlowDTO;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "versionedFlow")
@XmlRootElement(name = "startVersionControlRequestEntity")
public class StartVersionControlRequestEntity extends Entity {
private VersionedFlowDTO versionedFlow;
private RevisionDTO processGroupRevision;

View File

@ -22,7 +22,7 @@ import org.apache.nifi.web.api.dto.VersionedFlowDTO;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "versionedFlow")
@XmlRootElement(name = "versionedFlowEntity")
public class VersionedFlowEntity extends Entity {
private VersionedFlowDTO versionedFlow;

View File

@ -23,7 +23,7 @@ import org.apache.nifi.web.api.dto.RevisionDTO;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "versionedFlowSnapshot")
@XmlRootElement(name = "versionedFlowSnapshotEntity")
public class VersionedFlowSnapshotEntity extends Entity {
private VersionedFlowSnapshot versionedFlowSnapshot;
private RevisionDTO processGroupRevision;

View File

@ -22,7 +22,7 @@ import org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "versionedFlowSnapshotMetadata")
@XmlRootElement(name = "versionedFlowSnapshotMetadataEntity")
public class VersionedFlowSnapshotMetadataEntity extends Entity {
private VersionedFlowSnapshotMetadata versionedFlowSnapshotMetadata;
private String registryId;

View File

@ -37,7 +37,6 @@ import org.apache.nifi.cluster.manager.exception.IllegalClusterStateException;
import org.apache.nifi.cluster.manager.exception.UnknownNodeException;
import org.apache.nifi.cluster.protocol.NodeIdentifier;
import org.apache.nifi.controller.FlowController;
import org.apache.nifi.framework.security.util.SslContextFactory;
import org.apache.nifi.remote.HttpRemoteSiteListener;
import org.apache.nifi.remote.VersionNegotiator;
import org.apache.nifi.remote.exception.BadRequestException;
@ -46,7 +45,6 @@ import org.apache.nifi.remote.exception.NotAuthorizedException;
import org.apache.nifi.remote.protocol.ResponseCode;
import org.apache.nifi.remote.protocol.http.HttpHeaders;
import org.apache.nifi.util.ComponentIdGenerator;
import org.apache.nifi.util.FormatUtils;
import org.apache.nifi.util.NiFiProperties;
import org.apache.nifi.web.NiFiServiceFacade;
import org.apache.nifi.web.Revision;
@ -57,14 +55,11 @@ import org.apache.nifi.web.api.entity.TransactionResultEntity;
import org.apache.nifi.web.security.ProxiedEntitiesUtils;
import org.apache.nifi.web.security.util.CacheKey;
import org.apache.nifi.web.util.WebUtils;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.client.Client;
import javax.ws.rs.core.CacheControl;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
@ -227,17 +222,6 @@ public abstract class ApplicationResource {
return Optional.of(idGenerationSeed);
}
protected Client createJerseyClient() {
final NiFiProperties properties = getProperties();
final ClientConfig clientConfig = new ClientConfig();
final int connectionTimeout = (int) FormatUtils.getTimeDuration(properties.getClusterNodeConnectionTimeout(), TimeUnit.MILLISECONDS);
final int readTimeout = (int) FormatUtils.getTimeDuration(properties.getClusterNodeReadTimeout(), TimeUnit.MILLISECONDS);
clientConfig.property(ClientProperties.READ_TIMEOUT, readTimeout);
clientConfig.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout);
clientConfig.property(ClientProperties.FOLLOW_REDIRECTS, Boolean.TRUE);
return WebUtils.createClient(clientConfig, SslContextFactory.createSslContext(properties));
}
/**
* Generates an Ok response with no content.
*

View File

@ -16,32 +16,12 @@
*/
package org.apache.nifi.web.api;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
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 javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.stream.XMLStreamReader;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Authorization;
import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.authorization.AuthorizableLookup;
import org.apache.nifi.authorization.AuthorizeAccess;
@ -132,6 +112,31 @@ import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
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 javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.stream.XMLStreamReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
@ -157,13 +162,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Authorization;
/**
* RESTful endpoint for managing a Group.
*/
@ -622,7 +620,7 @@ public class ProcessGroupResource extends ApplicationResource {
final VariableRegistryDTO requestRegistryDto = requestVariableRegistryEntity.getVariableRegistry();
if (!groupId.equals(requestRegistryDto.getProcessGroupId())) {
throw new IllegalArgumentException(String.format("The process group id (%s) in the request body does "
+ "not equal the process group id of the requested resource (%s).", requestRegistryDto.getProcessGroupId(), groupId));
+ "not equal the process group id of the requested resource (%s).", registryDto.getProcessGroupId(), groupId));
}
if (isReplicateRequest()) {