From 06369fee97309c3b1d0c29604a98ab6f829f281c Mon Sep 17 00:00:00 2001 From: Kevin Doran Date: Mon, 7 Aug 2017 10:29:11 -0400 Subject: [PATCH 1/4] WIP: NiFi Registry Web API endpoints --- nifi-registry-flow-data-model/pom.xml | 4 +- .../apache/nifi/registry/flow/BatchSize.java | 2 +- .../org/apache/nifi/registry/flow/Bundle.java | 2 +- .../registry/flow/ConnectableComponent.java | 2 +- .../registry/flow/ControllerServiceAPI.java | 2 +- .../apache/nifi/registry/flow/Position.java | 4 +- .../registry/flow/VersionedComponent.java | 2 +- .../registry/flow/VersionedConnection.java | 2 +- .../flow/VersionedControllerService.java | 2 +- .../registry/flow/VersionedFlowSnapshot.java | 7 +- .../nifi/registry/flow/VersionedLabel.java | 2 +- .../nifi/registry/flow/VersionedPort.java | 2 +- .../registry/flow/VersionedProcessGroup.java | 2 +- .../registry/flow/VersionedProcessor.java | 2 +- .../flow/VersionedRemoteGroupPort.java | 2 +- .../flow/VersionedRemoteProcessGroup.java | 2 +- nifi-registry-web-api/pom.xml | 63 ++ .../nifi/registry/web/api/FlowsResource.java | 187 +++++ .../registry/web/response/FlowEntity.java | 57 ++ .../web/response/FlowVersionEntity.java | 72 ++ .../src/main/resources/images/bgNifiLogo.png | Bin 0 -> 3894 bytes .../src/main/resources/images/nifi16.ico | Bin 0 -> 1150 bytes .../src/main/resources/templates/endpoint.hbs | 61 ++ .../src/main/resources/templates/example.hbs | 18 + .../main/resources/templates/index.html.hbs | 687 ++++++++++++++++++ .../main/resources/templates/operation.hbs | 104 +++ .../src/main/resources/templates/type.hbs | 57 ++ .../src/main/webapp/WEB-INF/web.xml | 8 + pom.xml | 2 +- 29 files changed, 1337 insertions(+), 20 deletions(-) create mode 100644 nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowsResource.java create mode 100644 nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowEntity.java create mode 100644 nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowVersionEntity.java create mode 100644 nifi-registry-web-api/src/main/resources/images/bgNifiLogo.png create mode 100644 nifi-registry-web-api/src/main/resources/images/nifi16.ico create mode 100644 nifi-registry-web-api/src/main/resources/templates/endpoint.hbs create mode 100644 nifi-registry-web-api/src/main/resources/templates/example.hbs create mode 100644 nifi-registry-web-api/src/main/resources/templates/index.html.hbs create mode 100644 nifi-registry-web-api/src/main/resources/templates/operation.hbs create mode 100644 nifi-registry-web-api/src/main/resources/templates/type.hbs diff --git a/nifi-registry-flow-data-model/pom.xml b/nifi-registry-flow-data-model/pom.xml index 0bb0c5aab..248579173 100644 --- a/nifi-registry-flow-data-model/pom.xml +++ b/nifi-registry-flow-data-model/pom.xml @@ -23,9 +23,9 @@ - com.wordnik + io.swagger swagger-annotations - 1.5.3-M1 + 1.5.16 \ No newline at end of file diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/BatchSize.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/BatchSize.java index 7a0fb84a9..b0687b95a 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/BatchSize.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/BatchSize.java @@ -17,7 +17,7 @@ package org.apache.nifi.registry.flow; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class BatchSize { private Integer count; diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Bundle.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Bundle.java index ae251f98f..1050ac9ca 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Bundle.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Bundle.java @@ -19,7 +19,7 @@ import java.util.Objects; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class Bundle { private String group; diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/ConnectableComponent.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/ConnectableComponent.java index 38bc367d8..abd34bf86 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/ConnectableComponent.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/ConnectableComponent.java @@ -17,7 +17,7 @@ package org.apache.nifi.registry.flow; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class ConnectableComponent { private String id; diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/ControllerServiceAPI.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/ControllerServiceAPI.java index 2e7c96023..b46e87afc 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/ControllerServiceAPI.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/ControllerServiceAPI.java @@ -19,7 +19,7 @@ import java.util.Objects; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class ControllerServiceAPI { private String type; diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Position.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Position.java index 20c2008c0..0cbb12cfe 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Position.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Position.java @@ -17,8 +17,8 @@ package org.apache.nifi.registry.flow; -import com.wordnik.swagger.annotations.ApiModel; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; @ApiModel("The position of a component on the graph") public class Position { diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedComponent.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedComponent.java index 365e3eab0..bef955759 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedComponent.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedComponent.java @@ -17,7 +17,7 @@ package org.apache.nifi.registry.flow; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public abstract class VersionedComponent { diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedConnection.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedConnection.java index 1ca46c54c..59740e95d 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedConnection.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedConnection.java @@ -20,7 +20,7 @@ import java.util.List; import java.util.Set; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class VersionedConnection extends VersionedComponent { private ConnectableComponent source; diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedControllerService.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedControllerService.java index 64d36c3cd..2275e73ea 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedControllerService.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedControllerService.java @@ -21,7 +21,7 @@ import java.util.Map; import java.util.Objects; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class VersionedControllerService extends VersionedComponent { diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java index 2d7d4409b..2cc2c0d58 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java @@ -17,7 +17,9 @@ package org.apache.nifi.registry.flow; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; + +import javax.xml.bind.annotation.XmlRootElement; /** *

@@ -27,6 +29,7 @@ * version of the flow, the timestamp when it was saved, the contents of the flow, etc. *

*/ +@XmlRootElement(name = "versionedFlowSnapshot") public class VersionedFlowSnapshot { private String identifier; private int version; @@ -44,7 +47,7 @@ public void setIdentifier(String identifier) { this.identifier = identifier; } - @ApiModelProperty("The version of for this snapshot of the flow") + @ApiModelProperty("The version of this snapshot of the flow") public int getVersion() { return version; } diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedLabel.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedLabel.java index ac0caa8e8..e7af4deff 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedLabel.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedLabel.java @@ -19,7 +19,7 @@ import java.util.Map; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class VersionedLabel extends VersionedComponent { private String label; diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedPort.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedPort.java index 4163c0422..f24e386de 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedPort.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedPort.java @@ -17,7 +17,7 @@ package org.apache.nifi.registry.flow; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class VersionedPort extends VersionedComponent { private PortType type; diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessGroup.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessGroup.java index b51c914de..9458cdaad 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessGroup.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessGroup.java @@ -20,7 +20,7 @@ import java.util.LinkedHashSet; import java.util.Set; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class VersionedProcessGroup extends VersionedComponent { diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessor.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessor.java index 49405f26c..467872667 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessor.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedProcessor.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.Set; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class VersionedProcessor extends VersionedComponent { diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedRemoteGroupPort.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedRemoteGroupPort.java index a80e5e0bc..73b037ecb 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedRemoteGroupPort.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedRemoteGroupPort.java @@ -19,7 +19,7 @@ import java.util.Objects; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class VersionedRemoteGroupPort extends VersionedComponent { private String groupId; diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedRemoteProcessGroup.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedRemoteProcessGroup.java index 896c39293..8417cfc78 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedRemoteProcessGroup.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedRemoteProcessGroup.java @@ -19,7 +19,7 @@ import java.util.Set; -import com.wordnik.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiModelProperty; public class VersionedRemoteProcessGroup extends VersionedComponent { private String targetUri; diff --git a/nifi-registry-web-api/pom.xml b/nifi-registry-web-api/pom.xml index a7e58ae9e..3c7e675d4 100644 --- a/nifi-registry-web-api/pom.xml +++ b/nifi-registry-web-api/pom.xml @@ -24,6 +24,59 @@ nifi-registry-web-api 0.0.1-SNAPSHOT war + + + + + src/main/resources + + + + + com.github.kongchen + swagger-maven-plugin + 3.1.5 + + + compile + + generate + + + + + org.apache.nifi.registry.web.api + http,https + /nifi-registry-api + + NiFi Registry Rest Api + ${project.version} + + The Rest Api provides an interface to a registry with operations for saving, versioning, reading NiFi flows + and components. + + + Apache NiFi Registry + dev@nifi.apache.org + https://nifi.apache.org + + + http://www.apache.org/licenses/LICENSE-2.0.html + Apache 2.0 License + + + classpath:/templates/index.html.hbs + ${project.build.directory}/${project.artifactId}-${project.version}/docs/rest-api/index.html + ${project.build.directory}/swagger-ui + + + + + + + + + org.apache.nifi.registry @@ -57,5 +110,15 @@ org.glassfish.jersey.media jersey-media-json-jackson + + io.swagger + swagger-annotations + 1.5.16 + + + org.apache.nifi.registry + nifi-registry-flow-data-model + 0.0.1-SNAPSHOT + diff --git a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowsResource.java b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowsResource.java new file mode 100644 index 000000000..96ee85da8 --- /dev/null +++ b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowsResource.java @@ -0,0 +1,187 @@ +/* + * 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.registry.web.api; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import org.apache.nifi.registry.flow.VersionedFlowSnapshot; +import org.apache.nifi.registry.web.response.FlowEntity; +import org.apache.nifi.registry.web.response.FlowVersionEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.*; +import javax.ws.rs.core.*; + +@Path("/flows") +@Api( + value = "/flows", + description = "Create named flows that can be versioned. Search for existing flows." +) +public class FlowsResource { + + private static final Logger logger = LoggerFactory.getLogger(FlowsResource.class); + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Create a named flow at its initial version", + response = VersionedFlowSnapshot.class + ) + public Response createFlow() { + // TODO implement createFlow + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Get all flows (name and id) the registry has stored for which the client is authorized. Probably will add some search url parameters as well.", + response = FlowEntity.class, + responseContainer = "List" + ) + public Response getFlows() { + // TODO implement getFlows + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @POST + @Path("/{flowId}/versions/") + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Create the next version of a given flow ID", + response = VersionedFlowSnapshot.class + ) + public Response createFlowVersion( + @PathParam("flowId") String flowId) { + // TODO implement createFlowVersion + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @GET + @Path("/{flowId}/versions/") + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Get summary of all versions of a flow for a given flow ID.", + response = FlowVersionEntity.class, + responseContainer = "List" + ) + @ApiResponses( + value = { + @ApiResponse(code = 404, message = "The specified resource could not be found."), + } + ) + public Response getFlowVersions( + @PathParam("flowId") String flowId) { + // TODO implement getFlowVersions + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @GET + @Path("/{flowId}/versions/latest") + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Get the latest version of a flow for a given flow ID", + response = VersionedFlowSnapshot.class + ) + @ApiResponses( + value = { + @ApiResponse(code = 404, message = "The specified resource could not be found."), + } + ) + public Response getLatestFlowVersion( + @PathParam("flowId") String flowId) { + // TODO implement getLatestFlowVersion + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @GET + @Path("/{flowId}/versions/{versionNumber: \\d+}") + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Get a given version of a flow for a given flow ID", + response = VersionedFlowSnapshot.class + ) + @ApiResponses( + value = { + @ApiResponse(code = 404, message = "The specified resource could not be found."), + } + ) + public Response getFlowVersion( + @PathParam("flowId") String flowId, + @PathParam("versionNumber") Integer versionNumber) { + // TODO implement getFlowVersion + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @PUT + @Path("/{flowId}/versions/{versionNumber: \\d+}") + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Update a given version of a flow for a given flow ID", + response = VersionedFlowSnapshot.class + ) + @ApiResponses( + value = { + @ApiResponse(code = 404, message = "The specified resource could not be found."), + } + ) + public Response updateFlowVersion( + @PathParam("flowId") String flowId, + @PathParam("versionNumber") Integer versionNumber) { + // TODO implement updateFlowVersion + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @DELETE + @Path("/{flowId}/versions/{versionNumber: \\d+}") + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.WILDCARD) + @ApiOperation( + value = "Delete a given version of a flow for a given flow ID", + response = VersionedFlowSnapshot.class + ) + @ApiResponses( + value = { + @ApiResponse(code = 404, message = "The specified resource could not be found."), + } + ) + public Response deleteFlowVersion( + @PathParam("flowId") String flowId, + @PathParam("versionNumber") Integer versionNumber) { + // TODO implement deleteFlowVersion + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + +} diff --git a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowEntity.java b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowEntity.java new file mode 100644 index 000000000..a5df0914b --- /dev/null +++ b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowEntity.java @@ -0,0 +1,57 @@ +/* + * 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.registry.web.response; + +import io.swagger.annotations.ApiModelProperty; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "flowEntity") +public class FlowEntity { + + private String identifier; + private String name; + private String description; + + @ApiModelProperty("The identifier for this flow.") + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + @ApiModelProperty("The name of the flow.") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @ApiModelProperty("A description of the flow set by the user when they create the initial version.") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowVersionEntity.java b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowVersionEntity.java new file mode 100644 index 000000000..1e097ee17 --- /dev/null +++ b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowVersionEntity.java @@ -0,0 +1,72 @@ +/* + * 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.registry.web.response; + +import io.swagger.annotations.ApiModelProperty; + +public class FlowVersionEntity { + private String identifier; + private int version; + private String name; + private long timestamp; + private String comments; + + @ApiModelProperty("The identifier for this snapshot of the flow") + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + @ApiModelProperty("The version of this snapshot of the flow") + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + @ApiModelProperty("The name of the flow") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @ApiModelProperty("The timestamp when the flow was saved") + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } + + @ApiModelProperty("The comments provided by the user when creating the snapshot") + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } +} diff --git a/nifi-registry-web-api/src/main/resources/images/bgNifiLogo.png b/nifi-registry-web-api/src/main/resources/images/bgNifiLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..2558d430b2cf9f97b900e9dedc2b474fb8839acc GIT binary patch literal 3894 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 Eg3(KwE&u=k literal 0 HcmV?d00001 diff --git a/nifi-registry-web-api/src/main/resources/images/nifi16.ico b/nifi-registry-web-api/src/main/resources/images/nifi16.ico new file mode 100644 index 0000000000000000000000000000000000000000..2ac36701eaea4720ef6bb9a67c24513ea6bea240 GIT binary patch literal 1150 zcmaKqX-HI26vuB6^q~(;L_$$Cr7cv5Wm!t%%LUXd*T&G&aT%A?Va(C6)OnVsW4Vl_ zrKB_ES~^;3YA$FoNE$X4VjoJ>tgJM(f-;T%-KPwU>mB}cFXx^A@11+jBV+~r@py#( z^GV1`LJSBYyQpZ0MrPx5n_25t6T)e^C9v7SbGGC&_GTM+ryck5J*v!Uj`n4u{cYJ00cBB!$5A5*$DnnY=zFa$A&iZD#Je{yQD1qR-XRY1SU<#w91$!qhmVsn zJgm1v=hN*E3lfA?`4=%U`U%t1Q~3O$ADSjLO7oJTxD*DN*aMNiHVE}JhoAGlIkj_) zT2&&iM#+x%^|WJZ@)v$gjH0LO8Ps<&katyzl=EkBA;bw%e_KR&SxR*8)!*xjlGx_^ z8Tj_)J^oDop6O$4c`j7hambX3kaSJ}S@?-@+5_&hT(F*$T;VkoC--+Wm0)Ce5M7#j zG*%a&EH4Q+QzDQR?+ba%DVGICy+C7WiV5Z5ReLR7cecXOH% zvQ#0*=x(orrm+Im1&JuVF4d~8i5IPVF%V^BwyLwCsk@6ug|cxv8~$Q>%f*_@ + + {{#post}} +
+
+
POST
+
+
{{summary}}
+
+
+ {{> operation}} +
+ {{/post}} + {{#get}} +
+
+
GET
+
+
{{summary}}
+
+
+ {{> operation}} +
+ {{/get}} + {{#put}} +
+
+
PUT
+
+
{{summary}}
+
+
+ {{> operation}} +
+ {{/put}} + {{#delete}} +
+
+
DELETE
+
+
{{summary}}
+
+
+ {{> operation}} +
+ {{/delete}} + \ No newline at end of file diff --git a/nifi-registry-web-api/src/main/resources/templates/example.hbs b/nifi-registry-web-api/src/main/resources/templates/example.hbs new file mode 100644 index 000000000..26a4283ec --- /dev/null +++ b/nifi-registry-web-api/src/main/resources/templates/example.hbs @@ -0,0 +1,18 @@ +{{!-- + 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. +--}}{{!-- formatting here matters... in whitespace: pre. this is not comprehensive but sufficent for our examples --}} +{{#each properties}} {{#ifeq type "string"}}"{{@key}}": "value"{{/ifeq}}{{#ifeq type "boolean"}}"{{@key}}": true{{/ifeq}}{{#ifeq type "integer"}}"{{@key}}": 0{{/ifeq}}{{#ifeq type "number"}}"{{@key}}": 0.0{{/ifeq}}{{#if $ref}}"{{@key}}": {{/if}}{{#ifeq type "array"}}"{{@key}}": [{{#if items.$ref}}{{else}}"value"{{/if}}]{{/ifeq}}{{#ifeq type "object"}}"{{@key}}": { + "name": {{#if additionalProperties.$ref}}{{else}}{{#ifeq additionalProperties.type "integer"}}0{{else}}"value"{{/ifeq}}{{/if}} + }{{/ifeq}}, +{{/each}} \ No newline at end of file diff --git a/nifi-registry-web-api/src/main/resources/templates/index.html.hbs b/nifi-registry-web-api/src/main/resources/templates/index.html.hbs new file mode 100644 index 000000000..595d47088 --- /dev/null +++ b/nifi-registry-web-api/src/main/resources/templates/index.html.hbs @@ -0,0 +1,687 @@ + + + + + {{info.title}}-{{info.version}} + + + + + + + + +
+ +
{{basePath}}
+
{{info.title}} {{info.version}}
+
+
+
+
{{info.description}}
+
+
+ +
User authentication and token endpoints
+
+
+ +
+
+
+ +
Get controller configuration, Manage the cluster, Create reporting tasks
+
+
+ +
+
+
+ +
Manage controller services, Update controller service references
+
+
+ +
+
+
+ +
Manage reporting tasks
+
+
+ +
+
+
+ +
Get counters, Reset counters
+
+
+ +
+
+
+ +
Get the data flow, Obtain component status, Query history
+
+
+ +
+
+
+ +
Create components, Instantiate a template, Upload a template
+
+
+ +
+
+
+ +
Create a processor, Set properties, Schedule
+
+
+ +
+
+
+ +
Create a connection, Set queue priority, Update connection destination
+
+
+ +
+
+
+ +
View queue contents, Download flowfile content, Empty queue
+
+
+ +
+
+
+ +
Create an input port, Set remote port access control
+
+
+ +
+
+
+ +
Create an output port, Set remote port access control
+
+
+ +
+
+
+ +
Create a remote group, Enable transmission
+
+
+ +
+
+
+ +
Create a label, Set label style
+
+
+ +
+
+
+ +
Manage funnels
+
+
+ +
+
+
+ +
Query provenance, Search event lineage
+
+
+ +
+
+
+ +
Download content, Replay
+
+
+ +
+
+
+ +
Add users and group, Group users
+
+
+ +
+
+
+ +
Get policies, Create policies
+
+
+ +
+
+
+ +
Get resources
+
+
+ +
+
+
+ +
Get available ports, Get peers
+
+
+ +
+
+
+ +
Send data, Receive data
+
+
+ +
+
+
+ +
Create a snippet, Move a snippet, Delete a snippet
+
+
+ +
+
+
+ +
Download a template, Delete a template
+
+
+ +
+
+
+ +
Get system diagnostics
+
+
+ +
+ + {{#each definitions}} + {{> type}} + {{/each}} + + \ No newline at end of file diff --git a/nifi-registry-web-api/src/main/resources/templates/operation.hbs b/nifi-registry-web-api/src/main/resources/templates/operation.hbs new file mode 100644 index 000000000..5fb25e750 --- /dev/null +++ b/nifi-registry-web-api/src/main/resources/templates/operation.hbs @@ -0,0 +1,104 @@ +{{!-- + 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. +--}} + \ No newline at end of file diff --git a/nifi-registry-web-api/src/main/resources/templates/type.hbs b/nifi-registry-web-api/src/main/resources/templates/type.hbs new file mode 100644 index 000000000..f6f117b58 --- /dev/null +++ b/nifi-registry-web-api/src/main/resources/templates/type.hbs @@ -0,0 +1,57 @@ +{{!-- + 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. +--}} + \ No newline at end of file diff --git a/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml b/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml index ea67a48ee..04d9bbe43 100644 --- a/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml +++ b/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml @@ -23,6 +23,14 @@ javax.ws.rs.Application org.apache.nifi.registry.web.NiFiRegistryResourceConfig + + com.sun.jersey.config.property.packages + org.codehaus.jackson.jaxrs + + api diff --git a/pom.xml b/pom.xml index 83aee929e..41853441b 100644 --- a/pom.xml +++ b/pom.xml @@ -98,7 +98,7 @@ 2017 1.7.12 9.2.11.v20150529 - 2.19 + 2.25.1 From 0c23f1c1accec144a7ad62673167c2f700d20130 Mon Sep 17 00:00:00 2001 From: Kevin Doran Date: Tue, 8 Aug 2017 16:29:43 -0400 Subject: [PATCH 2/4] WIP: NiFi Registry Web API endpoints --- .../org/apache/nifi/registry/flow/Bucket.java | 96 +++++++++++++ .../nifi/registry/flow/BucketObject.java | 36 +---- .../nifi/registry/flow/VersionedFlow.java | 132 ++++++++++++++++++ .../registry/flow/VersionedFlowSnapshot.java | 5 +- nifi-registry-web-api/pom.xml | 2 +- .../registry/web/api/BucketFlowResource.java | 66 +++++++++ .../nifi/registry/web/api/BucketResource.java | 127 +++++++++++++++++ .../{FlowsResource.java => FlowResource.java} | 127 +++++++++-------- .../web/response/FlowVersionEntity.java | 72 ---------- .../src/main/webapp/WEB-INF/web.xml | 16 +-- 10 files changed, 506 insertions(+), 173 deletions(-) create mode 100644 nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Bucket.java rename nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowEntity.java => nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/BucketObject.java (54%) create mode 100644 nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlow.java create mode 100644 nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java create mode 100644 nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java rename nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/{FlowsResource.java => FlowResource.java} (73%) delete mode 100644 nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowVersionEntity.java diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Bucket.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Bucket.java new file mode 100644 index 000000000..5cc483f2b --- /dev/null +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/Bucket.java @@ -0,0 +1,96 @@ +/* + * 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.registry.flow; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +@ApiModel(value = "bucket") +public class Bucket { + + private String identifier; + private String name; + private long createdTimestamp; + private String description; + private Map bucketObjectMap = new HashMap<>(); + + @ApiModelProperty("The id of the bucket. This is set by the server at creation time.") + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + @ApiModelProperty("The name of the bucket.") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @ApiModelProperty("The timestamp of when the bucket was first created. This is set by the server at creation time.") + public long getCreatedTimestamp() { + return createdTimestamp; + } + + public void setCreatedTimestamp(long createdTimestamp) { + this.createdTimestamp = createdTimestamp; + } + + @ApiModelProperty("A description of the bucket.") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * Add a new object version to this bucket. + * + * Note that this method has a potential side effect. + * If a BucketObject ID is not set, a random UUID string will be set. + * + * @param object The object to add to this bucket. + */ + public void addObject(BucketObject object) { + if(object.getIdentifier() == null) { + object.setIdentifier(UUID.randomUUID().toString()); + } + + this.bucketObjectMap.put(object.getIdentifier(), object); + } + + protected Map getBucketObjectMap() { + return bucketObjectMap; + } + + protected void setBucketObjectMap(Map bucketObjectMap) { + this.bucketObjectMap = bucketObjectMap; + } + + +} diff --git a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowEntity.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/BucketObject.java similarity index 54% rename from nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowEntity.java rename to nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/BucketObject.java index a5df0914b..2e2bdf4e6 100644 --- a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowEntity.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/BucketObject.java @@ -14,44 +14,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.nifi.registry.web.response; +package org.apache.nifi.registry.flow; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "flowEntity") -public class FlowEntity { +@ApiModel("bucketObject") +public abstract class BucketObject { private String identifier; - private String name; - private String description; - @ApiModelProperty("The identifier for this flow.") + @ApiModelProperty("An ID to uniquely identify this object.") public String getIdentifier() { return identifier; } - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - @ApiModelProperty("The name of the flow.") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; + public void setIdentifier(String id) { + this.identifier = id; } - - @ApiModelProperty("A description of the flow set by the user when they create the initial version.") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - } diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlow.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlow.java new file mode 100644 index 000000000..42c7baa2a --- /dev/null +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlow.java @@ -0,0 +1,132 @@ +/* + * 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.registry.flow; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.*; + +/** + *

+ * Represents a versioned flow. A versioned flow is a named flow that is expected to change + * over time. This flow is saved to the registry with information such as its name, a description, + * and each version of the flow. + *

+ * + * @see VersionedFlowSnapshot + */ +@ApiModel(value = "versionedFlow") +public class VersionedFlow extends BucketObject { + + private String name; + private long createdTimestamp; + private long modifiedTimestamp; + private String description; + private int currentMaxVersion = 0; + private ArrayList snapshots = new ArrayList<>(); + private Map snapshotsByVersion = new HashMap<>(); // TODO, could use a third-party collection type that supports primitive keys. + private Map snapshotsById = new HashMap<>(); + + @ApiModelProperty("The name of the flow.") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @ApiModelProperty("The timestamp of when the flow was first created.") + public long getCreatedTimestamp() { + return createdTimestamp; + } + + public void setCreatedTimestamp(long timestamp) { + this.createdTimestamp = timestamp; + } + + @ApiModelProperty("The timestamp of when the flow was last modified, e.g., when a new version was saved.") + public long getModifiedTimestamp() { + return modifiedTimestamp; + } + + public void setModifiedTimestamp(long modifiedTimestamp) { + this.modifiedTimestamp = modifiedTimestamp; + } + + @ApiModelProperty("A description of the flow.") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getSnapshots() { + return snapshots; + } + + public VersionedFlowSnapshot getSnapshot(String id) { + return snapshotsById.get(id); + } + + public VersionedFlowSnapshot getSnapshot(int version) { + return snapshotsByVersion.get(Integer.valueOf(version)); + } + + /** + * Add a new snapshot version to this VersionedFlow. + * + * Note that this method has potential side effects. + * If a snapshot version number is not a positive integer, + * a new version number will be set as the current max version number + 1. + * If a snapshot ID is not set, a random UUID string will be set. + * + * @param snapshot The snapshot to add to this versionedFlow + */ + public void addVersionedFlowSnapshot(VersionedFlowSnapshot snapshot) { + if (snapshot == null) { + return; + } + + int snapshotVersion = snapshot.getVersion(); + if (snapshotVersion < 1) { + snapshotVersion = ++currentMaxVersion; + snapshot.setVersion(snapshotVersion); + } else if (snapshotsById.containsKey(Integer.valueOf(snapshotVersion))) { + throw new IllegalStateException("Unable to add snapshot to VersionedFlow with duplicate version number '" + snapshotVersion + "'."); + } else { + currentMaxVersion = (snapshotVersion > currentMaxVersion) ? snapshotVersion : currentMaxVersion; + } + + String snapshotId = snapshot.getIdentifier(); + if (snapshot.getIdentifier() == null) { + snapshotId = UUID.randomUUID().toString(); + snapshot.setIdentifier(snapshotId); + } + if (snapshotsById.containsKey(snapshotId)) { + throw new IllegalStateException("Unable to add snapshot to VersionedFlow with duplicate ID '" + snapshotId + "'."); + } + + snapshots.add(snapshot); + snapshotsByVersion.put(Integer.valueOf(snapshotVersion), snapshot); + snapshotsById.put(snapshotId, snapshot); + } + +} diff --git a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java index 2cc2c0d58..875a26d7c 100644 --- a/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java +++ b/nifi-registry-flow-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshot.java @@ -17,10 +17,9 @@ package org.apache.nifi.registry.flow; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import javax.xml.bind.annotation.XmlRootElement; - /** *

* Represents a snapshot of a versioned flow. A versioned flow may change many times @@ -29,7 +28,7 @@ * version of the flow, the timestamp when it was saved, the contents of the flow, etc. *

*/ -@XmlRootElement(name = "versionedFlowSnapshot") +@ApiModel(value = "versionedFlowSnapshot") public class VersionedFlowSnapshot { private String identifier; private int version; diff --git a/nifi-registry-web-api/pom.xml b/nifi-registry-web-api/pom.xml index 3c7e675d4..0b1ff8aeb 100644 --- a/nifi-registry-web-api/pom.xml +++ b/nifi-registry-web-api/pom.xml @@ -49,7 +49,7 @@ http,https /nifi-registry-api - NiFi Registry Rest Api + NiFi Registry REST API ${project.version} The Rest Api provides an interface to a registry with operations for saving, versioning, reading NiFi flows diff --git a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java new file mode 100644 index 000000000..656b7ddf5 --- /dev/null +++ b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java @@ -0,0 +1,66 @@ +/* + * 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.registry.web.api; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.nifi.registry.flow.VersionedFlow; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@Path("/buckets/{bucketId}/flows") +@Api( + value = "buckets > flows", + description = "Create named buckets in the registry to store NiFI objects such flows and extensions. " + + "Search for and retrieve existing buckets." +) +public class BucketFlowResource { + + private static final Logger logger = LoggerFactory.getLogger(BucketFlowResource.class); + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Create a named flow and store it in the specified bucket. " + + "The flow id is created by the server and a location URI for the created flow resource is returned.", + response = VersionedFlow.class + ) + public Response createFlow(@PathParam("bucketId") String bucketId) { + // TODO implement createFlow + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + /* TODO, add redirection URIs so that GET, PUT, DELETE operations for a given flow id (once created) + * are accessible as a subresource from /buckets as well */ +// @GET +// @PathParam("/{bucketId}/flows/{flowSubpath}") +// @ApiOperation("Redirects to /flows/{flowSubpath}") +// public Response getFlowAlias( +// @PathParam("bucketId") String bucketId, +// @PathParam("flowSubpath") String flowSubpath) { +// logger.info("Redirecting flow operation on bucket resource handler to flow resource handler."); +// UriBuilder addressBuilder = uriInfo.getBaseUriBuilder(); +// addressBuilder.path("flows/" + flowSubpath); +// return Response.seeOther(addressBuilder.build()).build(); +// } +} diff --git a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java new file mode 100644 index 000000000..e04a37714 --- /dev/null +++ b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java @@ -0,0 +1,127 @@ +/* + * 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.registry.web.api; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import org.apache.nifi.registry.flow.Bucket; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.*; +import javax.ws.rs.core.*; + +@Path("/buckets") +@Api( + value = "/buckets", + description = "Create named buckets in the registry to store NiFI objects such flows and extensions. " + + "Search for and retrieve existing buckets." +) +public class BucketResource { + + private static final Logger logger = LoggerFactory.getLogger(BucketResource.class); + + @Context + UriInfo uriInfo; + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Create a named bucket capable of storing NiFi bucket objects such as flows and extension bundles.", + response = Bucket.class + ) + public Response createBucket(Bucket bucket) { + // TODO implement createBucket + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Get metadata for all buckets in the registry for which the client is authorized. TODO: Will add some search parameters as well.", + response = Bucket.class, + responseContainer = "List" + ) + public Response getBuckets() { + // TODO implement getBuckets + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @GET + @Path("{bucketId}") + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Get metadata for an existing bucket in the registry.", + response = Bucket.class + ) + @ApiResponses( + value = { + @ApiResponse(code = 404, message = "The specified resource could not be found."), + } + ) + public Response getBucket(@PathParam("bucketId") String bucketId) { + // TODO implement getBucket + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @PUT + @Path("{bucketId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Update the metadata for an existing bucket in the registry. Objects stored in the bucket will not be modified.", + response = Bucket.class + ) + @ApiResponses( + value = { + @ApiResponse(code = 404, message = "The specified resource could not be found."), + } + ) + public Response updateBucket(@PathParam("bucketId") String bucketId) { + // TODO implement updateBucket + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @DELETE + @Path("{bucketId}") + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Delete an existing bucket in the registry, along with all the objects it is storing.", + response = Bucket.class + ) + @ApiResponses( + value = { + @ApiResponse(code = 404, message = "The specified resource could not be found."), + } + ) + public Response deleteBucket(@PathParam("bucketId") String bucketId) { + // TODO implement deleteBucket + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + +} diff --git a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowsResource.java b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowResource.java similarity index 73% rename from nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowsResource.java rename to nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowResource.java index 96ee85da8..14874b73a 100644 --- a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowsResource.java +++ b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowResource.java @@ -20,9 +20,8 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; +import org.apache.nifi.registry.flow.VersionedFlow; import org.apache.nifi.registry.flow.VersionedFlowSnapshot; -import org.apache.nifi.registry.web.response.FlowEntity; -import org.apache.nifi.registry.web.response.FlowVersionEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,31 +31,18 @@ @Path("/flows") @Api( value = "/flows", - description = "Create named flows that can be versioned. Search for existing flows." + description = "Create named flows that can be versioned. Search for and retrieve existing flows." ) -public class FlowsResource { +public class FlowResource { - private static final Logger logger = LoggerFactory.getLogger(FlowsResource.class); - - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Create a named flow at its initial version", - response = VersionedFlowSnapshot.class - ) - public Response createFlow() { - // TODO implement createFlow - logger.error("This API functionality has not yet been implemented."); - return Response.status(Response.Status.NOT_IMPLEMENTED).build(); - } + private static final Logger logger = LoggerFactory.getLogger(FlowResource.class); @GET - @Consumes(MediaType.APPLICATION_JSON) + @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( - value = "Get all flows (name and id) the registry has stored for which the client is authorized. Probably will add some search url parameters as well.", - response = FlowEntity.class, + value = "Get metadata for all flows in all buckets that the registry has stored for which the client is authorized. TODO: Will add some search parameters as well.", + response = VersionedFlow.class, responseContainer = "List" ) public Response getFlows() { @@ -65,89 +51,111 @@ public Response getFlows() { return Response.status(Response.Status.NOT_IMPLEMENTED).build(); } - @POST - @Path("/{flowId}/versions/") + @GET + @Path("/{flowId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( - value = "Create the next version of a given flow ID", - response = VersionedFlowSnapshot.class + value = "Get metadata for an existing flow the registry has stored.", + response = VersionedFlow.class ) - public Response createFlowVersion( + @ApiResponses( + value = { + @ApiResponse(code = 404, message = "The specified resource could not be found."), + } + ) + public Response getFlow( @PathParam("flowId") String flowId) { - // TODO implement createFlowVersion + // TODO implement getFlow logger.error("This API functionality has not yet been implemented."); return Response.status(Response.Status.NOT_IMPLEMENTED).build(); } - @GET - @Path("/{flowId}/versions/") - @Consumes(MediaType.WILDCARD) + @PUT + @Path("/{flowId}") + @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( - value = "Get summary of all versions of a flow for a given flow ID.", - response = FlowVersionEntity.class, - responseContainer = "List" + value = "Update an existing flow the registry has stored.", + response = VersionedFlow.class ) @ApiResponses( value = { @ApiResponse(code = 404, message = "The specified resource could not be found."), } ) - public Response getFlowVersions( + public Response updateFlow( @PathParam("flowId") String flowId) { - // TODO implement getFlowVersions + // TODO implement updateFlow logger.error("This API functionality has not yet been implemented."); return Response.status(Response.Status.NOT_IMPLEMENTED).build(); } - @GET - @Path("/{flowId}/versions/latest") + @DELETE + @Path("/{flowId}") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( - value = "Get the latest version of a flow for a given flow ID", - response = VersionedFlowSnapshot.class + value = "Delete an existing flow the registry has stored.", + response = VersionedFlow.class ) @ApiResponses( value = { @ApiResponse(code = 404, message = "The specified resource could not be found."), } ) - public Response getLatestFlowVersion( + public Response deleteFlow( @PathParam("flowId") String flowId) { - // TODO implement getLatestFlowVersion + // TODO implement deleteFlow logger.error("This API functionality has not yet been implemented."); return Response.status(Response.Status.NOT_IMPLEMENTED).build(); } - @GET - @Path("/{flowId}/versions/{versionNumber: \\d+}") + @POST + @Path("/{flowId}/versions") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( - value = "Get a given version of a flow for a given flow ID", + value = "Create the next version of a given flow ID. " + + "The version number is created by the server and a location URI for the created version resource is returned.", response = VersionedFlowSnapshot.class ) + public Response createFlowVersion( + @PathParam("flowId") String flowId) { + // TODO implement createFlowVersion + logger.error("This API functionality has not yet been implemented."); + return Response.status(Response.Status.NOT_IMPLEMENTED).build(); + } + + @GET + @Path("/{flowId}/versions") + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + value = "Get summary of all versions of a flow for a given flow ID.", + response = VersionedFlowSnapshot.class, /* TODO, add a JSON serialization view for VersionedFlowSnapshot + for this endpoint that hides the flowContents property when + this object is returned as part of a collection. */ + responseContainer = "List" + ) @ApiResponses( value = { @ApiResponse(code = 404, message = "The specified resource could not be found."), } ) - public Response getFlowVersion( - @PathParam("flowId") String flowId, - @PathParam("versionNumber") Integer versionNumber) { - // TODO implement getFlowVersion + public Response getFlowVersions( + @PathParam("flowId") String flowId) { + // TODO implement getFlowVersions logger.error("This API functionality has not yet been implemented."); return Response.status(Response.Status.NOT_IMPLEMENTED).build(); } - @PUT - @Path("/{flowId}/versions/{versionNumber: \\d+}") + @GET + @Path("/{flowId}/versions/latest") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( - value = "Update a given version of a flow for a given flow ID", + value = "Get the latest version of a flow for a given flow ID", response = VersionedFlowSnapshot.class ) @ApiResponses( @@ -155,20 +163,19 @@ public Response getFlowVersion( @ApiResponse(code = 404, message = "The specified resource could not be found."), } ) - public Response updateFlowVersion( - @PathParam("flowId") String flowId, - @PathParam("versionNumber") Integer versionNumber) { - // TODO implement updateFlowVersion + public Response getLatestFlowVersion( + @PathParam("flowId") String flowId) { + // TODO implement getLatestFlowVersion logger.error("This API functionality has not yet been implemented."); return Response.status(Response.Status.NOT_IMPLEMENTED).build(); } - @DELETE + @GET @Path("/{flowId}/versions/{versionNumber: \\d+}") @Consumes(MediaType.WILDCARD) - @Produces(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) @ApiOperation( - value = "Delete a given version of a flow for a given flow ID", + value = "Get a given version of a flow for a given flow ID", response = VersionedFlowSnapshot.class ) @ApiResponses( @@ -176,10 +183,10 @@ public Response updateFlowVersion( @ApiResponse(code = 404, message = "The specified resource could not be found."), } ) - public Response deleteFlowVersion( + public Response getFlowVersion( @PathParam("flowId") String flowId, @PathParam("versionNumber") Integer versionNumber) { - // TODO implement deleteFlowVersion + // TODO implement getFlowVersion logger.error("This API functionality has not yet been implemented."); return Response.status(Response.Status.NOT_IMPLEMENTED).build(); } diff --git a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowVersionEntity.java b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowVersionEntity.java deleted file mode 100644 index 1e097ee17..000000000 --- a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/response/FlowVersionEntity.java +++ /dev/null @@ -1,72 +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.registry.web.response; - -import io.swagger.annotations.ApiModelProperty; - -public class FlowVersionEntity { - private String identifier; - private int version; - private String name; - private long timestamp; - private String comments; - - @ApiModelProperty("The identifier for this snapshot of the flow") - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - @ApiModelProperty("The version of this snapshot of the flow") - public int getVersion() { - return version; - } - - public void setVersion(int version) { - this.version = version; - } - - @ApiModelProperty("The name of the flow") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @ApiModelProperty("The timestamp when the flow was saved") - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - @ApiModelProperty("The comments provided by the user when creating the snapshot") - public String getComments() { - return comments; - } - - public void setComments(String comments) { - this.comments = comments; - } -} diff --git a/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml b/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml index 04d9bbe43..b91406f9a 100644 --- a/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml +++ b/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml @@ -23,14 +23,14 @@ javax.ws.rs.Application org.apache.nifi.registry.web.NiFiRegistryResourceConfig - - com.sun.jersey.config.property.packages - org.codehaus.jackson.jaxrs - - + + + + + + + + api From 33ab60e8009147117876d7bac506eea5dcbf89bc Mon Sep 17 00:00:00 2001 From: Kevin Doran Date: Tue, 8 Aug 2017 16:43:04 -0400 Subject: [PATCH 3/4] WIP: NiFi Registry Web API endpoints --- nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml b/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml index b91406f9a..ea67a48ee 100644 --- a/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml +++ b/nifi-registry-web-api/src/main/webapp/WEB-INF/web.xml @@ -23,14 +23,6 @@ javax.ws.rs.Application org.apache.nifi.registry.web.NiFiRegistryResourceConfig - - - - - - - - api From 9367b52d6748e2f882b20cda4acda7831dd96bcc Mon Sep 17 00:00:00 2001 From: Kevin Doran Date: Tue, 8 Aug 2017 16:44:50 -0400 Subject: [PATCH 4/4] WIP: NiFi Registry Web API endpoints --- .../org/apache/nifi/registry/web/api/BucketFlowResource.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java index 656b7ddf5..ce13913da 100644 --- a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java +++ b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java @@ -28,9 +28,8 @@ @Path("/buckets/{bucketId}/flows") @Api( - value = "buckets > flows", - description = "Create named buckets in the registry to store NiFI objects such flows and extensions. " + - "Search for and retrieve existing buckets." + value = "bucket >> flows", + description = "Create flows scoped to an existing bucket in the registry." ) public class BucketFlowResource {