You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2016/04/15 22:03:59 UTC
[07/22] nifi git commit: NIFI-1551: - Removing the AuthorityProvider.
- Refactoring REST API in preparation for introduction of the Authorizer. -
Updating UI accordingly. - Removing unneeded properties from nifi.properties.
- Addressing comments from PR.
http://git-wip-us.apache.org/repos/asf/nifi/blob/153f63ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserResource.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/UserResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserResource.java
deleted file mode 100644
index 1426999..0000000
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserResource.java
+++ /dev/null
@@ -1,617 +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.Responses;
-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 java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-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.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import org.apache.nifi.cluster.manager.NodeResponse;
-import org.apache.nifi.cluster.manager.impl.WebClusterManager;
-import org.apache.nifi.util.NiFiProperties;
-import org.apache.nifi.web.api.dto.UserDTO;
-import org.apache.nifi.web.api.dto.search.UserGroupSearchResultDTO;
-import org.apache.nifi.web.api.dto.search.UserSearchResultDTO;
-import org.apache.nifi.web.api.entity.UserEntity;
-import org.apache.nifi.web.api.entity.UserSearchResultsEntity;
-import org.apache.nifi.web.api.entity.UsersEntity;
-import org.apache.nifi.web.api.request.ClientIdParameter;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.nifi.user.NiFiUser;
-import org.apache.nifi.web.NiFiServiceFacade;
-import static org.apache.nifi.web.api.ApplicationResource.CLIENT_ID;
-import org.apache.nifi.web.api.dto.RevisionDTO;
-import org.apache.nifi.web.security.user.NiFiUserUtils;
-import org.springframework.security.access.prepost.PreAuthorize;
-
-/**
- * RESTful endpoint for managing this Controller's users.
- */
-@Api(hidden = true)
-public class UserResource extends ApplicationResource {
-
- /*
- * Developer Note: Clustering assumes a centralized security provider. The
- * cluster manager will manage user accounts when in clustered mode and
- * interface with the authorization provider. However, when nodes perform
- * Site-to-Site, the authorization details of the remote NiFi will be cached
- * locally. These details need to be invalidated when certain actions are
- * performed (revoking/deleting accounts, changing user authorities, user
- * group, etc).
- */
- private WebClusterManager clusterManager;
- private NiFiProperties properties;
- private NiFiServiceFacade serviceFacade;
-
- /**
- * Creates a new user account request.
- *
- * @return A string
- */
- @POST
- @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
- @Produces(MediaType.TEXT_PLAIN)
- @Path("") // necessary due to a bug in swagger
- @ApiOperation(
- value = "Creates a user",
- response = String.class
- )
- public Response createUser() {
- if (!properties.getSupportNewAccountRequests()) {
- return Responses.notFound().entity("This NiFi does not support new account requests.").build();
- }
-
- final NiFiUser nifiUser = NiFiUserUtils.getNiFiUser();
- if (nifiUser != null) {
- throw new IllegalArgumentException("User account already created " + nifiUser.getIdentity());
- }
-
- // create an account request for the current user
- final UserDTO user = serviceFacade.createUser();
-
- final String uri = generateResourceUri("controller", "users", user.getId());
- return generateCreatedResponse(URI.create(uri), "Not authorized. User account created. Authorization pending.").build();
- }
-
- /**
- * Gets all users that are registered within this Controller.
- *
- * @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 grouped Whether to return the users in their groups.
- * @return A usersEntity.
- */
- @GET
- @Consumes(MediaType.WILDCARD)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Path("") // necessary due to a bug in swagger
- @PreAuthorize("hasRole('ROLE_ADMIN')")
- @ApiOperation(
- value = "Gets all users",
- response = UsersEntity.class,
- authorizations = {
- @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 getUsers(
- @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 return the users in their respective groups.",
- required = false
- )
- @QueryParam("grouped") @DefaultValue("false") Boolean grouped) {
-
- // get the users
- final Collection<UserDTO> users = serviceFacade.getUsers(grouped);
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- revision.setClientId(clientId.getClientId());
-
- // create the response entity
- final UsersEntity usersEntity = new UsersEntity();
- usersEntity.setRevision(revision);
- usersEntity.setUsers(users);
- usersEntity.setGenerated(new Date());
-
- // build the response
- return generateOkResponse(usersEntity).build();
- }
-
- /**
- * Gets the details for the specified user.
- *
- * @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 user id.
- * @return A userEntity.
- */
- @GET
- @Consumes(MediaType.WILDCARD)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @PreAuthorize("hasRole('ROLE_ADMIN')")
- @Path("/{id}")
- @ApiOperation(
- value = "Gets a user",
- response = UserEntity.class,
- authorizations = {
- @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 getUser(
- @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 user id.",
- required = true
- )
- @PathParam("id") String id) {
-
- // get the specified user
- final UserDTO userDTO = serviceFacade.getUser(id);
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- revision.setClientId(clientId.getClientId());
-
- // create the response entity
- final UserEntity userEntity = new UserEntity();
- userEntity.setRevision(revision);
- userEntity.setUser(userDTO);
-
- // build the response
- return generateOkResponse(userEntity).build();
- }
-
- /**
- * Searches for users with match the specified query.
- *
- * @param value Search value that will be matched against users
- * @return A userSearchResultsEntity
- */
- @GET
- @Consumes(MediaType.WILDCARD)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Path("/search-results")
- @PreAuthorize("hasAnyRole('ROLE_DFM', 'ROLE_ADMIN')")
- @ApiOperation(
- value = "Searches for users",
- response = UserSearchResultsEntity.class,
- authorizations = {
- @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 searchUsers(
- @ApiParam(
- value = "The search terms.",
- required = true
- )
- @QueryParam("q") @DefaultValue(StringUtils.EMPTY) String value) {
-
- final List<UserSearchResultDTO> userMatches = new ArrayList<>();
- final List<UserGroupSearchResultDTO> userGroupMatches = new ArrayList<>();
-
- // get the users
- final Collection<UserDTO> users = serviceFacade.getUsers(Boolean.FALSE);
- final Collection<String> matchedGroups = new HashSet<>();
-
- // check each to see if it matches the search term
- for (UserDTO user : users) {
- // count the user if there is no search or it matches the address
- if (StringUtils.isBlank(value)) {
- // record the group match if there is one and it hasn't already been encountered
- if (user.getUserGroup() != null && !matchedGroups.contains(user.getUserGroup())) {
- // add the matched group
- matchedGroups.add(user.getUserGroup());
-
- // record the group match
- final UserGroupSearchResultDTO userGroupMatch = new UserGroupSearchResultDTO();
- userGroupMatch.setGroup(user.getUserGroup());
- userGroupMatches.add(userGroupMatch);
- }
-
- // record the user match
- final UserSearchResultDTO userMatch = new UserSearchResultDTO();
- userMatch.setUserDn(user.getDn());
- userMatch.setUserName(user.getUserName());
- userMatches.add(userMatch);
- } else {
- // look for a user match
- if (StringUtils.containsIgnoreCase(user.getDn(), value) || StringUtils.containsIgnoreCase(user.getUserName(), value)) {
- // record the user match
- final UserSearchResultDTO userMatch = new UserSearchResultDTO();
- userMatch.setUserDn(user.getDn());
- userMatch.setUserName(user.getUserName());
- userMatches.add(userMatch);
- }
-
- // look for a dn match
- if (StringUtils.containsIgnoreCase(user.getUserGroup(), value)) {
- // record the group match if it hasn't already been encountered
- if (!matchedGroups.contains(user.getUserGroup())) {
- // add the matched group
- matchedGroups.add(user.getUserGroup());
-
- // record the group match
- final UserGroupSearchResultDTO userGroupMatch = new UserGroupSearchResultDTO();
- userGroupMatch.setGroup(user.getUserGroup());
- userGroupMatches.add(userGroupMatch);
- }
- }
- }
- }
-
- // sort the user matches
- Collections.sort(userMatches, new Comparator<UserSearchResultDTO>() {
- @Override
- public int compare(UserSearchResultDTO user1, UserSearchResultDTO user2) {
- return user1.getUserName().compareTo(user2.getUserName());
- }
- });
-
- // sort the user group matches
- Collections.sort(userGroupMatches, new Comparator<UserGroupSearchResultDTO>() {
- @Override
- public int compare(UserGroupSearchResultDTO userGroup1, UserGroupSearchResultDTO userGroup2) {
- return userGroup1.getGroup().compareTo(userGroup2.getGroup());
- }
- });
-
- // build the response
- final UserSearchResultsEntity results = new UserSearchResultsEntity();
- results.setUserResults(userMatches);
- results.setUserGroupResults(userGroupMatches);
-
- // generate an 200 - OK response
- return noCache(Response.ok(results)).build();
- }
-
- /**
- * Updates the specified user.
- *
- * @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 id The id of the user to update.
- * @param rawAuthorities Array of authorities to assign to the specified user.
- * @param status The status of the specified users account.
- * @param formParams form params
- * @return A userEntity
- */
- @PUT
- @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @PreAuthorize("hasRole('ROLE_ADMIN')")
- @Path("/{id}")
- public Response updateUser(
- @Context HttpServletRequest httpServletRequest,
- @FormParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId,
- @PathParam("id") String id,
- @FormParam("authorities[]") Set<String> rawAuthorities,
- @FormParam("status") String status,
- MultivaluedMap<String, String> formParams) {
-
- // create the user
- final UserDTO userDTO = new UserDTO();
- userDTO.setId(id);
- userDTO.setStatus(status);
-
- // get the collection of specified authorities
- final Set<String> authorities = new HashSet<>();
- for (String authority : rawAuthorities) {
- if (StringUtils.isNotBlank(authority)) {
- authorities.add(authority);
- }
- }
-
- // set the authorities
- if (!authorities.isEmpty() || formParams.containsKey("authorities")) {
- userDTO.setAuthorities(authorities);
- }
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- revision.setClientId(clientId.getClientId());
-
- // create the user entity
- UserEntity userEntity = new UserEntity();
- userEntity.setRevision(revision);
- userEntity.setUser(userDTO);
-
- // update the user
- return updateUser(httpServletRequest, id, userEntity);
- }
-
- /**
- * Updates the specified user.
- *
- * @param httpServletRequest request
- * @param id The id of the user to update.
- * @param userEntity A userEntity
- * @return A userEntity
- */
- @PUT
- @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @PreAuthorize("hasRole('ROLE_ADMIN')")
- @Path("/{id}")
- @ApiOperation(
- value = "Updates a user",
- response = UserEntity.class,
- authorizations = {
- @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 updateUser(
- @Context HttpServletRequest httpServletRequest,
- @ApiParam(
- value = "The user id.",
- required = true
- )
- @PathParam("id") String id,
- @ApiParam(
- value = "The user configuration details.",
- required = true
- ) UserEntity userEntity) {
-
- if (userEntity == null || userEntity.getUser() == null) {
- throw new IllegalArgumentException("User details must be specified.");
- }
-
- // ensure the same user id is being used
- final UserDTO userDTO = userEntity.getUser();
- if (!id.equals(userDTO.getId())) {
- throw new IllegalArgumentException(String.format("The user id (%s) in the request body does "
- + "not equal the user id of the requested resource (%s).", userDTO.getId(), id));
- }
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- if (userEntity.getRevision() == null) {
- revision.setClientId(new ClientIdParameter().getClientId());
- } else {
- revision.setClientId(userEntity.getRevision().getClientId());
- }
-
- // this user is being modified, replicate to the nodes to invalidate this account
- // so that it will be re-authorized during the next attempted access - if this wasn't
- // done the account would remain stale for up to the configured cache duration. this
- // is acceptable sometimes but when updating a users authorities or groups via the UI
- // they shouldn't have to wait for the changes to take effect`
- 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);
-
- // identify yourself as the NCM attempting to invalidate the user
- final Map<String, String> headers = getHeaders(headersToOverride);
- headers.put(WebClusterManager.CLUSTER_INVALIDATE_USER_HEADER, Boolean.TRUE.toString());
-
- final RevisionDTO invalidateUserRevision = new RevisionDTO();
- revision.setClientId(revision.getClientId());
-
- final UserDTO invalidateUser = new UserDTO();
- invalidateUser.setId(userDTO.getId());
-
- final UserEntity invalidateUserEntity = new UserEntity();
- invalidateUserEntity.setRevision(invalidateUserRevision);
- invalidateUserEntity.setUser(userDTO);
-
- // replicate the invalidate request to each node - if this request is not successful return that fact,
- // otherwise continue with the desired user modification
- final NodeResponse response = clusterManager.applyRequest(HttpMethod.PUT, getAbsolutePath(), invalidateUserEntity, headers);
- if (!response.is2xx()) {
- return response.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();
- }
-
- // handle an invalidate request from the NCM
- final String invalidateRequest = httpServletRequest.getHeader(WebClusterManager.CLUSTER_INVALIDATE_USER_HEADER);
- if (invalidateRequest != null) {
- serviceFacade.invalidateUser(id);
- return generateOkResponse().build();
- }
-
- // update the user
- final UserDTO reponseUserDTO = serviceFacade.updateUser(userDTO);
-
- // create the response entity
- UserEntity responseUserEntity = new UserEntity();
- responseUserEntity.setRevision(revision);
- responseUserEntity.setUser(reponseUserDTO);
-
- // build the response
- return generateOkResponse(responseUserEntity).build();
- }
-
- /**
- * Deletes the specified user.
- *
- * @param httpServletRequest request
- * @param id The user id
- * @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 userEntity.
- */
- @DELETE
- @Consumes(MediaType.WILDCARD)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Path("/{id}")
- @PreAuthorize("hasRole('ROLE_ADMIN')")
- @ApiOperation(
- value = "Deletes a user",
- response = UserEntity.class,
- authorizations = {
- @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 deleteUser(
- @Context HttpServletRequest httpServletRequest,
- @ApiParam(
- value = "The user id.",
- required = true
- )
- @PathParam("id") String id,
- @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) {
-
- // this user is being modified, replicate to the nodes to invalidate this account
- // so that it will be re-authorized during the next attempted access - if this wasn't
- // done the account would remain stale for up to the configured cache duration. this
- // is acceptable sometimes but when removing a user via the UI they shouldn't have to
- // wait for the changes to take effect
- if (properties.isClusterManager()) {
- // identify yourself as the NCM attempting to invalidate the user
- final Map<String, String> headers = getHeaders();
- headers.put(WebClusterManager.CLUSTER_INVALIDATE_USER_HEADER, Boolean.TRUE.toString());
-
- // replicate the invalidate request to each node - if this request is not successful return that fact,
- // otherwise continue with the desired user modification
- final NodeResponse response = clusterManager.applyRequest(HttpMethod.DELETE, getAbsolutePath(), getRequestParameters(true), headers);
- if (!response.is2xx()) {
- return response.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();
- }
-
- // handle an invalidate request from the NCM
- final String invalidateRequest = httpServletRequest.getHeader(WebClusterManager.CLUSTER_INVALIDATE_USER_HEADER);
- if (invalidateRequest != null) {
- serviceFacade.invalidateUser(id);
- return generateOkResponse().build();
- }
-
- // ungroup the specified user
- serviceFacade.deleteUser(id);
-
- // create the revision
- final RevisionDTO revision = new RevisionDTO();
- revision.setClientId(clientId.getClientId());
-
- // create the response entity
- final UserEntity entity = new UserEntity();
- entity.setRevision(revision);
-
- // generate ok response
- return generateOkResponse(entity).build();
- }
-
- /* setters */
- public void setServiceFacade(NiFiServiceFacade serviceFacade) {
- this.serviceFacade = serviceFacade;
- }
-
- public void setProperties(NiFiProperties properties) {
- this.properties = properties;
- }
-
- public void setClusterManager(WebClusterManager clusterManager) {
- this.clusterManager = clusterManager;
- }
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/153f63ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/AccountNotFoundExceptionMapper.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/config/AccountNotFoundExceptionMapper.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/AccountNotFoundExceptionMapper.java
deleted file mode 100644
index 8fed1a2..0000000
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/AccountNotFoundExceptionMapper.java
+++ /dev/null
@@ -1,47 +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.config;
-
-import com.sun.jersey.api.Responses;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-import org.apache.nifi.admin.service.AccountNotFoundException;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Maps resource not found exceptions into client responses.
- */
-@Provider
-public class AccountNotFoundExceptionMapper implements ExceptionMapper<AccountNotFoundException> {
-
- private static final Logger logger = LoggerFactory.getLogger(AccountNotFoundExceptionMapper.class);
-
- @Override
- public Response toResponse(AccountNotFoundException exception) {
- logger.info(String.format("%s. Returning %s response.", exception, Response.Status.NOT_FOUND));
-
- if (logger.isDebugEnabled()) {
- logger.debug(StringUtils.EMPTY, exception);
- }
-
- return Responses.notFound().entity(exception.getMessage()).type("text/plain").build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/153f63ef/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 5e7a902..0ae7649 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
@@ -16,29 +16,6 @@
*/
package org.apache.nifi.web.api.dto;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.concurrent.TimeUnit;
-
-import javax.ws.rs.WebApplicationException;
-
import org.apache.nifi.action.Action;
import org.apache.nifi.action.component.details.ComponentDetails;
import org.apache.nifi.action.component.details.ExtensionDetails;
@@ -57,7 +34,6 @@ 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.Authority;
import org.apache.nifi.cluster.HeartbeatPayload;
import org.apache.nifi.cluster.event.Event;
import org.apache.nifi.cluster.manager.StatusMerger;
@@ -122,8 +98,6 @@ import org.apache.nifi.reporting.Bulletin;
import org.apache.nifi.reporting.BulletinRepository;
import org.apache.nifi.reporting.ReportingTask;
import org.apache.nifi.scheduling.SchedulingStrategy;
-import org.apache.nifi.user.NiFiUser;
-import org.apache.nifi.user.NiFiUserGroup;
import org.apache.nifi.util.FormatUtils;
import org.apache.nifi.web.FlowModification;
import org.apache.nifi.web.Revision;
@@ -155,6 +129,28 @@ import org.apache.nifi.web.api.dto.status.ProcessorStatusSnapshotDTO;
import org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusDTO;
import org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusSnapshotDTO;
+import javax.ws.rs.WebApplicationException;
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.TimeUnit;
+
public final class DtoFactory {
@SuppressWarnings("rawtypes")
@@ -2534,57 +2530,6 @@ public final class DtoFactory {
return revisionDTO;
}
- /**
- * Factory method for creating a new user transfer object.
- *
- * @param user user
- * @return dto
- */
- public UserDTO createUserDTO(NiFiUser user) {
- // convert the users authorities
- Set<String> authorities = Authority.convertAuthorities(user.getAuthorities());
-
- // create the user
- UserDTO userDTO = new UserDTO();
- userDTO.setId(String.valueOf(user.getId()));
- userDTO.setDn(user.getIdentity());
- userDTO.setUserName(user.getUserName());
- userDTO.setUserGroup(user.getUserGroup());
- userDTO.setJustification(user.getJustification());
- userDTO.setAuthorities(authorities);
-
- // ensure the date fields are not null
- if (user.getCreation() != null) {
- userDTO.setCreation(user.getCreation());
- }
- if (user.getLastAccessed() != null) {
- userDTO.setLastAccessed(user.getLastAccessed());
- }
- if (user.getLastVerified() != null) {
- userDTO.setLastVerified(user.getLastVerified());
- }
- if (user.getStatus() != null) {
- userDTO.setStatus(user.getStatus().toString());
- }
-
- return userDTO;
- }
-
- public UserGroupDTO createUserGroupDTO(NiFiUserGroup userGroup) {
- UserGroupDTO userGroupDto = new UserGroupDTO();
- userGroupDto.setGroup(userGroup.getGroup());
- userGroupDto.setUserIds(new HashSet<String>());
-
- // set the users if they have been specified
- if (userGroup.getUsers() != null) {
- for (NiFiUser user : userGroup.getUsers()) {
- userGroupDto.getUserIds().add(String.valueOf(user.getId()));
- }
- }
-
- return userGroupDto;
- }
-
public NodeDTO createNodeDTO(Node node, List<Event> events, boolean primary) {
final NodeDTO nodeDto = new NodeDTO();
http://git-wip-us.apache.org/repos/asf/nifi/blob/153f63ef/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 68d0dbe..7377985 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
@@ -19,8 +19,7 @@ package org.apache.nifi.web.controller;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.StringUtils;
-import org.apache.nifi.admin.service.UserService;
-import org.apache.nifi.authorization.DownloadAuthorization;
+import org.apache.nifi.admin.service.KeyService;
import org.apache.nifi.cluster.protocol.NodeIdentifier;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.connectable.Connectable;
@@ -104,7 +103,6 @@ import org.apache.nifi.web.security.ProxiedEntitiesUtils;
import org.apache.nifi.web.security.user.NiFiUserUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.security.access.AccessDeniedException;
import javax.ws.rs.WebApplicationException;
import java.io.IOException;
@@ -133,7 +131,7 @@ public class ControllerFacade {
// nifi components
private FlowController flowController;
private FlowService flowService;
- private UserService userService;
+ private KeyService keyService;
// properties
private NiFiProperties properties;
@@ -242,22 +240,20 @@ public class ControllerFacade {
/**
* Returns the status history for the specified processor.
*
- * @param groupId group id
* @param processorId processor id
* @return status history
*/
- public StatusHistoryDTO getProcessorStatusHistory(final String groupId, final String processorId) {
+ public StatusHistoryDTO getProcessorStatusHistory(final String processorId) {
return flowController.getProcessorStatusHistory(processorId);
}
/**
* Returns the status history for the specified connection.
*
- * @param groupId group id
* @param connectionId connection id
* @return status history
*/
- public StatusHistoryDTO getConnectionStatusHistory(final String groupId, final String connectionId) {
+ public StatusHistoryDTO getConnectionStatusHistory(final String connectionId) {
return flowController.getConnectionStatusHistory(connectionId);
}
@@ -274,11 +270,10 @@ public class ControllerFacade {
/**
* Returns the status history for the specified remote process group.
*
- * @param groupId group id
* @param remoteProcessGroupId remote process group id
* @return status history
*/
- public StatusHistoryDTO getRemoteProcessGroupStatusHistory(final String groupId, final String remoteProcessGroupId) {
+ public StatusHistoryDTO getRemoteProcessGroupStatusHistory(final String remoteProcessGroupId) {
return flowController.getRemoteProcessGroupStatusHistory(remoteProcessGroupId);
}
@@ -489,11 +484,20 @@ public class ControllerFacade {
/**
* Gets the status for the specified processor.
*
- * @param groupId group id
* @param processorId processor id
* @return the status for the specified processor
*/
- public ProcessorStatusDTO getProcessorStatus(final String groupId, final String processorId) {
+ public ProcessorStatusDTO getProcessorStatus(final String processorId) {
+ final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
+ final ProcessorNode processor = root.findProcessor(processorId);
+
+ // ensure the processor was found
+ if (processor == null) {
+ throw new ResourceNotFoundException(String.format("Unable to locate processor with id '%s'.", processorId));
+ }
+
+ // calculate the process group status
+ final String groupId = processor.getProcessGroup().getIdentifier();
final ProcessGroupStatus processGroupStatus = flowController.getGroupStatus(groupId);
if (processGroupStatus == null) {
throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId));
@@ -511,11 +515,20 @@ public class ControllerFacade {
/**
* Gets the status for the specified connection.
*
- * @param groupId group id
* @param connectionId connection id
* @return the status for the specified connection
*/
- public ConnectionStatusDTO getConnectionStatus(final String groupId, final String connectionId) {
+ public ConnectionStatusDTO getConnectionStatus(final String connectionId) {
+ final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
+ final Connection connection = root.findConnection(connectionId);
+
+ // ensure the connection was found
+ if (connection == null) {
+ throw new ResourceNotFoundException(String.format("Unable to locate connection with id '%s'.", connectionId));
+ }
+
+ // calculate the process group status
+ final String groupId = connection.getProcessGroup().getIdentifier();
final ProcessGroupStatus processGroupStatus = flowController.getGroupStatus(groupId);
if (processGroupStatus == null) {
throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId));
@@ -533,11 +546,19 @@ public class ControllerFacade {
/**
* Gets the status for the specified input port.
*
- * @param groupId group id
* @param portId input port id
* @return the status for the specified input port
*/
- public PortStatusDTO getInputPortStatus(final String groupId, final String portId) {
+ public PortStatusDTO getInputPortStatus(final String portId) {
+ final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
+ final Port port = root.findInputPort(portId);
+
+ // ensure the input port was found
+ if (port == null) {
+ throw new ResourceNotFoundException(String.format("Unable to locate input port with id '%s'.", portId));
+ }
+
+ final String groupId = port.getProcessGroup().getIdentifier();
final ProcessGroupStatus processGroupStatus = flowController.getGroupStatus(groupId);
if (processGroupStatus == null) {
throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId));
@@ -555,11 +576,19 @@ public class ControllerFacade {
/**
* Gets the status for the specified output port.
*
- * @param groupId group id
* @param portId output port id
* @return the status for the specified output port
*/
- public PortStatusDTO getOutputPortStatus(final String groupId, final String portId) {
+ public PortStatusDTO getOutputPortStatus(final String portId) {
+ final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
+ final Port port = root.findOutputPort(portId);
+
+ // ensure the output port was found
+ if (port == null) {
+ throw new ResourceNotFoundException(String.format("Unable to locate output port with id '%s'.", portId));
+ }
+
+ final String groupId = port.getProcessGroup().getIdentifier();
final ProcessGroupStatus processGroupStatus = flowController.getGroupStatus(groupId);
if (processGroupStatus == null) {
throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId));
@@ -577,11 +606,19 @@ public class ControllerFacade {
/**
* Gets the status for the specified remote process group.
*
- * @param groupId group id
* @param remoteProcessGroupId remote process group id
* @return the status for the specified remote process group
*/
- public RemoteProcessGroupStatusDTO getRemoteProcessGroupStatus(final String groupId, final String remoteProcessGroupId) {
+ public RemoteProcessGroupStatusDTO getRemoteProcessGroupStatus(final String remoteProcessGroupId) {
+ final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
+ final RemoteProcessGroup remoteProcessGroup = root.findRemoteProcessGroup(remoteProcessGroupId);
+
+ // ensure the output port was found
+ if (remoteProcessGroup == null) {
+ throw new ResourceNotFoundException(String.format("Unable to locate remote process group with id '%s'.", remoteProcessGroupId));
+ }
+
+ final String groupId = remoteProcessGroup.getProcessGroup().getIdentifier();
final ProcessGroupStatus processGroupStatus = flowController.getGroupStatus(groupId);
if (processGroupStatus == null) {
throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId));
@@ -949,11 +986,11 @@ public class ControllerFacade {
// calculate the dn chain
final List<String> dnChain = ProxiedEntitiesUtils.buildProxiedEntitiesChain(user);
- // ensure the users in this chain are allowed to download this content
- final DownloadAuthorization downloadAuthorization = userService.authorizeDownload(dnChain, attributes);
- if (!downloadAuthorization.isApproved()) {
- throw new AccessDeniedException(downloadAuthorization.getExplanation());
- }
+ // TODO - ensure the users in this chain are allowed to download this content
+// final DownloadAuthorization downloadAuthorization = keyService.authorizeDownload(dnChain, attributes);
+// if (!downloadAuthorization.isApproved()) {
+// throw new AccessDeniedException(downloadAuthorization.getExplanation());
+// }
// get the filename and fall back to the identifier (should never happen)
String filename = attributes.get(CoreAttributes.FILENAME.key());
@@ -1526,8 +1563,8 @@ public class ControllerFacade {
this.properties = properties;
}
- public void setUserService(UserService userService) {
- this.userService = userService;
+ public void setKeyService(KeyService keyService) {
+ this.keyService = keyService;
}
public void setFlowService(FlowService flowService) {
http://git-wip-us.apache.org/repos/asf/nifi/blob/153f63ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java
index 2e1e8fd..98caa34 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java
@@ -28,61 +28,47 @@ import java.util.Set;
public interface ConnectionDAO {
/**
+ * Determines if the specified connection exists.
+ *
+ * @param id id
+ * @return true if connection exists
+ */
+ boolean hasConnection(String id);
+
+ /**
* Gets the specified Connection.
*
- * @param groupId group id
* @param id The connection id
* @return The connection
*/
- Connection getConnection(String groupId, String id);
+ Connection getConnection(String id);
/**
* Gets the specified flow file drop request.
*
- * @param groupId group id
* @param id The id of the connection
* @param dropRequestId The drop request id
* @return The drop request status
*/
- DropFlowFileStatus getFlowFileDropRequest(String groupId, String id, String dropRequestId);
+ DropFlowFileStatus getFlowFileDropRequest(String id, String dropRequestId);
/**
* Gets the specified flowfile listing request.
*
- * @param groupId group id
* @param id connection id
* @param listingRequestId The listing request id
* @return The listing request status
*/
- ListFlowFileStatus getFlowFileListingRequest(String groupId, String id, String listingRequestId);
+ ListFlowFileStatus getFlowFileListingRequest(String id, String listingRequestId);
/**
* Gets the specified flowfile in the specified connection.
*
- * @param groupId group id
* @param id connection id
* @param flowFileUuid the flowfile uuid
* @return The flowfile
*/
- FlowFileRecord getFlowFile(String groupId, String id, String flowFileUuid);
-
- /**
- * Gets the connections for the specified source processor.
- *
- * @param groupId group id
- * @param processorId processor id
- * @return connections
- */
- Set<Connection> getConnectionsForSource(String groupId, String processorId);
-
- /**
- * Determines if the specified connection exists.
- *
- * @param groupId group id
- * @param id id
- * @return true if connection exists
- */
- boolean hasConnection(String groupId, String id);
+ FlowFileRecord getFlowFile(String id, String flowFileUuid);
/**
* Gets all of the connections.
@@ -95,7 +81,7 @@ public interface ConnectionDAO {
/**
* Creates a new Connection.
*
- * @param groupId group id
+ * @param groupId The group id
* @param connectionDTO The connection DTO
* @return The connection
*/
@@ -104,35 +90,32 @@ public interface ConnectionDAO {
/**
* Creates a new flow file drop request.
*
- * @param groupId group id
* @param id connection id
* @param dropRequestId drop request id
* @return The drop request status
*/
- DropFlowFileStatus createFlowFileDropRequest(String groupId, String id, String dropRequestId);
+ DropFlowFileStatus createFlowFileDropRequest(String id, String dropRequestId);
/**
* Creates a new flow file listing request.
*
- * @param groupId group id
* @param id connection id
* @param listingRequestId listing request id
* @return The listing request status
*/
- ListFlowFileStatus createFlowFileListingRequest(String groupId, String id, String listingRequestId);
+ ListFlowFileStatus createFlowFileListingRequest(String id, String listingRequestId);
/**
* Verifies the listing can be processed.
*
- * @param groupId group id
* @param id connection id
*/
- void verifyList(String groupId, String id);
+ void verifyList(String id);
/**
* Verifies the create request can be processed.
*
- * @param groupId group id
+ * @param groupId The group id
* @param connectionDTO connection
*/
void verifyCreate(String groupId, ConnectionDTO connectionDTO);
@@ -140,64 +123,57 @@ public interface ConnectionDAO {
/**
* Verifies the update request can be processed.
*
- * @param groupId group id
* @param connectionDTO connection
*/
- void verifyUpdate(String groupId, ConnectionDTO connectionDTO);
+ void verifyUpdate(ConnectionDTO connectionDTO);
/**
* Updates the specified Connection.
*
- * @param groupId group id
* @param connectionDTO The connection DTO
* @return The connection
*/
- Connection updateConnection(String groupId, ConnectionDTO connectionDTO);
+ Connection updateConnection(ConnectionDTO connectionDTO);
/**
* Verifies the delete request can be processed.
*
- * @param groupId group id
* @param id id
*/
- void verifyDelete(String groupId, String id);
+ void verifyDelete(String id);
/**
* Deletes the specified Connection.
*
- * @param groupId group id
* @param id The id of the connection
*/
- void deleteConnection(String groupId, String id);
+ void deleteConnection(String id);
/**
* Deletes the specified flow file drop request.
*
- * @param groupId group id
* @param id The id of the connection
* @param dropRequestId The drop request id
* @return The drop request
*/
- DropFlowFileStatus deleteFlowFileDropRequest(String groupId, String id, String dropRequestId);
+ DropFlowFileStatus deleteFlowFileDropRequest(String id, String dropRequestId);
/**
* Deletes the specified flow file listing request.
*
- * @param groupId group id
* @param id connection id
* @param listingRequestId The listing request id
* @return The listing request status
*/
- ListFlowFileStatus deleteFlowFileListingRequest(String groupId, String id, String listingRequestId);
+ ListFlowFileStatus deleteFlowFileListingRequest(String id, String listingRequestId);
/**
* Gets the content for the specified flowfile in the specified connection.
*
- * @param groupId group id
* @param id connection id
* @param flowfileUuid flowfile uuid
* @param requestUri request uri
* @return The downloadable content
*/
- DownloadableContent getContent(String groupId, String id, String flowfileUuid, String requestUri);
+ DownloadableContent getContent(String id, String flowfileUuid, String requestUri);
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/153f63ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/FunnelDAO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/FunnelDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/FunnelDAO.java
index 278405a..858da8d 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/FunnelDAO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/FunnelDAO.java
@@ -16,19 +16,18 @@
*/
package org.apache.nifi.web.dao;
-import java.util.Set;
-
import org.apache.nifi.connectable.Funnel;
import org.apache.nifi.web.api.dto.FunnelDTO;
+import java.util.Set;
+
public interface FunnelDAO {
/**
- * @param groupId group id
* @param funnelId funnel id
* @return Determines if the specified funnel exists in the specified group
*/
- boolean hasFunnel(String groupId, String funnelId);
+ boolean hasFunnel(String funnelId);
/**
* Creates a funnel in the specified group.
@@ -40,13 +39,12 @@ public interface FunnelDAO {
Funnel createFunnel(String groupId, FunnelDTO funnelDTO);
/**
- * Gets the specified funnel in the specified group.
+ * Gets the specified funnel.
*
- * @param groupId group id
* @param funnelId The funnel id
* @return The funnel
*/
- Funnel getFunnel(String groupId, String funnelId);
+ Funnel getFunnel(String funnelId);
/**
* Gets all of the funnels in the specified group.
@@ -57,27 +55,24 @@ public interface FunnelDAO {
Set<Funnel> getFunnels(String groupId);
/**
- * Updates the specified funnel in the specified group.
+ * Updates the specified funnel.
*
- * @param groupId group id
* @param funnelDTO The funnel DTO
* @return The funnel
*/
- Funnel updateFunnel(String groupId, FunnelDTO funnelDTO);
+ Funnel updateFunnel(FunnelDTO funnelDTO);
/**
* Determines whether this funnel can be removed.
*
- * @param groupId group id
* @param funnelId funnel id
*/
- void verifyDelete(String groupId, String funnelId);
+ void verifyDelete(String funnelId);
/**
- * Deletes the specified Funnel in the specified group.
+ * Deletes the specified Funnel.
*
- * @param groupId group id
* @param funnelId The funnel id
*/
- void deleteFunnel(String groupId, String funnelId);
+ void deleteFunnel(String funnelId);
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/153f63ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/LabelDAO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/LabelDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/LabelDAO.java
index 2a908ac..515b0d4 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/LabelDAO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/LabelDAO.java
@@ -16,18 +16,18 @@
*/
package org.apache.nifi.web.dao;
-import java.util.Set;
import org.apache.nifi.controller.label.Label;
import org.apache.nifi.web.api.dto.LabelDTO;
+import java.util.Set;
+
public interface LabelDAO {
/**
- * @param groupId group id
* @param labelId label id
* @return Determines if the specified label exists in the specified group
*/
- boolean hasLabel(String groupId, String labelId);
+ boolean hasLabel(String labelId);
/**
* Creates a label in the specified group.
@@ -41,11 +41,10 @@ public interface LabelDAO {
/**
* Gets the specified label in the specified group.
*
- * @param groupId group id
* @param labelId The label id
* @return The label
*/
- Label getLabel(String groupId, String labelId);
+ Label getLabel(String labelId);
/**
* Gets all of the labels in the specified group.
@@ -58,17 +57,15 @@ public interface LabelDAO {
/**
* Updates the specified label in the specified group.
*
- * @param groupId group id
* @param labelDTO The label DTO
* @return The label
*/
- Label updateLabel(String groupId, LabelDTO labelDTO);
+ Label updateLabel(LabelDTO labelDTO);
/**
* Deletes the specified label in the specified group.
*
- * @param groupId group id
* @param labelId The label id
*/
- void deleteLabel(String groupId, String labelId);
+ void deleteLabel(String labelId);
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/153f63ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/PortDAO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/PortDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/PortDAO.java
index 1df13e5..e6e11ab 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/PortDAO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/PortDAO.java
@@ -16,19 +16,18 @@
*/
package org.apache.nifi.web.dao;
-import java.util.Set;
-
import org.apache.nifi.connectable.Port;
import org.apache.nifi.web.api.dto.PortDTO;
+import java.util.Set;
+
public interface PortDAO {
/**
- * @param groupId group id
* @param portId port id
* @return Determines if the specified port exists in the specified group
*/
- boolean hasPort(String groupId, String portId);
+ boolean hasPort(String portId);
/**
* Creates a port in the specified group.
@@ -42,11 +41,10 @@ public interface PortDAO {
/**
* Gets the specified port in the specified group.
*
- * @param groupId group id
* @param portId The port id
* @return The port
*/
- Port getPort(String groupId, String portId);
+ Port getPort(String portId);
/**
* Gets all of the ports in the specified group.
@@ -59,33 +57,29 @@ public interface PortDAO {
/**
* Verifies the specified port can be updated per the specified request.
*
- * @param groupId group id
* @param portDTO port
*/
- void verifyUpdate(String groupId, PortDTO portDTO);
+ void verifyUpdate(PortDTO portDTO);
/**
* Updates the specified port in the specified group.
*
- * @param groupId group
* @param portDTO The port DTO
* @return The port
*/
- Port updatePort(String groupId, PortDTO portDTO);
+ Port updatePort(PortDTO portDTO);
/**
* Verifies the specified port can be removed.
*
- * @param groupId group id
* @param portId port id
*/
- void verifyDelete(String groupId, String portId);
+ void verifyDelete(String portId);
/**
* Deletes the specified label in the specified group.
*
- * @param groupId group id
* @param portId The port id
*/
- void deletePort(String groupId, String portId);
+ void deletePort(String portId);
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/153f63ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ProcessGroupDAO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ProcessGroupDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ProcessGroupDAO.java
index 3655083..29ca220 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ProcessGroupDAO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ProcessGroupDAO.java
@@ -16,16 +16,16 @@
*/
package org.apache.nifi.web.dao;
-import java.util.Set;
import org.apache.nifi.groups.ProcessGroup;
import org.apache.nifi.web.api.dto.ProcessGroupDTO;
+import java.util.Set;
+
public interface ProcessGroupDAO {
/**
* Determines if the specified remote process group exists.
*
- * @param groupId id
* @return true if group exists
*/
boolean hasProcessGroup(String groupId);
http://git-wip-us.apache.org/repos/asf/nifi/blob/153f63ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ProcessorDAO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ProcessorDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ProcessorDAO.java
index 9f45c90..b105c55 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ProcessorDAO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ProcessorDAO.java
@@ -16,26 +16,25 @@
*/
package org.apache.nifi.web.dao;
-import java.util.Set;
-
import org.apache.nifi.components.state.Scope;
import org.apache.nifi.components.state.StateMap;
import org.apache.nifi.controller.ProcessorNode;
import org.apache.nifi.web.api.dto.ProcessorDTO;
+import java.util.Set;
+
public interface ProcessorDAO {
/**
- * @param groupId group id
* @param id id
* @return Determines if the specified processor is loaded
*/
- boolean hasProcessor(String groupId, String id);
+ boolean hasProcessor(String id);
/**
* Creates a new Processor.
*
- * @param groupId group id
+ * @param groupId The group id where this component will be created
* @param processorDTO The processor DTO
* @return The new Processor
*/
@@ -44,11 +43,10 @@ public interface ProcessorDAO {
/**
* Gets the Processor transfer object for the specified id.
*
- * @param groupId group id
* @param id Id of the processor to return
* @return The Processor
*/
- ProcessorNode getProcessor(String groupId, String id);
+ ProcessorNode getProcessor(String id);
/**
* Gets all the Processor transfer objects for this controller.
@@ -61,58 +59,51 @@ public interface ProcessorDAO {
/**
* Verifies the specified processor can be updated.
*
- * @param groupId group id
* @param processorDTO processor
*/
- void verifyUpdate(String groupId, ProcessorDTO processorDTO);
+ void verifyUpdate(ProcessorDTO processorDTO);
/**
* Updates the configuration for the processor using the specified processorDTO.
*
- * @param groupId group id
* @param processorDTO processor
* @return updated processor
*/
- ProcessorNode updateProcessor(String groupId, ProcessorDTO processorDTO);
+ ProcessorNode updateProcessor(ProcessorDTO processorDTO);
/**
* Verifies the specified processor can be removed.
*
- * @param groupId group id
* @param processorId processor id
*/
- void verifyDelete(String groupId, String processorId);
+ void verifyDelete(String processorId);
/**
* Deletes the specified processor.
*
- * @param groupId group id
* @param processorId The processor id to delete
*/
- void deleteProcessor(String groupId, String processorId);
+ void deleteProcessor(String processorId);
/**
* Gets the specified processor.
*
- * @param groupId group id
* @param processorId processor id
* @return state map
*/
- StateMap getState(String groupId, String processorId, Scope scope);
+ StateMap getState(String processorId, Scope scope);
/**
* Verifies the processor can clear state.
*
- * @param groupId group id
* @param processorId processor id
*/
- void verifyClearState(String groupId, String processorId);
+ void verifyClearState(String processorId);
/**
* Clears the state of the specified processor.
*
- * @param groupId group id
* @param processorId processor id
*/
- void clearState(String groupId, String processorId);
+ void clearState(String processorId);
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/153f63ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/RemoteProcessGroupDAO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/RemoteProcessGroupDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/RemoteProcessGroupDAO.java
index d9eafb0..2542185 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/RemoteProcessGroupDAO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/RemoteProcessGroupDAO.java
@@ -16,22 +16,22 @@
*/
package org.apache.nifi.web.dao;
-import java.util.Set;
import org.apache.nifi.groups.RemoteProcessGroup;
import org.apache.nifi.remote.RemoteGroupPort;
import org.apache.nifi.web.api.dto.RemoteProcessGroupDTO;
import org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO;
+import java.util.Set;
+
public interface RemoteProcessGroupDAO {
/**
* Determines if the specified remote process group exists.
*
- * @param groupId group id
* @param remoteProcessGroupId group id
* @return true if the specified remote process group exists
*/
- boolean hasRemoteProcessGroup(String groupId, String remoteProcessGroupId);
+ boolean hasRemoteProcessGroup(String remoteProcessGroupId);
/**
* Creates a remote process group reference.
@@ -45,11 +45,10 @@ public interface RemoteProcessGroupDAO {
/**
* Gets the specified remote process group.
*
- * @param groupId group id
* @param remoteProcessGroupId The remote process group id
* @return The remote process group
*/
- RemoteProcessGroup getRemoteProcessGroup(String groupId, String remoteProcessGroupId);
+ RemoteProcessGroup getRemoteProcessGroup(String remoteProcessGroupId);
/**
* Gets all of the remote process groups.
@@ -62,71 +61,63 @@ public interface RemoteProcessGroupDAO {
/**
* Verifies the specified remote process group can be updated.
*
- * @param groupId group id
* @param remoteProcessGroup group
*/
- void verifyUpdate(String groupId, RemoteProcessGroupDTO remoteProcessGroup);
+ void verifyUpdate(RemoteProcessGroupDTO remoteProcessGroup);
/**
* Verifies the specified remote process group input port can be updated.
*
- * @param groupId group id
* @param remoteProcessGroupId process group id
* @param remoteProcessGroupPort port
*/
- void verifyUpdateInputPort(String groupId, String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
+ void verifyUpdateInputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
/**
* Verifies the specified remote process group input port can be updated.
*
- * @param groupId group id
* @param remoteProcessGroupId group id
* @param remoteProcessGroupPort group port
*/
- void verifyUpdateOutputPort(String groupId, String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
+ void verifyUpdateOutputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
/**
* Updates the specified remote process group.
*
- * @param groupId id
* @param remoteProcessGroup The remote process group
* @return The remote process group
*/
- RemoteProcessGroup updateRemoteProcessGroup(String groupId, RemoteProcessGroupDTO remoteProcessGroup);
+ RemoteProcessGroup updateRemoteProcessGroup(RemoteProcessGroupDTO remoteProcessGroup);
/**
* Updates the specified remote process group input port.
*
- * @param groupId id
* @param remoteProcessGroupId id
* @param remoteProcessGroupPort port
* @return updated group port
*/
- RemoteGroupPort updateRemoteProcessGroupInputPort(String groupId, String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
+ RemoteGroupPort updateRemoteProcessGroupInputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
/**
* Updates the specified remote process group output port.
*
- * @param groupId group id
* @param remoteProcessGroupId group id
* @param remoteProcessGroupPort port
* @return group port
*/
- RemoteGroupPort updateRemoteProcessGroupOutputPort(String groupId, String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
+ RemoteGroupPort updateRemoteProcessGroupOutputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
/**
* Verifies the specified remote process group can be removed.
*
- * @param groupId group id
* @param remoteProcessGroupId group id
*/
- void verifyDelete(String groupId, String remoteProcessGroupId);
+ void verifyDelete(String remoteProcessGroupId);
/**
* Deletes the specified remote process group.
*
- * @param groupId group id
* @param remoteProcessGroupId The remote process group id
*/
- void deleteRemoteProcessGroup(String groupId, String remoteProcessGroupId);
+ void deleteRemoteProcessGroup(String remoteProcessGroupId);
}