You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2016/04/21 23:30:28 UTC
[02/10] nifi git commit: NIFI-1554: - Introducing new REST endpoints
to align with the authorizable resources. - Additionally changes to support
the new endpoints. - Addressing comments in PR. - This closes #374.
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.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/SnippetResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java
deleted file mode 100644
index 5eddcf7..0000000
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java
+++ /dev/null
@@ -1,664 +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.web.api;
-
-import com.sun.jersey.api.core.ResourceContext;
-import com.wordnik.swagger.annotations.Api;
-import com.wordnik.swagger.annotations.ApiOperation;
-import com.wordnik.swagger.annotations.ApiParam;
-import com.wordnik.swagger.annotations.ApiResponse;
-import com.wordnik.swagger.annotations.ApiResponses;
-import com.wordnik.swagger.annotations.Authorization;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.nifi.cluster.manager.impl.WebClusterManager;
-import org.apache.nifi.util.NiFiProperties;
-import org.apache.nifi.web.ConfigurationSnapshot;
-import org.apache.nifi.web.NiFiServiceFacade;
-import org.apache.nifi.web.Revision;
-import org.apache.nifi.web.api.dto.FlowSnippetDTO;
-import org.apache.nifi.web.api.dto.RevisionDTO;
-import org.apache.nifi.web.api.dto.SnippetDTO;
-import org.apache.nifi.web.api.entity.SnippetEntity;
-import org.apache.nifi.web.api.request.ClientIdParameter;
-import org.apache.nifi.web.api.request.LongParameter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.FormParam;
-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.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-/**
- * RESTful endpoint for managing a Snippet.
- */
-@Api(hidden = true)
-public class SnippetResource extends ApplicationResource {
-
- private static final Logger logger = LoggerFactory.getLogger(SnippetResource.class);
- private static final String LINKED = "false";
- private static final String VERBOSE = "false";
-
- @Context
- private ResourceContext resourceContext;
-
- private NiFiServiceFacade serviceFacade;
- private WebClusterManager clusterManager;
- private NiFiProperties properties;
-
- private ProcessorResource processorResource;
- private InputPortResource inputPortResource;
- private OutputPortResource outputPortResource;
- private FunnelResource funnelResource;
- private LabelResource labelResource;
- private RemoteProcessGroupResource remoteProcessGroupResource;
- private ConnectionResource connectionResource;
- private ProcessGroupResource processGroupResource;
-
- /**
- * Populates the uri for the specified snippet.
- */
- private SnippetDTO populateRemainingSnippetContent(SnippetDTO snippet) {
- // populate the snippet href
- snippet.setUri(generateResourceUri("controller", "snippets", snippet.getId()));
-
- String snippetGroupId = snippet.getParentGroupId();
- FlowSnippetDTO snippetContents = snippet.getContents();
-
- // populate the snippet content uris
- if (snippet.getContents() != null) {
- processorResource.populateRemainingProcessorsContent(snippetContents.getProcessors());
- connectionResource.populateRemainingConnectionsContent(snippetContents.getConnections());
- inputPortResource.populateRemainingInputPortsContent(snippetContents.getInputPorts());
- outputPortResource.populateRemainingOutputPortsContent(snippetContents.getOutputPorts());
- remoteProcessGroupResource.populateRemainingRemoteProcessGroupsContent(snippetContents.getRemoteProcessGroups());
- funnelResource.populateRemainingFunnelsContent(snippetContents.getFunnels());
- labelResource.populateRemainingLabelsContent(snippetContents.getLabels());
- processGroupResource.populateRemainingProcessGroupsContent(snippetContents.getProcessGroups());
- }
-
- return snippet;
- }
-
- /**
- * Creates a new snippet based on the specified contents.
- *
- * @param httpServletRequest request
- * @param version The revision is used to verify the client is working with
- * the latest version of the flow.
- * @param clientId Optional client id. If the client id is not specified, a
- * new one will be generated. This value (whether specified or generated) is
- * included in the response.
- * @param parentGroupId The id of the process group the components in this
- * snippet belong to.
- * @param linked Whether or not this snippet is linked to the underlying
- * data flow. If a linked snippet is deleted, the components that comprise
- * the snippet are also deleted.
- * @param processorIds The ids of any processors in this snippet.
- * @param processGroupIds The ids of any process groups in this snippet.
- * @param remoteProcessGroupIds The ids of any remote process groups in this
- * snippet.
- * @param inputPortIds The ids of any input ports in this snippet.
- * @param outputPortIds The ids of any output ports in this snippet.
- * @param connectionIds The ids of any connections in this snippet.
- * @param labelIds The ids of any labels in this snippet.
- * @param funnelIds The ids of any funnels in this snippet.
- * @return A snippetEntity
- */
- @POST
- @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- // TODO - @PreAuthorize("hasRole('ROLE_DFM')")
- public Response createSnippet(
- @Context HttpServletRequest httpServletRequest,
- @FormParam(VERSION) LongParameter version,
- @FormParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId,
- @FormParam("parentGroupId") String parentGroupId,
- @FormParam("linked") @DefaultValue(LINKED) Boolean linked,
- @FormParam("processorIds[]") List<String> processorIds,
- @FormParam("processGroupIds[]") List<String> processGroupIds,
- @FormParam("remoteProcessGroupIds[]") List<String> remoteProcessGroupIds,
- @FormParam("inputPortIds[]") List<String> inputPortIds,
- @FormParam("outputPortIds[]") List<String> outputPortIds,
- @FormParam("connectionIds[]") List<String> connectionIds,
- @FormParam("labelIds[]") List<String> labelIds,
- @FormParam("funnelIds[]") List<String> funnelIds) {
-
- // create the snippet dto
- final SnippetDTO snippetDTO = new SnippetDTO();
- snippetDTO.setParentGroupId(parentGroupId);
- snippetDTO.setLinked(linked);
- snippetDTO.setProcessors(new HashSet<>(processorIds));
- snippetDTO.setProcessGroups(new HashSet<>(processGroupIds));
- snippetDTO.setRemoteProcessGroups(new HashSet<>(remoteProcessGroupIds));
- snippetDTO.setInputPorts(new HashSet<>(inputPortIds));
- snippetDTO.setOutputPorts(new HashSet<>(outputPortIds));
- snippetDTO.setConnections(new HashSet<>(connectionIds));
- snippetDTO.setLabels(new HashSet<>(labelIds));
- snippetDTO.setFunnels(new HashSet<>(funnelIds));
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- revision.setClientId(clientId.getClientId());
-
- if (version != null) {
- revision.setVersion(version.getLong());
- }
-
- // create the snippet entity
- final SnippetEntity snippetEntity = new SnippetEntity();
- snippetEntity.setRevision(revision);
- snippetEntity.setSnippet(snippetDTO);
-
- // build the response
- return createSnippet(httpServletRequest, snippetEntity);
- }
-
- /**
- * Creates a snippet based off the specified configuration.
- *
- * @param httpServletRequest request
- * @param snippetEntity A snippetEntity
- * @return A snippetEntity
- */
- @POST
- @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Path("") // necessary due to bug in swagger
- // TODO - @PreAuthorize("hasRole('ROLE_DFM')")
- @ApiOperation(
- value = "Creates a snippet",
- response = SnippetEntity.class,
- authorizations = {
- @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
- @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"),
- @Authorization(value = "Administrator", type = "ROLE_ADMIN")
- }
- )
- @ApiResponses(
- value = {
- @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
- @ApiResponse(code = 401, message = "Client could not be authenticated."),
- @ApiResponse(code = 403, message = "Client is not authorized to make this request."),
- @ApiResponse(code = 404, message = "The specified resource could not be found."),
- @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.")
- }
- )
- public Response createSnippet(
- @Context HttpServletRequest httpServletRequest,
- @ApiParam(
- value = "The snippet configuration details.",
- required = true
- )
- final SnippetEntity snippetEntity) {
-
- if (snippetEntity == null || snippetEntity.getSnippet() == null) {
- throw new IllegalArgumentException("Snippet details must be specified.");
- }
-
- if (snippetEntity.getRevision() == null) {
- throw new IllegalArgumentException("Revision must be specified.");
- }
-
- if (snippetEntity.getSnippet().getId() != null) {
- throw new IllegalArgumentException("Snippet ID cannot be specified.");
- }
-
- // ensure the group id has been specified
- if (snippetEntity.getSnippet().getParentGroupId() == null) {
- throw new IllegalArgumentException("The group id must be specified when creating a snippet.");
- }
-
- // if cluster manager, convert POST to PUT (to maintain same ID across nodes) and replicate
- if (properties.isClusterManager()) {
-
- // create ID for resource
- final String id = UUID.randomUUID().toString();
-
- // set ID for resource
- snippetEntity.getSnippet().setId(id);
-
- // convert POST request to PUT request to force entity ID to be the same across nodes
- URI putUri = null;
- try {
- putUri = new URI(getAbsolutePath().toString() + "/" + id);
- } catch (final URISyntaxException e) {
- throw new WebApplicationException(e);
- }
-
- // change content type to JSON for serializing entity
- final Map<String, String> headersToOverride = new HashMap<>();
- headersToOverride.put("content-type", MediaType.APPLICATION_JSON);
-
- // replicate put request
- return (Response) clusterManager.applyRequest(HttpMethod.PUT, putUri, updateClientId(snippetEntity), getHeaders(headersToOverride)).getResponse();
- }
-
- // handle expects request (usually from the cluster manager)
- final String expects = httpServletRequest.getHeader(WebClusterManager.NCM_EXPECTS_HTTP_HEADER);
- if (expects != null) {
- return generateContinueResponse().build();
- }
-
- // create the snippet
- final RevisionDTO revision = snippetEntity.getRevision();
- final ConfigurationSnapshot<SnippetDTO> response = serviceFacade.createSnippet(new Revision(revision.getVersion(), revision.getClientId()), snippetEntity.getSnippet());
-
- // get the snippet
- final SnippetDTO snippet = response.getConfiguration();
-
- // always prune the response when creating
- snippet.setContents(null);
-
- // get the updated revision
- final RevisionDTO updatedRevision = new RevisionDTO();
- updatedRevision.setClientId(revision.getClientId());
- updatedRevision.setVersion(response.getVersion());
-
- // build the response entity
- SnippetEntity entity = new SnippetEntity();
- entity.setRevision(updatedRevision);
- entity.setSnippet(populateRemainingSnippetContent(snippet));
-
- // build the response
- return clusterContext(generateCreatedResponse(URI.create(snippet.getUri()), entity)).build();
- }
-
- /**
- * Retrieves the specified snippet.
- *
- * @param clientId Optional client id. If the client id is not specified, a
- * new one will be generated. This value (whether specified or generated) is
- * included in the response.
- * @param verbose Whether or not to include the contents of the snippet in
- * the response.
- * @param id The id of the snippet to retrieve.
- * @return A snippetEntity.
- */
- @GET
- @Consumes(MediaType.WILDCARD)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Path("{id}")
- // TODO - @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
- @ApiOperation(
- value = "Gets a snippet",
- response = SnippetEntity.class,
- authorizations = {
- @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
- @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"),
- @Authorization(value = "Administrator", type = "ROLE_ADMIN")
- }
- )
- @ApiResponses(
- value = {
- @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
- @ApiResponse(code = 401, message = "Client could not be authenticated."),
- @ApiResponse(code = 403, message = "Client is not authorized to make this request."),
- @ApiResponse(code = 404, message = "The specified resource could not be found."),
- @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.")
- }
- )
- public Response getSnippet(
- @ApiParam(
- value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.",
- required = false
- )
- @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId,
- @ApiParam(
- value = "Whether to include configuration details for the components specified in the snippet.",
- required = false
- )
- @QueryParam("verbose") @DefaultValue(VERBOSE) Boolean verbose,
- @ApiParam(
- value = "The snippet id.",
- required = true
- )
- @PathParam("id") String id) {
-
- // replicate if cluster manager
- if (properties.isClusterManager()) {
- return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse();
- }
-
- // get the snippet
- final SnippetDTO snippet = serviceFacade.getSnippet(id);
-
- // prune the response if necessary
- if (!verbose) {
- snippet.setContents(null);
- }
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- revision.setClientId(clientId.getClientId());
-
- // create the response entity
- final SnippetEntity entity = new SnippetEntity();
- entity.setRevision(revision);
- entity.setSnippet(populateRemainingSnippetContent(snippet));
-
- return clusterContext(generateOkResponse(entity)).build();
- }
-
- /**
- * Updates the specified snippet.
- *
- * @param httpServletRequest request
- * @param version The revision is used to verify the client is working with
- * the latest version of the flow.
- * @param clientId Optional client id. If the client id is not specified, a
- * new one will be generated. This value (whether specified or generated) is
- * included in the response.
- * @param verbose Whether or not to include the contents of the snippet in
- * the response.
- * @param id The id of the snippet to update.
- * @param parentGroupId The id of the process group to move the contents of
- * this snippet to.
- * @param linked Whether or not this snippet is linked to the underlying
- * data flow. If a linked snippet is deleted, the components that comprise
- * the snippet are also deleted.
- * @return A snippetEntity.
- */
- @PUT
- @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Path("{id}")
- // TODO - @PreAuthorize("hasRole('ROLE_DFM')")
- public Response updateSnippet(
- @Context HttpServletRequest httpServletRequest,
- @FormParam(VERSION) LongParameter version,
- @FormParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId,
- @FormParam("verbose") @DefaultValue(VERBOSE) Boolean verbose,
- @PathParam("id") String id,
- @FormParam("parentGroupId") String parentGroupId,
- @FormParam("linked") Boolean linked) {
-
- // create the snippet dto
- final SnippetDTO snippetDTO = new SnippetDTO();
- snippetDTO.setId(id);
- snippetDTO.setParentGroupId(parentGroupId);
- snippetDTO.setLinked(linked);
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- revision.setClientId(clientId.getClientId());
-
- if (version != null) {
- revision.setVersion(version.getLong());
- }
-
- // create the snippet entity
- final SnippetEntity entity = new SnippetEntity();
- entity.setRevision(revision);
- entity.setSnippet(snippetDTO);
-
- // build the response
- return updateSnippet(httpServletRequest, id, entity);
- }
-
- /**
- * Updates the specified snippet. The contents of the snippet (component
- * ids) cannot be updated once the snippet is created.
- *
- * @param httpServletRequest request
- * @param id The id of the snippet.
- * @param snippetEntity A snippetEntity
- * @return A snippetEntity
- */
- @PUT
- @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Path("{id}")
- // TODO - @PreAuthorize("hasRole('ROLE_DFM')")
- @ApiOperation(
- value = "Updates a snippet",
- response = SnippetEntity.class,
- authorizations = {
- @Authorization(value = "Data Flow Manager", type = "ROLE_DFM")
- }
- )
- @ApiResponses(
- value = {
- @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
- @ApiResponse(code = 401, message = "Client could not be authenticated."),
- @ApiResponse(code = 403, message = "Client is not authorized to make this request."),
- @ApiResponse(code = 404, message = "The specified resource could not be found."),
- @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.")
- }
- )
- public Response updateSnippet(
- @Context HttpServletRequest httpServletRequest,
- @ApiParam(
- value = "The snippet id.",
- required = true
- )
- @PathParam("id") String id,
- @ApiParam(
- value = "The snippet configuration details.",
- required = true
- )
- final SnippetEntity snippetEntity) {
-
- if (snippetEntity == null || snippetEntity.getSnippet() == null) {
- throw new IllegalArgumentException("Snippet details must be specified.");
- }
-
- if (snippetEntity.getRevision() == null) {
- throw new IllegalArgumentException("Revision must be specified.");
- }
-
- // ensure the ids are the same
- final SnippetDTO requestSnippetDTO = snippetEntity.getSnippet();
- if (!id.equals(requestSnippetDTO.getId())) {
- throw new IllegalArgumentException(String.format("The snippet id (%s) in the request body does not equal the "
- + "snippet id of the requested resource (%s).", requestSnippetDTO.getId(), id));
- }
-
- // replicate if cluster manager
- if (properties.isClusterManager()) {
- // change content type to JSON for serializing entity
- final Map<String, String> headersToOverride = new HashMap<>();
- headersToOverride.put("content-type", MediaType.APPLICATION_JSON);
-
- // replicate the request
- return clusterManager.applyRequest(HttpMethod.PUT, getAbsolutePath(), updateClientId(snippetEntity), getHeaders(headersToOverride)).getResponse();
- }
-
- // handle expects request (usually from the cluster manager)
- final String expects = httpServletRequest.getHeader(WebClusterManager.NCM_EXPECTS_HTTP_HEADER);
- if (expects != null) {
- serviceFacade.verifyUpdateSnippet(requestSnippetDTO);
- return generateContinueResponse().build();
- }
-
- // update the snippet
- final RevisionDTO revision = snippetEntity.getRevision();
- final ConfigurationSnapshot<SnippetDTO> controllerResponse = serviceFacade.updateSnippet(
- new Revision(revision.getVersion(), revision.getClientId()), snippetEntity.getSnippet());
-
- // get the results
- final SnippetDTO snippet = controllerResponse.getConfiguration();
-
- // always prune update responses
- snippet.setContents(null);
-
- // get the updated revision
- final RevisionDTO updatedRevision = new RevisionDTO();
- updatedRevision.setClientId(revision.getClientId());
- updatedRevision.setVersion(controllerResponse.getVersion());
-
- // build the response entity
- SnippetEntity entity = new SnippetEntity();
- entity.setRevision(updatedRevision);
- entity.setSnippet(populateRemainingSnippetContent(snippet));
-
- if (controllerResponse.isNew()) {
- return clusterContext(generateCreatedResponse(URI.create(snippet.getUri()), entity)).build();
- } else {
- return clusterContext(generateOkResponse(entity)).build();
- }
- }
-
- /**
- * Removes the specified snippet.
- *
- * @param httpServletRequest request
- * @param version The revision is used to verify the client is working with
- * the latest version of the flow.
- * @param clientId Optional client id. If the client id is not specified, a
- * new one will be generated. This value (whether specified or generated) is
- * included in the response.
- * @param id The id of the snippet to remove.
- * @return A entity containing the client id and an updated revision.
- */
- @DELETE
- @Consumes(MediaType.WILDCARD)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Path("{id}")
- // TODO - @PreAuthorize("hasRole('ROLE_DFM')")
- @ApiOperation(
- value = "Deletes a snippet",
- response = SnippetEntity.class,
- authorizations = {
- @Authorization(value = "Data Flow Manager", type = "ROLE_DFM")
- }
- )
- @ApiResponses(
- value = {
- @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
- @ApiResponse(code = 401, message = "Client could not be authenticated."),
- @ApiResponse(code = 403, message = "Client is not authorized to make this request."),
- @ApiResponse(code = 404, message = "The specified resource could not be found."),
- @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.")
- }
- )
- public Response removeSnippet(
- @Context HttpServletRequest httpServletRequest,
- @ApiParam(
- value = "The revision is used to verify the client is working with the latest version of the flow.",
- required = false
- )
- @QueryParam(VERSION) LongParameter version,
- @ApiParam(
- value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.",
- required = false
- )
- @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId,
- @ApiParam(
- value = "The snippet id.",
- required = true
- )
- @PathParam("id") String id) {
-
- // replicate if cluster manager
- if (properties.isClusterManager()) {
- return clusterManager.applyRequest(HttpMethod.DELETE, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse();
- }
-
- // handle expects request (usually from the cluster manager)
- final String expects = httpServletRequest.getHeader(WebClusterManager.NCM_EXPECTS_HTTP_HEADER);
- if (expects != null) {
- serviceFacade.verifyDeleteSnippet(id);
- return generateContinueResponse().build();
- }
-
- // determine the specified version
- Long clientVersion = null;
- if (version != null) {
- clientVersion = version.getLong();
- }
-
- // delete the specified snippet
- final ConfigurationSnapshot<Void> controllerResponse = serviceFacade.deleteSnippet(new Revision(clientVersion, clientId.getClientId()), id);
-
- // get the updated revision
- final RevisionDTO revision = new RevisionDTO();
- revision.setClientId(clientId.getClientId());
- revision.setVersion(controllerResponse.getVersion());
-
- // build the response entity
- SnippetEntity entity = new SnippetEntity();
- entity.setRevision(revision);
-
- return clusterContext(generateOkResponse(entity)).build();
- }
-
- // setters
- public void setServiceFacade(NiFiServiceFacade serviceFacade) {
- this.serviceFacade = serviceFacade;
- }
-
- public void setClusterManager(WebClusterManager clusterManager) {
- this.clusterManager = clusterManager;
- }
-
- public void setProcessorResource(ProcessorResource processorResource) {
- this.processorResource = processorResource;
- }
-
- public void setInputPortResource(InputPortResource inputPortResource) {
- this.inputPortResource = inputPortResource;
- }
-
- public void setOutputPortResource(OutputPortResource outputPortResource) {
- this.outputPortResource = outputPortResource;
- }
-
- public void setFunnelResource(FunnelResource funnelResource) {
- this.funnelResource = funnelResource;
- }
-
- public void setLabelResource(LabelResource labelResource) {
- this.labelResource = labelResource;
- }
-
- public void setRemoteProcessGroupResource(RemoteProcessGroupResource remoteProcessGroupResource) {
- this.remoteProcessGroupResource = remoteProcessGroupResource;
- }
-
- public void setConnectionResource(ConnectionResource connectionResource) {
- this.connectionResource = connectionResource;
- }
-
- public void setProcessGroupResource(ProcessGroupResource processGroupResource) {
- this.processGroupResource = processGroupResource;
- }
-
- public void setProperties(NiFiProperties properties) {
- this.properties = properties;
- }
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.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/SystemDiagnosticsResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java
index 213190a..3d74f2e 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java
@@ -23,6 +23,7 @@ import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;
import com.wordnik.swagger.annotations.Authorization;
import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.authorization.Authorizer;
import org.apache.nifi.cluster.manager.NodeResponse;
import org.apache.nifi.cluster.manager.exception.UnknownNodeException;
import org.apache.nifi.cluster.manager.impl.WebClusterManager;
@@ -52,15 +53,15 @@ import java.util.Set;
*/
@Path("/system-diagnostics")
@Api(
- value = "/system-diagnostics",
- description = "Provides diagnostics for the system NiFi is running on"
+ value = "/system-diagnostics",
+ description = "Endpoint for accessing system diagnostics."
)
public class SystemDiagnosticsResource extends ApplicationResource {
private NiFiServiceFacade serviceFacade;
private WebClusterManager clusterManager;
private NiFiProperties properties;
-
+ private Authorizer authorizer;
/**
* Gets the system diagnostics for this NiFi instance.
@@ -72,7 +73,7 @@ public class SystemDiagnosticsResource extends ApplicationResource {
*/
@GET
@Consumes(MediaType.WILDCARD)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Produces(MediaType.APPLICATION_JSON)
// TODO - @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@ApiOperation(
value = "Gets the diagnostics for the system NiFi is running on",
@@ -161,6 +162,10 @@ public class SystemDiagnosticsResource extends ApplicationResource {
this.clusterManager = clusterManager;
}
+ public void setAuthorizer(Authorizer authorizer) {
+ this.authorizer = authorizer;
+ }
+
public void setProperties(NiFiProperties properties) {
this.properties = properties;
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.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/TemplateResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java
index 673373a..5657fff 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java
@@ -16,7 +16,6 @@
*/
package org.apache.nifi.web.api;
-import com.sun.jersey.multipart.FormDataParam;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
@@ -30,7 +29,6 @@ import org.apache.nifi.web.NiFiServiceFacade;
import org.apache.nifi.web.api.dto.RevisionDTO;
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 org.apache.nifi.web.api.request.ClientIdParameter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,10 +37,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
-import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.HttpMethod;
-import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
@@ -50,22 +46,16 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.transform.stream.StreamSource;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Set;
/**
* RESTful endpoint for managing a Template.
*/
-@Api(hidden = true)
+@Path("/templates")
+@Api(
+ value = "/templates",
+ description = "Endpoint for managing a Template."
+)
public class TemplateResource extends ApplicationResource {
private static final Logger logger = LoggerFactory.getLogger(TemplateResource.class);
@@ -90,280 +80,13 @@ public class TemplateResource extends ApplicationResource {
/**
* Populates the uri for the specified template.
*/
- private TemplateDTO populateRemainingTemplateContent(TemplateDTO template) {
+ public TemplateDTO populateRemainingTemplateContent(TemplateDTO template) {
// populate the template uri
- template.setUri(generateResourceUri("controller", "templates", template.getId()));
+ template.setUri(generateResourceUri("templates", template.getId()));
return template;
}
/**
- * Retrieves all the of templates in this NiFi.
- *
- * @param clientId Optional client id. If the client id is not specified, a
- * new one will be generated. This value (whether specified or generated) is
- * included in the response.
- * @return A templatesEntity.
- */
- @GET
- @Consumes(MediaType.WILDCARD)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Path("") // necessary due to bug in swagger
- // TODO - @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
- @ApiOperation(
- value = "Gets all templates",
- response = TemplatesEntity.class,
- authorizations = {
- @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
- @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"),
- @Authorization(value = "Administrator", type = "ROLE_ADMIN")
- }
- )
- @ApiResponses(
- value = {
- @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
- @ApiResponse(code = 401, message = "Client could not be authenticated."),
- @ApiResponse(code = 403, message = "Client is not authorized to make this request."),
- @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.")
- }
- )
- public Response getTemplates(
- @ApiParam(
- value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.",
- required = false
- )
- @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) {
-
- // replicate if cluster manager
- if (properties.isClusterManager()) {
- return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse();
- }
-
- // get all the templates
- final Set<TemplateDTO> templates = populateRemainingTemplatesContent(serviceFacade.getTemplates());
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- revision.setClientId(clientId.getClientId());
-
- // create the response entity
- final TemplatesEntity entity = new TemplatesEntity();
- entity.setRevision(revision);
- entity.setTemplates(templates);
- entity.setGenerated(new Date());
-
- // generate the response
- return clusterContext(generateOkResponse(entity)).build();
- }
-
- /**
- * Creates a new template based off of the specified template.
- *
- * @param httpServletRequest request
- * @param clientId Optional client id. If the client id is not specified, a
- * new one will be generated. This value (whether specified or generated) is
- * included in the response.
- * @param name The name of the template.
- * @param description The description of the template.
- * @param snippetId The id of the snippet this template is based on.
- * @return A templateEntity
- */
- @POST
- @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Path("") // necessary due to bug in swagger
- // TODO - @PreAuthorize("hasRole('ROLE_DFM')")
- @ApiOperation(
- value = "Creates a template",
- response = TemplateEntity.class,
- authorizations = {
- @Authorization(value = "Data Flow Manager", type = "ROLE_DFM")
- }
- )
- @ApiResponses(
- value = {
- @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
- @ApiResponse(code = 401, message = "Client could not be authenticated."),
- @ApiResponse(code = 403, message = "Client is not authorized to make this request."),
- @ApiResponse(code = 404, message = "The specified resource could not be found."),
- @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.")
- }
- )
- public Response createTemplate(
- @Context HttpServletRequest httpServletRequest,
- @ApiParam(
- value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.",
- required = false
- )
- @FormParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId,
- @ApiParam(
- value = "The template name.",
- required = true
- )
- @FormParam("name") String name,
- @ApiParam(
- value = "The template description.",
- required = false
- )
- @FormParam("description") String description,
- @ApiParam(
- value = "The id of the snippet whose contents will comprise the template.",
- required = true
- )
- @FormParam("snippetId") String snippetId) {
-
- // replicate if cluster manager
- if (properties.isClusterManager()) {
- return clusterManager.applyRequest(HttpMethod.POST, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse();
- }
-
- // handle expects request (usually from the cluster manager)
- final String expects = httpServletRequest.getHeader(WebClusterManager.NCM_EXPECTS_HTTP_HEADER);
- if (expects != null) {
- return generateContinueResponse().build();
- }
-
- // create the template and generate the json
- final TemplateDTO template = serviceFacade.createTemplate(name, description, snippetId);
- populateRemainingTemplateContent(template);
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- revision.setClientId(clientId.getClientId());
-
- // build the response entity
- final TemplateEntity entity = new TemplateEntity();
- entity.setRevision(revision);
- entity.setTemplate(template);
-
- // build the response
- return clusterContext(generateCreatedResponse(URI.create(template.getUri()), entity)).build();
- }
-
- /**
- * Imports the specified template.
- *
- * @param httpServletRequest request
- * @param clientId Optional client id. If the client id is not specified, a
- * new one will be generated. This value (whether specified or generated) is
- * included in the response.
- * @param in The template stream
- * @return A templateEntity or an errorResponse XML snippet.
- */
- @POST
- @Consumes(MediaType.MULTIPART_FORM_DATA)
- @Produces(MediaType.APPLICATION_XML)
- @Path("") // necessary due to bug in swagger
- // TODO - @PreAuthorize("hasRole('ROLE_DFM')")
- public Response importTemplate(
- @Context HttpServletRequest httpServletRequest,
- @FormDataParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId,
- @FormDataParam("template") InputStream in) {
-
- // unmarshal the template
- final TemplateDTO template;
- try {
- JAXBContext context = JAXBContext.newInstance(TemplateDTO.class);
- Unmarshaller unmarshaller = context.createUnmarshaller();
- JAXBElement<TemplateDTO> templateElement = unmarshaller.unmarshal(new StreamSource(in), TemplateDTO.class);
- template = templateElement.getValue();
- } catch (JAXBException jaxbe) {
- logger.warn("An error occurred while parsing a template.", jaxbe);
- String responseXml = String.format("<errorResponse status=\"%s\" statusText=\"The specified template is not in a valid format.\"/>", Response.Status.BAD_REQUEST.getStatusCode());
- return Response.status(Response.Status.OK).entity(responseXml).type("application/xml").build();
- } catch (IllegalArgumentException iae) {
- logger.warn("Unable to import template.", iae);
- String responseXml = String.format("<errorResponse status=\"%s\" statusText=\"%s\"/>", Response.Status.BAD_REQUEST.getStatusCode(), iae.getMessage());
- return Response.status(Response.Status.OK).entity(responseXml).type("application/xml").build();
- } catch (Exception e) {
- logger.warn("An error occurred while importing a template.", e);
- String responseXml = String.format("<errorResponse status=\"%s\" statusText=\"Unable to import the specified template: %s\"/>",
- Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getMessage());
- return Response.status(Response.Status.OK).entity(responseXml).type("application/xml").build();
- }
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- revision.setClientId(clientId.getClientId());
-
- // build the response entity
- TemplateEntity entity = new TemplateEntity();
- entity.setRevision(revision);
- entity.setTemplate(template);
-
- // replicate if cluster manager
- if (properties.isClusterManager()) {
- // change content type to JSON for serializing entity
- final Map<String, String> headersToOverride = new HashMap<>();
- headersToOverride.put("content-type", MediaType.APPLICATION_JSON);
-
- // replicate the request
- return clusterManager.applyRequest(HttpMethod.POST, getAbsolutePath(), updateClientId(entity), getHeaders(headersToOverride)).getResponse();
- }
-
- // otherwise import the template locally
- return importTemplate(httpServletRequest, entity);
- }
-
- /**
- * Imports the specified template.
- *
- * @param httpServletRequest request
- * @param templateEntity A templateEntity.
- * @return A templateEntity.
- */
- @POST
- @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Produces(MediaType.APPLICATION_XML)
- @Path("") // necessary due to bug in swagger
- // TODO - @PreAuthorize("hasRole('ROLE_DFM')")
- public Response importTemplate(
- @Context HttpServletRequest httpServletRequest,
- TemplateEntity templateEntity) {
-
- // handle expects request (usually from the cluster manager)
- final String expects = httpServletRequest.getHeader(WebClusterManager.NCM_EXPECTS_HTTP_HEADER);
- if (expects != null) {
- return generateContinueResponse().build();
- }
-
- try {
- // verify the template was specified
- if (templateEntity == null || templateEntity.getTemplate() == null) {
- throw new IllegalArgumentException("Template details must be specified.");
- }
-
- // import the template
- final TemplateDTO template = serviceFacade.importTemplate(templateEntity.getTemplate());
- populateRemainingTemplateContent(template);
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- if (templateEntity.getRevision() == null) {
- revision.setClientId(new ClientIdParameter().getClientId());
- } else {
- revision.setClientId(templateEntity.getRevision().getClientId());
- }
-
- // build the response entity
- TemplateEntity entity = new TemplateEntity();
- entity.setRevision(revision);
- entity.setTemplate(template);
-
- // build the response
- return clusterContext(generateCreatedResponse(URI.create(template.getUri()), entity)).build();
- } catch (IllegalArgumentException | IllegalStateException e) {
- logger.info("Unable to import template: " + e);
- String responseXml = String.format("<errorResponse status=\"%s\" statusText=\"%s\"/>", Response.Status.BAD_REQUEST.getStatusCode(), e.getMessage());
- return Response.status(Response.Status.OK).entity(responseXml).type("application/xml").build();
- } catch (Exception e) {
- logger.warn("An error occurred while importing a template.", e);
- String responseXml
- = String.format("<errorResponse status=\"%s\" statusText=\"Unable to import the specified template: %s\"/>", Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getMessage());
- return Response.status(Response.Status.OK).entity(responseXml).type("application/xml").build();
- }
- }
-
- /**
* Retrieves the specified template.
*
* @param clientId Optional client id. If the client id is not specified, a
@@ -375,7 +98,7 @@ public class TemplateResource extends ApplicationResource {
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_XML)
- @Path("{id}")
+ @Path("{id}/download")
// TODO - @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@ApiOperation(
value = "Exports a template",
@@ -442,7 +165,7 @@ public class TemplateResource extends ApplicationResource {
*/
@DELETE
@Consumes(MediaType.WILDCARD)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Produces(MediaType.APPLICATION_JSON)
@Path("{id}")
// TODO - @PreAuthorize("hasRole('ROLE_DFM')")
@ApiOperation(
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/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 0ae7649..90acfb8 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
@@ -34,6 +34,7 @@ import org.apache.nifi.action.details.PurgeDetails;
import org.apache.nifi.annotation.behavior.Stateful;
import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.authorization.Resource;
import org.apache.nifi.cluster.HeartbeatPayload;
import org.apache.nifi.cluster.event.Event;
import org.apache.nifi.cluster.manager.StatusMerger;
@@ -1479,6 +1480,7 @@ public final class DtoFactory {
final FlowSnippetDTO dto = new FlowSnippetDTO();
for (final ProcessorNode procNode : group.getProcessors()) {
+ // authorization check
dto.getProcessors().add(createProcessorDto(procNode));
}
@@ -1961,6 +1963,19 @@ public final class DtoFactory {
}
/**
+ * Creates a ResourceDTO from the specified Resource.
+ *
+ * @param resource resource
+ * @return dto
+ */
+ public ResourceDTO createResourceDto(final Resource resource) {
+ final ResourceDTO dto = new ResourceDTO();
+ dto.setIdentifier(resource.getIdentifier());
+ dto.setName(resource.getName());
+ return dto;
+ }
+
+ /**
* Creates a ProcessorConfigDTO from the specified ProcessorNode.
*
* @param procNode node
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/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 7377985..e8686a3 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
@@ -20,6 +20,9 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.admin.service.KeyService;
+import org.apache.nifi.authorization.Resource;
+import org.apache.nifi.authorization.resource.ResourceFactory;
+import org.apache.nifi.authorization.resource.ResourceType;
import org.apache.nifi.cluster.protocol.NodeIdentifier;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.connectable.Connectable;
@@ -31,11 +34,15 @@ import org.apache.nifi.controller.ControllerService;
import org.apache.nifi.controller.Counter;
import org.apache.nifi.controller.FlowController;
import org.apache.nifi.controller.ProcessorNode;
+import org.apache.nifi.controller.ReportingTaskNode;
import org.apache.nifi.controller.ScheduledState;
+import org.apache.nifi.controller.Template;
+import org.apache.nifi.controller.label.Label;
import org.apache.nifi.controller.queue.FlowFileQueue;
import org.apache.nifi.controller.queue.QueueSize;
import org.apache.nifi.controller.repository.ContentNotFoundException;
import org.apache.nifi.controller.repository.claim.ContentDirection;
+import org.apache.nifi.controller.service.ControllerServiceNode;
import org.apache.nifi.controller.status.ConnectionStatus;
import org.apache.nifi.controller.status.PortStatus;
import org.apache.nifi.controller.status.ProcessGroupStatus;
@@ -80,6 +87,7 @@ import org.apache.nifi.web.NiFiCoreException;
import org.apache.nifi.web.ResourceNotFoundException;
import org.apache.nifi.web.api.dto.DocumentedTypeDTO;
import org.apache.nifi.web.api.dto.DtoFactory;
+import org.apache.nifi.web.api.dto.TemplateDTO;
import org.apache.nifi.web.api.dto.provenance.AttributeDTO;
import org.apache.nifi.web.api.dto.provenance.ProvenanceDTO;
import org.apache.nifi.web.api.dto.provenance.ProvenanceEventDTO;
@@ -706,6 +714,79 @@ public class ControllerFacade {
return flowController.getSystemDiagnostics();
}
+ public List<Resource> getResources() {
+ final List<Resource> resources = new ArrayList<>();
+ resources.add(ResourceFactory.getSystemResource());
+ resources.add(ResourceFactory.getControllerResource());
+ resources.add(ResourceFactory.getFlowResource());
+ resources.add(ResourceFactory.getProvenanceResource());
+ resources.add(ResourceFactory.getProxyResource());
+ resources.add(ResourceFactory.getResourceResource());
+
+ final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
+
+ // add each processor
+ for (final ProcessorNode processor : root.findAllProcessors()) {
+ resources.add(ResourceFactory.getComponentResource(ResourceType.Processor, processor.getIdentifier(), processor.getName()));
+ resources.add(ResourceFactory.getComponentProvenanceResource(ResourceType.Processor, processor.getIdentifier(), processor.getName()));
+ }
+
+ // add each connection
+ for (final Connection connection : root.findAllConnections()) {
+ resources.add(ResourceFactory.getComponentResource(ResourceType.Connection, connection.getIdentifier(), connection.getName()));
+ resources.add(ResourceFactory.getFlowFileQueueResource(connection.getIdentifier(), connection.getName()));
+ }
+
+ // add each label
+ for (final Label label : root.findAllLabels()) {
+ resources.add(ResourceFactory.getComponentResource(ResourceType.Label, label.getIdentifier(), label.getValue()));
+ }
+
+ // add each process group
+ for (final ProcessGroup processGroup : root.findAllProcessGroups()) {
+ resources.add(ResourceFactory.getComponentResource(ResourceType.ProcessGroup, processGroup.getIdentifier(), processGroup.getName()));
+ resources.add(ResourceFactory.getComponentProvenanceResource(ResourceType.ProcessGroup, processGroup.getIdentifier(), processGroup.getName()));
+ }
+
+ // add each remote process group
+ for (final RemoteProcessGroup remoteProcessGroup : root.findAllRemoteProcessGroups()) {
+ resources.add(ResourceFactory.getComponentResource(ResourceType.RemoteProcessGroup, remoteProcessGroup.getIdentifier(), remoteProcessGroup.getName()));
+ resources.add(ResourceFactory.getComponentProvenanceResource(ResourceType.RemoteProcessGroup, remoteProcessGroup.getIdentifier(), remoteProcessGroup.getName()));
+ }
+
+ // add each input port
+ for (final Port inputPort : root.findAllInputPorts()) {
+ resources.add(ResourceFactory.getComponentResource(ResourceType.InputPort, inputPort.getIdentifier(), inputPort.getName()));
+ resources.add(ResourceFactory.getComponentProvenanceResource(ResourceType.InputPort, inputPort.getIdentifier(), inputPort.getName()));
+ }
+
+ // add each output port
+ for (final Port outputPort : root.findAllOutputPorts()) {
+ resources.add(ResourceFactory.getComponentResource(ResourceType.OutputPort, outputPort.getIdentifier(), outputPort.getName()));
+ resources.add(ResourceFactory.getComponentProvenanceResource(ResourceType.OutputPort, outputPort.getIdentifier(), outputPort.getName()));
+ }
+
+ // add each controller service
+ for (final ControllerServiceNode controllerService : flowController.getAllControllerServices()) {
+ resources.add(ResourceFactory.getComponentResource(ResourceType.ControllerService, controllerService.getIdentifier(), controllerService.getName()));
+ }
+
+ // add each reporting task
+ for (final ReportingTaskNode reportingTask : flowController.getAllReportingTasks()) {
+ resources.add(ResourceFactory.getComponentResource(ResourceType.ReportingTask, reportingTask.getIdentifier(), reportingTask.getName()));
+ }
+
+ // add each template
+ for (final Template template : flowController.getTemplates()) {
+ final TemplateDTO details = template.getDetails();
+ resources.add(ResourceFactory.getComponentResource(ResourceType.Template, details.getId(), details.getName()));
+ }
+
+ // TODO - need token resource?
+ // resources.add(ResourceFactory.getTokenResource());
+ return resources;
+ }
+
/**
* Gets the available options for searching provenance.
*
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/filter/NodeRequestFilter.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/filter/NodeRequestFilter.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/filter/NodeRequestFilter.java
index 68a693c..a072293 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/filter/NodeRequestFilter.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/filter/NodeRequestFilter.java
@@ -65,16 +65,6 @@ public class NodeRequestFilter implements Filter {
HttpServletRequest httpReq = (HttpServletRequest) req;
HttpServletResponse httpResp = (HttpServletResponse) resp;
- /*
- * If we're the cluster manager or we're sent head requests, continue.
- * Head requests are included because there exists a AJAX/XHR race
- * condition between the following requests:
- * HEAD /nifi-api/cluster
- * GET /nifi-api/controller/config
- * If the head request finishes first, then the UI JavaScript will display
- * a default error message and not display the error message given in this
- * filter for directly accessing connected nodes.
- */
if (properties.isClusterManager() || "HEAD".equalsIgnoreCase(httpReq.getMethod())) {
filterChain.doFilter(req, resp);
} else {
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml
index a73e0b0..0f79369 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml
@@ -156,12 +156,23 @@
</bean>
<!-- rest endpoints -->
+ <bean id="flowResource" class="org.apache.nifi.web.api.FlowResource" scope="singleton">
+ <property name="serviceFacade" ref="serviceFacade"/>
+ <property name="properties" ref="nifiProperties"/>
+ <property name="clusterManager" ref="clusterManager"/>
+ </bean>
+ <bean id="resourceResource" class="org.apache.nifi.web.api.ResourceResource" scope="singleton">
+ <property name="serviceFacade" ref="serviceFacade"/>
+ <property name="properties" ref="nifiProperties"/>
+ <property name="clusterManager" ref="clusterManager"/>
+ </bean>
<bean id="controllerResource" class="org.apache.nifi.web.api.ControllerResource" scope="singleton">
<property name="serviceFacade" ref="serviceFacade"/>
<property name="properties" ref="nifiProperties"/>
<property name="clusterManager" ref="clusterManager"/>
+ <property name="reportingTaskResource" ref="reportingTaskResource"/>
</bean>
- <bean id="bulletinBoardResource" class="org.apache.nifi.web.api.BulletinBoardResource" scope="singleton">
+ <bean id="siteToSiteResource" class="org.apache.nifi.web.api.SiteToSiteResource" scope="singleton">
<property name="serviceFacade" ref="serviceFacade"/>
<property name="properties" ref="nifiProperties"/>
<property name="clusterManager" ref="clusterManager"/>
@@ -192,6 +203,8 @@
<property name="labelResource" ref="labelResource"/>
<property name="remoteProcessGroupResource" ref="remoteProcessGroupResource"/>
<property name="connectionResource" ref="connectionResource"/>
+ <property name="templateResource" ref="templateResource"/>
+ <property name="controllerServiceResource" ref="controllerServiceResource"/>
</bean>
<bean id="processorResource" class="org.apache.nifi.web.api.ProcessorResource" scope="singleton">
<property name="serviceFacade" ref="serviceFacade"/>
@@ -203,6 +216,11 @@
<property name="properties" ref="nifiProperties"/>
<property name="clusterManager" ref="clusterManager"/>
</bean>
+ <bean id="flowfileQueueResource" class="org.apache.nifi.web.api.FlowFileQueueResource" scope="singleton">
+ <property name="serviceFacade" ref="serviceFacade"/>
+ <property name="properties" ref="nifiProperties"/>
+ <property name="clusterManager" ref="clusterManager"/>
+ </bean>
<bean id="remoteProcessGroupResource" class="org.apache.nifi.web.api.RemoteProcessGroupResource" scope="singleton">
<property name="serviceFacade" ref="serviceFacade"/>
<property name="properties" ref="nifiProperties"/>
@@ -228,19 +246,6 @@
<property name="properties" ref="nifiProperties"/>
<property name="clusterManager" ref="clusterManager"/>
</bean>
- <bean id="snippetResource" class="org.apache.nifi.web.api.SnippetResource" scope="singleton">
- <property name="serviceFacade" ref="serviceFacade"/>
- <property name="properties" ref="nifiProperties"/>
- <property name="clusterManager" ref="clusterManager"/>
- <property name="processorResource" ref="processorResource"/>
- <property name="inputPortResource" ref="inputPortResource"/>
- <property name="outputPortResource" ref="outputPortResource"/>
- <property name="funnelResource" ref="funnelResource"/>
- <property name="labelResource" ref="labelResource"/>
- <property name="remoteProcessGroupResource" ref="remoteProcessGroupResource"/>
- <property name="connectionResource" ref="connectionResource"/>
- <property name="processGroupResource" ref="processGroupResource"/>
- </bean>
<bean id="historyResource" class="org.apache.nifi.web.api.HistoryResource" scope="singleton">
<property name="serviceFacade" ref="serviceFacade"/>
</bean>
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-docs/src/main/webapp/js/application.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-docs/src/main/webapp/js/application.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-docs/src/main/webapp/js/application.js
index cdc062e..f22477f 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-docs/src/main/webapp/js/application.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-docs/src/main/webapp/js/application.js
@@ -135,7 +135,7 @@ $(document).ready(function () {
if (top === window) {
$.ajax({
type: 'GET',
- url: '../nifi-api/controller/banners',
+ url: '../nifi-api/flow/banners',
dataType: 'json'
}).then(function (response) {
// ensure the banners response is specified
@@ -184,7 +184,7 @@ $(document).ready(function () {
// get the about details
var about = $.ajax({
type: 'GET',
- url: '../nifi-api/controller/about',
+ url: '../nifi-api/flow/about',
dataType: 'json'
}).done(function (response) {
var aboutDetails = response.about;
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/anonymous/NiFiAnonymousUserFilter.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/anonymous/NiFiAnonymousUserFilter.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/anonymous/NiFiAnonymousUserFilter.java
index 3f45629..3de5a2d 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/anonymous/NiFiAnonymousUserFilter.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/anonymous/NiFiAnonymousUserFilter.java
@@ -16,7 +16,6 @@
*/
package org.apache.nifi.web.security.anonymous;
-import org.apache.nifi.admin.service.KeyService;
import org.apache.nifi.user.NiFiUser;
import org.apache.nifi.web.security.token.NiFiAuthenticationToken;
import org.apache.nifi.web.security.user.NiFiUserDetails;
@@ -28,7 +27,7 @@ import org.springframework.security.web.authentication.AnonymousAuthenticationFi
import javax.servlet.http.HttpServletRequest;
/**
- * Custom AnonymouseAuthenticationFilter used to grant additional authorities depending on the current operating mode.
+ * Custom AnonymousAuthenticationFilter used to grant additional authorities depending on the current operating mode.
*/
public class NiFiAnonymousUserFilter extends AnonymousAuthenticationFilter {
@@ -36,8 +35,6 @@ public class NiFiAnonymousUserFilter extends AnonymousAuthenticationFilter {
private static final String ANONYMOUS_KEY = "anonymousNifiKey";
- private KeyService keyService;
-
public NiFiAnonymousUserFilter() {
super(ANONYMOUS_KEY);
}
@@ -47,9 +44,4 @@ public class NiFiAnonymousUserFilter extends AnonymousAuthenticationFilter {
return new NiFiAuthenticationToken(new NiFiUserDetails(NiFiUser.ANONYMOUS));
}
- /* setters */
- public void setKeyService(KeyService keyService) {
- this.keyService = keyService;
- }
-
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml
index c798191..ab2fa80 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml
@@ -347,6 +347,7 @@
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/provenance/nf-provenance.js</include>
<include>${staging.dir}/js/nf/provenance/nf-provenance-table.js</include>
+ <include>${staging.dir}/js/nf/provenance/nf-provenance-lineage.js</include>
</includes>
</aggregation>
<aggregation>
@@ -361,6 +362,7 @@
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/nf-processor-details.js</include>
<include>${staging.dir}/js/nf/nf-connection-details.js</include>
+ <include>${staging.dir}/js/nf/nf-status-history.js</include>
<include>${staging.dir}/js/nf/summary/nf-summary.js</include>
<include>${staging.dir}/js/nf/summary/nf-summary-table.js</include>
<include>${staging.dir}/js/nf/summary/nf-cluster-search.js</include>
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/java/org/apache/nifi/web/filter/IeEdgeHeader.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/java/org/apache/nifi/web/filter/IeEdgeHeader.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/java/org/apache/nifi/web/filter/IeEdgeHeader.java
deleted file mode 100644
index f45682b..0000000
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/java/org/apache/nifi/web/filter/IeEdgeHeader.java
+++ /dev/null
@@ -1,56 +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.web.filter;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * A filter to set a response header directing IE to use the most recent
- * document mode.
- *
- */
-public class IeEdgeHeader implements Filter {
-
- @Override
- public void doFilter(final ServletRequest req, final ServletResponse resp, final FilterChain filterChain)
- throws IOException, ServletException {
-
- // add the header
- final HttpServletResponse response = (HttpServletResponse) resp;
- response.addHeader("X-UA-Compatible", "IE=edge");
-
- // continue the chain
- filterChain.doFilter(req, resp);
- }
-
- @Override
- public void init(final FilterConfig config) {
- }
-
- @Override
- public void destroy() {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/provenance.properties
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/provenance.properties b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/provenance.properties
index dee70b8..a87195c 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/provenance.properties
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/provenance.properties
@@ -20,7 +20,8 @@ nf.provenance.script.tags=<script type="text/javascript" src="js/nf/nf-namespace
<script type="text/javascript" src="js/nf/nf-storage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/provenance/nf-provenance.js?${project.version}"></script>\n\
-<script type="text/javascript" src="js/nf/provenance/nf-provenance-table.js?${project.version}"></script>
+<script type="text/javascript" src="js/nf/provenance/nf-provenance-table.js?${project.version}"></script>\n\
+<script type="text/javascript" src="js/nf/provenance/nf-provenance-lineage.js?${project.version}"></script>
nf.provenance.style.tags=<link rel="stylesheet" href="css/reset.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/main.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/banner.css?${project.version}" type="text/css" />\n\
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/summary.properties
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/summary.properties b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/summary.properties
index 752ca68..e130655 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/summary.properties
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/summary.properties
@@ -21,6 +21,7 @@ nf.summary.script.tags=<script type="text/javascript" src="js/nf/nf-namespace.js
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-processor-details.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-connection-details.js?${project.version}"></script>\n\
+<script type="text/javascript" src="js/nf/nf-status-history.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/summary/nf-summary.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/summary/nf-summary-table.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/summary/nf-cluster-search.js?${project.version}"></script>
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/canvas.jsp
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/canvas.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/canvas.jsp
index fbab590..6015e18 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/canvas.jsp
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/canvas.jsp
@@ -38,6 +38,7 @@
<link rel="stylesheet" href="js/jquery/slickgrid/css/slick.grid.css" type="text/css" />
<link rel="stylesheet" href="js/jquery/slickgrid/css/slick-default-theme.css" type="text/css" />
<script type="text/javascript" src="js/codemirror/lib/codemirror-compressed.js"></script>
+ <script type="text/javascript" src="js/d3/d3.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/jquery/ui-smoothness/jquery-ui-1.10.4.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery.base64.js"></script>
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/provenance.jsp
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/provenance.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/provenance.jsp
index 496bfd1..eebe3e4 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/provenance.jsp
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/provenance.jsp
@@ -30,6 +30,7 @@
<link rel="stylesheet" href="js/jquery/ui-smoothness/jquery-ui-1.10.4.min.css" type="text/css" />
<link rel="stylesheet" href="js/jquery/slickgrid/css/slick.grid.css" type="text/css" />
<link rel="stylesheet" href="js/jquery/slickgrid/css/slick-default-theme.css" type="text/css" />
+ <script type="text/javascript" src="js/d3/d3.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery.base64.js"></script>
<script type="text/javascript" src="js/jquery/jquery.center.js"></script>
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/summary.jsp
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/summary.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/summary.jsp
index 45dff93..68ca6ab 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/summary.jsp
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/summary.jsp
@@ -36,6 +36,7 @@
<link rel="stylesheet" href="js/jquery/slickgrid/css/slick.grid.css" type="text/css" />
<link rel="stylesheet" href="js/jquery/slickgrid/css/slick-default-theme.css" type="text/css" />
<script type="text/javascript" src="js/codemirror/lib/codemirror-compressed.js"></script>
+ <script type="text/javascript" src="js/d3/d3.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/jquery/ui-smoothness/jquery-ui-1.10.4.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery.base64.js"></script>
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/templates/templates-content.jsp
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/templates/templates-content.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/templates/templates-content.jsp
index 4752e4a..f4f7bab 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/templates/templates-content.jsp
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/templates/templates-content.jsp
@@ -15,7 +15,9 @@
limitations under the License.
--%>
<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div id="templates">
+ <span id="template-group-id" class="hidden"><c:out value="${param.groupId}"/></span>
<div id="templates-header-and-filter">
<div id="templates-header-text">NiFi Templates</div>
<div id="templates-filter-controls">
@@ -39,7 +41,7 @@
<div id="template-browse-container">
<div id="select-template-button" class="template-button">
<span>Browse</span>
- <form id="template-upload-form" enctype="multipart/form-data" method="post" action="../nifi-api/controller/templates">
+ <form id="template-upload-form" enctype="multipart/form-data" method="post">
<input type="file" name="template" id="template-file-field"/>
</form>
</div>
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml
index e577209..e940b6e 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml
@@ -136,15 +136,6 @@
<url-pattern>/login</url-pattern>
</servlet-mapping>
- <filter>
- <filter-name>IeEdgeHeader</filter-name>
- <filter-class>org.apache.nifi.web.filter.IeEdgeHeader</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>IeEdgeHeader</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
<welcome-file-list>
<welcome-file>canvas.jsp</welcome-file>
<welcome-file>/WEB-INF/pages/canvas.jsp</welcome-file>
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
index 4de1e1c..c334103 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
@@ -810,7 +810,7 @@
var promptForNewControllerService = function (gridContainer, grid, item, serviceType, configurationOptions) {
$.ajax({
type: 'GET',
- url: '../nifi-api/controller/controller-service-types',
+ url: '../nifi-api/flow/controller-service-types',
data: {
serviceType: serviceType
},
http://git-wip-us.apache.org/repos/asf/nifi/blob/add29816/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/bulletin-board/nf-bulletin-board.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/bulletin-board/nf-bulletin-board.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/bulletin-board/nf-bulletin-board.js
index d318d27..7db1b0e 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/bulletin-board/nf-bulletin-board.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/bulletin-board/nf-bulletin-board.js
@@ -32,9 +32,9 @@ nf.BulletinBoard = (function () {
maxBulletins: 1000,
defaultFilterText: 'Filter',
urls: {
- banners: '../nifi-api/controller/banners',
- controllerAbout: '../nifi-api/controller/about',
- bulletinBoard: '../nifi-api/bulletin-board'
+ banners: '../nifi-api/flow/banners',
+ about: '../nifi-api/flow/about',
+ bulletinBoard: '../nifi-api/flow/bulletin-board'
},
styles: {
filterList: 'bulletin-board-filter-list',
@@ -113,7 +113,7 @@ nf.BulletinBoard = (function () {
// get the about details
var getTitle = $.ajax({
type: 'GET',
- url: config.urls.controllerAbout,
+ url: config.urls.about,
dataType: 'json'
}).done(function (response) {
var aboutDetails = response.about;