You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2016/04/29 22:32:25 UTC
[12/13] nifi git commit: NIFI-1554: - Populating component entities
in the REST API to decouple key fields from the configuration DTOs. - Added
initial support for components in UI when access isn't allowed. Formal
styling to come later.
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java
index b041e51..ed4a38f 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java
@@ -16,26 +16,119 @@
*/
package org.apache.nifi.web.api.entity;
-import javax.xml.bind.annotation.XmlRootElement;
+import com.wordnik.swagger.annotations.ApiModelProperty;
import org.apache.nifi.web.api.dto.ConnectionDTO;
+import org.apache.nifi.web.api.dto.PositionDTO;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
/**
* A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a ConnectionDTO.
*/
@XmlRootElement(name = "connectionEntity")
-public class ConnectionEntity extends Entity {
+public class ConnectionEntity extends ComponentEntity {
- private ConnectionDTO connection;
+ private ConnectionDTO component;
+ private List<PositionDTO> bends;
+ private Integer labelIndex;
+ private String sourceId;
+ private String sourceGroupId;
+ private String destinationId;
+ private String destinationGroupId;
/**
* @return RelationshipDTO that is being serialized
*/
- public ConnectionDTO getConnection() {
- return connection;
+ public ConnectionDTO getComponent() {
+ return component;
+ }
+
+ public void setComponent(ConnectionDTO component) {
+ this.component = component;
+ }
+
+ /**
+ * @return position of the bend points on this connection
+ */
+ @ApiModelProperty(
+ value = "The bend points on the connection."
+ )
+ public List<PositionDTO> getBends() {
+ return bends;
+ }
+
+ public void setBends(List<PositionDTO> bends) {
+ this.bends = bends;
+ }
+
+ /**
+ * @return The index of control point that the connection label should be placed over
+ */
+ @ApiModelProperty(
+ value = "The index of the bend point where to place the connection label."
+ )
+ public Integer getLabelIndex() {
+ return labelIndex;
+ }
+
+ public void setLabelIndex(Integer labelIndex) {
+ this.labelIndex = labelIndex;
+ }
+
+ /**
+ * @return The identifier of the source of this connection
+ */
+ @ApiModelProperty(
+ value = "The identifier of the source of this connection."
+ )
+ public String getSourceId() {
+ return sourceId;
+ }
+
+ public void setSourceId(String sourceId) {
+ this.sourceId = sourceId;
+ }
+
+ /**
+ * @return The identifier of the destination of this connection
+ */
+ @ApiModelProperty(
+ value = "The identifier of the destination of this connection."
+ )
+ public String getDestinationId() {
+ return destinationId;
}
- public void setConnection(ConnectionDTO connection) {
- this.connection = connection;
+ public void setDestinationId(String destinationId) {
+ this.destinationId = destinationId;
}
+ /**
+ * @return The identifier of the group of the source of this connection
+ */
+ @ApiModelProperty(
+ value = "The identifier of the group of the source of this connection."
+ )
+ public String getSourceGroupId() {
+ return sourceGroupId;
+ }
+
+ public void setSourceGroupId(String sourceGroupId) {
+ this.sourceGroupId = sourceGroupId;
+ }
+
+ /**
+ * @return The identifier of the group of the destination of this connection
+ */
+ @ApiModelProperty(
+ value = "The identifier of the group of the destination of this connection."
+ )
+ public String getDestinationGroupId() {
+ return destinationGroupId;
+ }
+
+ public void setDestinationGroupId(String destinationGroupId) {
+ this.destinationGroupId = destinationGroupId;
+ }
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionsEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionsEntity.java
index 5b2b1b0..51f17b9 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionsEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionsEntity.java
@@ -16,27 +16,25 @@
*/
package org.apache.nifi.web.api.entity;
-import java.util.Set;
-
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.nifi.web.api.dto.ConnectionDTO;
+import java.util.Set;
/**
- * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of ConnectionDTOs.
+ * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of ConnectionEntitys.
*/
@XmlRootElement(name = "connectionsEntity")
public class ConnectionsEntity extends Entity {
- private Set<ConnectionDTO> connections;
+ private Set<ConnectionEntity> connections;
/**
- * @return list of ConnectionDTOs that are being serialized
+ * @return list of ConnectionEntitys that are being serialized
*/
- public Set<ConnectionDTO> getConnections() {
+ public Set<ConnectionEntity> getConnections() {
return connections;
}
- public void setConnections(Set<ConnectionDTO> connections) {
+ public void setConnections(Set<ConnectionEntity> connections) {
this.connections = connections;
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java
index 8f217b5..8e96e48 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java
@@ -23,7 +23,7 @@ import org.apache.nifi.web.api.dto.ControllerServiceDTO;
* A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a controller service.
*/
@XmlRootElement(name = "controllerServiceEntity")
-public class ControllerServiceEntity extends Entity {
+public class ControllerServiceEntity extends ComponentEntity {
private ControllerServiceDTO controllerService;
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/Entity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/Entity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/Entity.java
index 13c7a70..a961d14 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/Entity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/Entity.java
@@ -17,9 +17,10 @@
package org.apache.nifi.web.api.entity;
import com.wordnik.swagger.annotations.ApiModelProperty;
-import javax.xml.bind.annotation.XmlRootElement;
import org.apache.nifi.web.api.dto.RevisionDTO;
+import javax.xml.bind.annotation.XmlRootElement;
+
/**
* A base type for request/response entities.
*/
@@ -34,6 +35,7 @@ public class Entity {
@ApiModelProperty(
value = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses."
)
+ @Deprecated
public RevisionDTO getRevision() {
if (revision == null) {
return new RevisionDTO();
@@ -42,6 +44,7 @@ public class Entity {
}
}
+ @Deprecated
public void setRevision(RevisionDTO revision) {
this.revision = revision;
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowEntity.java
new file mode 100644
index 0000000..d9c22b7
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FlowEntity.java
@@ -0,0 +1,44 @@
+/*
+ * 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.entity;
+
+import org.apache.nifi.web.api.dto.flow.FlowDTO;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a FlowDTO.
+ */
+@XmlRootElement(name = "flowEntity")
+public class FlowEntity extends Entity {
+
+ private FlowDTO flow;
+
+ /**
+ * The FlowDTO that is being serialized.
+ *
+ * @return The FlowDTO object
+ */
+ public FlowDTO getFlow() {
+ return flow;
+ }
+
+ public void setFlow(FlowDTO flow) {
+ this.flow = flow;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelEntity.java
index 241ac51..54ff2ed 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelEntity.java
@@ -23,21 +23,21 @@ import org.apache.nifi.web.api.dto.FunnelDTO;
* A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a FunnelDTO.
*/
@XmlRootElement(name = "funnelEntity")
-public class FunnelEntity extends Entity {
+public class FunnelEntity extends ComponentEntity {
- private FunnelDTO funnel;
+ private FunnelDTO component;
/**
* The FunnelDTO that is being serialized.
*
* @return The FunnelDTO object
*/
- public FunnelDTO getFunnel() {
- return funnel;
+ public FunnelDTO getComponent() {
+ return component;
}
- public void setFunnel(FunnelDTO funnel) {
- this.funnel = funnel;
+ public void setComponent(FunnelDTO component) {
+ this.component = component;
}
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelsEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelsEntity.java
index 34426db..246f222 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelsEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelsEntity.java
@@ -16,27 +16,25 @@
*/
package org.apache.nifi.web.api.entity;
-import java.util.Set;
-
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.nifi.web.api.dto.FunnelDTO;
+import java.util.Set;
/**
- * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of FunnelDTOs.
+ * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of FunnelEntitys.
*/
@XmlRootElement(name = "funnelsEntity")
public class FunnelsEntity extends Entity {
- private Set<FunnelDTO> funnels;
+ private Set<FunnelEntity> funnels;
/**
- * @return collection of FunnelDTOs that are being serialized
+ * @return collection of FunnelEntitys that are being serialized
*/
- public Set<FunnelDTO> getFunnels() {
+ public Set<FunnelEntity> getFunnels() {
return funnels;
}
- public void setFunnels(Set<FunnelDTO> labels) {
+ public void setFunnels(Set<FunnelEntity> labels) {
this.funnels = labels;
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortEntity.java
deleted file mode 100644
index f92c478..0000000
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortEntity.java
+++ /dev/null
@@ -1,41 +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.entity;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.nifi.web.api.dto.PortDTO;
-
-/**
- * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to an input PortDTO.
- */
-@XmlRootElement(name = "inputPortEntity")
-public class InputPortEntity extends Entity {
-
- private PortDTO inputPort;
-
- /**
- * @return input PortDTO that are being serialized
- */
- public PortDTO getInputPort() {
- return inputPort;
- }
-
- public void setInputPort(PortDTO inputPort) {
- this.inputPort = inputPort;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortsEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortsEntity.java
index 93a03e7..ba18881 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortsEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortsEntity.java
@@ -16,27 +16,25 @@
*/
package org.apache.nifi.web.api.entity;
-import java.util.Set;
-
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.nifi.web.api.dto.PortDTO;
+import java.util.Set;
/**
- * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of input PortDTOs.
+ * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of input InputPortEntitys.
*/
@XmlRootElement(name = "inputPortsEntity")
public class InputPortsEntity extends Entity {
- private Set<PortDTO> inputPorts;
+ private Set<PortEntity> inputPorts;
/**
- * @return collection of input PortDTOs that are being serialized
+ * @return collection of input InputPortEntitys that are being serialized
*/
- public Set<PortDTO> getInputPorts() {
+ public Set<PortEntity> getInputPorts() {
return inputPorts;
}
- public void setInputPorts(Set<PortDTO> inputPorts) {
+ public void setInputPorts(Set<PortEntity> inputPorts) {
this.inputPorts = inputPorts;
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelEntity.java
index 535240c..48e2aa7 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelEntity.java
@@ -16,28 +16,43 @@
*/
package org.apache.nifi.web.api.entity;
-import javax.xml.bind.annotation.XmlRootElement;
+import org.apache.nifi.web.api.dto.DimensionsDTO;
import org.apache.nifi.web.api.dto.LabelDTO;
+import javax.xml.bind.annotation.XmlRootElement;
+
/**
* A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a LabelDTO.
*/
@XmlRootElement(name = "labelEntity")
-public class LabelEntity extends Entity {
+public class LabelEntity extends ComponentEntity {
- private LabelDTO label;
+ private DimensionsDTO dimensions;
+ private LabelDTO component;
/**
* The LabelDTO that is being serialized.
*
* @return The LabelDTO object
*/
- public LabelDTO getLabel() {
- return label;
+ public LabelDTO getComponent() {
+ return component;
}
- public void setLabel(LabelDTO label) {
- this.label = label;
+ public void setComponent(LabelDTO component) {
+ this.component = component;
}
+ /**
+ * The dimensions of this label.
+ *
+ * @return The dimensions
+ */
+ public DimensionsDTO getDimensions() {
+ return dimensions;
+ }
+
+ public void setDimensions(DimensionsDTO dimensions) {
+ this.dimensions = dimensions;
+ }
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelsEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelsEntity.java
index 05dab6c..855ce6c 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelsEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelsEntity.java
@@ -16,27 +16,25 @@
*/
package org.apache.nifi.web.api.entity;
-import java.util.Set;
-
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.nifi.web.api.dto.LabelDTO;
+import java.util.Set;
/**
- * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of LabelDTOs.
+ * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of LabelEntity's.
*/
@XmlRootElement(name = "labelsEntity")
public class LabelsEntity extends Entity {
- private Set<LabelDTO> labels;
+ private Set<LabelEntity> labels;
/**
- * @return collection of LabelDTOs that are being serialized
+ * @return collection of LabelEntity's that are being serialized
*/
- public Set<LabelDTO> getLabels() {
+ public Set<LabelEntity> getLabels() {
return labels;
}
- public void setLabels(Set<LabelDTO> labels) {
+ public void setLabels(Set<LabelEntity> labels) {
this.labels = labels;
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortEntity.java
deleted file mode 100644
index 4f40aec..0000000
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortEntity.java
+++ /dev/null
@@ -1,41 +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.entity;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.nifi.web.api.dto.PortDTO;
-
-/**
- * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to an output PortDTO.
- */
-@XmlRootElement(name = "outputPortEntity")
-public class OutputPortEntity extends Entity {
-
- private PortDTO outputPort;
-
- /**
- * @return output PortDTO that are being serialized
- */
- public PortDTO getOutputPort() {
- return outputPort;
- }
-
- public void setOutputPort(PortDTO outputPort) {
- this.outputPort = outputPort;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortsEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortsEntity.java
index e624c52..9b98414 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortsEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortsEntity.java
@@ -16,27 +16,25 @@
*/
package org.apache.nifi.web.api.entity;
-import java.util.Set;
-
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.nifi.web.api.dto.PortDTO;
+import java.util.Set;
/**
- * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of output PortDTOs.
+ * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of output OutputPortEntitys.
*/
@XmlRootElement(name = "outputPortsEntity")
public class OutputPortsEntity extends Entity {
- private Set<PortDTO> outputPorts;
+ private Set<PortEntity> outputPorts;
/**
- * @return collection of output PortDTOs that are being serialized
+ * @return collection of output OutputPortEntitys that are being serialized
*/
- public Set<PortDTO> getOutputPorts() {
+ public Set<PortEntity> getOutputPorts() {
return outputPorts;
}
- public void setOutputPorts(Set<PortDTO> outputPorts) {
+ public void setOutputPorts(Set<PortEntity> outputPorts) {
this.outputPorts = outputPorts;
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortEntity.java
new file mode 100644
index 0000000..0dc4fdc
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PortEntity.java
@@ -0,0 +1,50 @@
+/*
+ * 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.entity;
+
+import org.apache.nifi.web.api.dto.PortDTO;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to an input PortDTO.
+ */
+@XmlRootElement(name = "portEntity")
+public class PortEntity extends ComponentEntity {
+
+ private PortDTO component;
+ private String portType;
+
+ /**
+ * @return input PortDTO that are being serialized
+ */
+ public PortDTO getComponent() {
+ return component;
+ }
+
+ public void setComponent(PortDTO component) {
+ this.component = component;
+ }
+
+ public String getPortType() {
+ return portType;
+ }
+
+ public void setPortType(String portType) {
+ this.portType = portType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java
index d1ec034..06e78e5 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupEntity.java
@@ -23,21 +23,21 @@ import org.apache.nifi.web.api.dto.ProcessGroupDTO;
* A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a ProcessGroupDTO.
*/
@XmlRootElement(name = "processGroupEntity")
-public class ProcessGroupEntity extends Entity {
+public class ProcessGroupEntity extends ComponentEntity {
- private ProcessGroupDTO processGroup;
+ private ProcessGroupDTO component;
/**
* The ProcessGroupDTO that is being serialized.
*
* @return The ControllerDTO object
*/
- public ProcessGroupDTO getProcessGroup() {
- return processGroup;
+ public ProcessGroupDTO getComponent() {
+ return component;
}
- public void setProcessGroup(ProcessGroupDTO controller) {
- this.processGroup = controller;
+ public void setComponent(ProcessGroupDTO component) {
+ this.component = component;
}
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupFlowEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupFlowEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupFlowEntity.java
new file mode 100644
index 0000000..8ab1327
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupFlowEntity.java
@@ -0,0 +1,44 @@
+/*
+ * 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.entity;
+
+import org.apache.nifi.web.api.dto.flow.ProcessGroupFlowDTO;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a ProcessGroupFlowDTO.
+ */
+@XmlRootElement(name = "processGroupFlowEntity")
+public class ProcessGroupFlowEntity extends Entity {
+
+ private ProcessGroupFlowDTO processGroupFlow;
+
+ /**
+ * The ProcessGroupFlowDTO that is being serialized.
+ *
+ * @return The ProcessGroupFlowDTO object
+ */
+ public ProcessGroupFlowDTO getProcessGroupFlow() {
+ return processGroupFlow;
+ }
+
+ public void setProcessGroupFlow(ProcessGroupFlowDTO flow) {
+ this.processGroupFlow = flow;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupsEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupsEntity.java
index 7acf650..4f222e3 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupsEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupsEntity.java
@@ -16,28 +16,27 @@
*/
package org.apache.nifi.web.api.entity;
-import java.util.Set;
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.nifi.web.api.dto.ProcessGroupDTO;
+import java.util.Set;
/**
- * A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a set of ProcessGroupDTOs.
+ * A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a set of ProcessGroupEntitys.
*/
@XmlRootElement(name = "processGroupsEntity")
public class ProcessGroupsEntity extends Entity {
- private Set<ProcessGroupDTO> processGroups;
+ private Set<ProcessGroupEntity> processGroups;
/**
- * The ProcessGroupDTO that is being serialized.
+ * The ProcessGroupEntity that is being serialized.
*
- * @return The ProcessGroupDTOs
+ * @return The ProcessGroupEntitys
*/
- public Set<ProcessGroupDTO> getProcessGroups() {
+ public Set<ProcessGroupEntity> getProcessGroups() {
return processGroups;
}
- public void setProcessGroups(Set<ProcessGroupDTO> processGroups) {
+ public void setProcessGroups(Set<ProcessGroupEntity> processGroups) {
this.processGroups = processGroups;
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorEntity.java
index e03bb85..edf3c5e 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorEntity.java
@@ -16,28 +16,29 @@
*/
package org.apache.nifi.web.api.entity;
-import javax.xml.bind.annotation.XmlRootElement;
import org.apache.nifi.web.api.dto.ProcessorDTO;
+import javax.xml.bind.annotation.XmlRootElement;
+
/**
* A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a ProcessorDTO.
*/
@XmlRootElement(name = "processorEntity")
-public class ProcessorEntity extends Entity {
+public class ProcessorEntity extends ComponentEntity {
- private ProcessorDTO processor;
+ private ProcessorDTO component;
/**
* The ProcessorDTO that is being serialized.
*
* @return The ProcessorDTO object
*/
- public ProcessorDTO getProcessor() {
- return processor;
+ public ProcessorDTO getComponent() {
+ return component;
}
- public void setProcessor(ProcessorDTO processor) {
- this.processor = processor;
+ public void setComponent(ProcessorDTO component) {
+ this.component = component;
}
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorsEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorsEntity.java
index 04db99f..06ed8f5 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorsEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorsEntity.java
@@ -16,27 +16,25 @@
*/
package org.apache.nifi.web.api.entity;
-import java.util.Set;
-
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.nifi.web.api.dto.ProcessorDTO;
+import java.util.Set;
/**
- * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of ProcessorDTOs.
+ * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of ProcessorEntity's.
*/
@XmlRootElement(name = "processorsEntity")
public class ProcessorsEntity extends Entity {
- private Set<ProcessorDTO> processors;
+ private Set<ProcessorEntity> processors;
/**
- * @return collection of ProcessorDTOs that are being serialized
+ * @return collection of ProcessorEntity's that are being serialized
*/
- public Set<ProcessorDTO> getProcessors() {
+ public Set<ProcessorEntity> getProcessors() {
return processors;
}
- public void setProcessors(Set<ProcessorDTO> processors) {
+ public void setProcessors(Set<ProcessorEntity> processors) {
this.processors = processors;
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupEntity.java
index ba12f40..3183cde 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupEntity.java
@@ -23,21 +23,21 @@ import org.apache.nifi.web.api.dto.RemoteProcessGroupDTO;
* A serialized representation of this class can be placed in the entity body of a request or response to or from the API. This particular entity holds a reference to a RemoteProcessGroupDTO.
*/
@XmlRootElement(name = "remoteProcessGroupEntity")
-public class RemoteProcessGroupEntity extends Entity {
+public class RemoteProcessGroupEntity extends ComponentEntity {
- private RemoteProcessGroupDTO remoteProcessGroup;
+ private RemoteProcessGroupDTO component;
/**
* The RemoteProcessGroupDTO that is being serialized.
*
* @return The RemoteProcessGroupDTO object
*/
- public RemoteProcessGroupDTO getRemoteProcessGroup() {
- return remoteProcessGroup;
+ public RemoteProcessGroupDTO getComponent() {
+ return component;
}
- public void setRemoteProcessGroup(RemoteProcessGroupDTO remoteProcessGroup) {
- this.remoteProcessGroup = remoteProcessGroup;
+ public void setComponent(RemoteProcessGroupDTO component) {
+ this.component = component;
}
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupsEntity.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupsEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupsEntity.java
index 42abf23..c8fc695 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupsEntity.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupsEntity.java
@@ -16,27 +16,25 @@
*/
package org.apache.nifi.web.api.entity;
-import java.util.Set;
-
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.nifi.web.api.dto.RemoteProcessGroupDTO;
+import java.util.Set;
/**
- * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of RemoteProcessGroupDTOs.
+ * A serialized representation of this class can be placed in the entity body of a response to the API. This particular entity holds a reference to a list of RemoteProcessGroupEntitys.
*/
@XmlRootElement(name = "remoteProcessGroupsEntity")
public class RemoteProcessGroupsEntity extends Entity {
- private Set<RemoteProcessGroupDTO> remoteProcessGroups;
+ private Set<RemoteProcessGroupEntity> remoteProcessGroups;
/**
- * @return collection of RemoteProcessGroupDTOs that are being serialized
+ * @return collection of RemoteProcessGroupEntitys that are being serialized
*/
- public Set<RemoteProcessGroupDTO> getRemoteProcessGroups() {
+ public Set<RemoteProcessGroupEntity> getRemoteProcessGroups() {
return remoteProcessGroups;
}
- public void setRemoteProcessGroups(Set<RemoteProcessGroupDTO> remoteProcessGroups) {
+ public void setRemoteProcessGroups(Set<RemoteProcessGroupEntity> remoteProcessGroups) {
this.remoteProcessGroups = remoteProcessGroups;
}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/xsd/authorizations.xsd
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/xsd/authorizations.xsd b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/xsd/authorizations.xsd
index dc17265..f659b27 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/xsd/authorizations.xsd
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/xsd/authorizations.xsd
@@ -28,7 +28,6 @@
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="R"/>
- <xs:enumeration value="W"/>
<xs:enumeration value="RW"/>
</xs:restriction>
</xs:simpleType>
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/pom.xml
index 8532ec5..918c6cf 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/pom.xml
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/pom.xml
@@ -21,11 +21,68 @@
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>nifi-framework-authorization</artifactId>
-
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <directory>src/main/xsd</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxb2-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>current</id>
+ <goals>
+ <goal>xjc</goal>
+ </goals>
+ <configuration>
+ <packageName>org.apache.nifi.authorization.generated</packageName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <excludes>**/authorization/generated/*.java,</excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
<dependencies>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-expression-language</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-properties</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-nar-utils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/AccessDeniedException.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/AccessDeniedException.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/AccessDeniedException.java
new file mode 100644
index 0000000..092e80c
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/AccessDeniedException.java
@@ -0,0 +1,39 @@
+/*
+ * 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.authorization;
+
+/**
+ * Represents any error that might occur while authorizing user requests.
+ */
+public class AccessDeniedException extends RuntimeException {
+
+ public AccessDeniedException(Throwable cause) {
+ super(cause);
+ }
+
+ public AccessDeniedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public AccessDeniedException(String message) {
+ super(message);
+ }
+
+ public AccessDeniedException() {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java
new file mode 100644
index 0000000..423ae25
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java
@@ -0,0 +1,341 @@
+/*
+ * 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.authorization;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.authorization.annotation.AuthorizerContext;
+import org.apache.nifi.authorization.exception.AuthorizationAccessException;
+import org.apache.nifi.authorization.exception.AuthorizerCreationException;
+import org.apache.nifi.authorization.exception.AuthorizerDestructionException;
+import org.apache.nifi.authorization.generated.Authorizers;
+import org.apache.nifi.authorization.generated.Property;
+import org.apache.nifi.nar.ExtensionManager;
+import org.apache.nifi.nar.NarCloseable;
+import org.apache.nifi.util.NiFiProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.FactoryBean;
+import org.xml.sax.SAXException;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Factory bean for loading the configured authorizer.
+ */
+public class AuthorizerFactoryBean implements FactoryBean, DisposableBean, AuthorizerLookup {
+
+ private static final Logger logger = LoggerFactory.getLogger(AuthorizerFactoryBean.class);
+ private static final String AUTHORIZERS_XSD = "/authorizers.xsd";
+ private static final String JAXB_GENERATED_PATH = "org.apache.nifi.authorization.generated";
+ private static final JAXBContext JAXB_CONTEXT = initializeJaxbContext();
+
+ /**
+ * Load the JAXBContext.
+ */
+ private static JAXBContext initializeJaxbContext() {
+ try {
+ return JAXBContext.newInstance(JAXB_GENERATED_PATH, AuthorizerFactoryBean.class.getClassLoader());
+ } catch (JAXBException e) {
+ throw new RuntimeException("Unable to create JAXBContext.");
+ }
+ }
+
+ private Authorizer authorizer;
+ private NiFiProperties properties;
+ private final Map<String, Authorizer> authorizers = new HashMap<>();
+
+ @Override
+ public Authorizer getAuthorizer(String identifier) {
+ return authorizers.get(identifier);
+ }
+
+ @Override
+ public Object getObject() throws Exception {
+ if (authorizer == null) {
+ if (properties.getSslPort() == null) {
+ // use a default authorizer... only allowable when running not securely
+ authorizer = createDefaultAuthorizer();
+ } else {
+ // look up the authorizer to use
+ final String authorizerIdentifier = properties.getProperty(NiFiProperties.SECURITY_USER_AUTHORIZER);
+
+ // ensure the authorizer class name was specified
+ if (StringUtils.isBlank(authorizerIdentifier)) {
+ throw new Exception("When running securely, the authorizer identifier must be specified in the nifi properties file.");
+ } else {
+ final Authorizers authorizerConfiguration = loadAuthorizersConfiguration();
+
+ // create each authorizer
+ for (final org.apache.nifi.authorization.generated.Authorizer authorizer : authorizerConfiguration.getAuthorizer()) {
+ authorizers.put(authorizer.getIdentifier(), createAuthorizer(authorizer.getIdentifier(), authorizer.getClazz()));
+ }
+
+ // configure each authorizer
+ for (final org.apache.nifi.authorization.generated.Authorizer provider : authorizerConfiguration.getAuthorizer()) {
+ final Authorizer instance = authorizers.get(provider.getIdentifier());
+ instance.onConfigured(loadAuthorizerConfiguration(provider));
+ }
+
+ // get the authorizer instance
+ authorizer = getAuthorizer(authorizerIdentifier);
+
+ // ensure it was found
+ if (authorizer == null) {
+ throw new Exception(String.format("The specified authorizer '%s' could not be found.", authorizerIdentifier));
+ }
+ }
+ }
+ }
+
+ return authorizer;
+ }
+
+ private Authorizers loadAuthorizersConfiguration() throws Exception {
+ final File authorizersConfigurationFile = properties.getAuthorizerConfiguraitonFile();
+
+ // load the authorizers from the specified file
+ if (authorizersConfigurationFile.exists()) {
+ try {
+ // find the schema
+ final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ final Schema schema = schemaFactory.newSchema(Authorizers.class.getResource(AUTHORIZERS_XSD));
+
+ // attempt to unmarshal
+ final Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller();
+ unmarshaller.setSchema(schema);
+ final JAXBElement<Authorizers> element = unmarshaller.unmarshal(new StreamSource(authorizersConfigurationFile), Authorizers.class);
+ return element.getValue();
+ } catch (SAXException | JAXBException e) {
+ throw new Exception("Unable to load the authorizer configuration file at: " + authorizersConfigurationFile.getAbsolutePath(), e);
+ }
+ } else {
+ throw new Exception("Unable to find the authorizer configuration file at " + authorizersConfigurationFile.getAbsolutePath());
+ }
+ }
+
+ private Authorizer createAuthorizer(final String identifier, final String authorizerClassName) throws Exception {
+ // get the classloader for the specified authorizer
+ final ClassLoader authorizerClassLoader = ExtensionManager.getClassLoader(authorizerClassName);
+ if (authorizerClassLoader == null) {
+ throw new Exception(String.format("The specified authorizer class '%s' is not known to this nifi.", authorizerClassName));
+ }
+
+ // get the current context classloader
+ final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
+
+ final Authorizer instance;
+ try {
+ // set the appropriate class loader
+ Thread.currentThread().setContextClassLoader(authorizerClassLoader);
+
+ // attempt to load the class
+ Class<?> rawAuthorizerClass = Class.forName(authorizerClassName, true, authorizerClassLoader);
+ Class<? extends Authorizer> authorizerClass = rawAuthorizerClass.asSubclass(Authorizer.class);
+
+ // otherwise create a new instance
+ Constructor constructor = authorizerClass.getConstructor();
+ instance = (Authorizer) constructor.newInstance();
+
+ // method injection
+ performMethodInjection(instance, authorizerClass);
+
+ // field injection
+ performFieldInjection(instance, authorizerClass);
+
+ // call post construction lifecycle event
+ instance.initialize(new StandardAuthorizerInitializationContext(identifier, this));
+ } finally {
+ if (currentClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(currentClassLoader);
+ }
+ }
+
+ return withNarLoader(instance);
+ }
+
+ private AuthorizerConfigurationContext loadAuthorizerConfiguration(final org.apache.nifi.authorization.generated.Authorizer authorizer) {
+ final Map<String, String> authorizerProperties = new HashMap<>();
+
+ for (final Property property : authorizer.getProperty()) {
+ authorizerProperties.put(property.getName(), property.getValue());
+ }
+
+ return new StandardAuthorizerConfigurationContext(authorizer.getIdentifier(), authorizerProperties);
+ }
+
+ private void performMethodInjection(final Authorizer instance, final Class authorizerClass) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ for (final Method method : authorizerClass.getMethods()) {
+ if (method.isAnnotationPresent(AuthorizerContext.class)) {
+ // make the method accessible
+ final boolean isAccessible = method.isAccessible();
+ method.setAccessible(true);
+
+ try {
+ final Class<?>[] argumentTypes = method.getParameterTypes();
+
+ // look for setters (single argument)
+ if (argumentTypes.length == 1) {
+ final Class<?> argumentType = argumentTypes[0];
+
+ // look for well known types
+ if (NiFiProperties.class.isAssignableFrom(argumentType)) {
+ // nifi properties injection
+ method.invoke(instance, properties);
+ }
+ }
+ } finally {
+ method.setAccessible(isAccessible);
+ }
+ }
+ }
+
+ final Class parentClass = authorizerClass.getSuperclass();
+ if (parentClass != null && Authorizer.class.isAssignableFrom(parentClass)) {
+ performMethodInjection(instance, parentClass);
+ }
+ }
+
+ private void performFieldInjection(final Authorizer instance, final Class authorizerClass) throws IllegalArgumentException, IllegalAccessException {
+ for (final Field field : authorizerClass.getDeclaredFields()) {
+ if (field.isAnnotationPresent(AuthorizerContext.class)) {
+ // make the method accessible
+ final boolean isAccessible = field.isAccessible();
+ field.setAccessible(true);
+
+ try {
+ // get the type
+ final Class<?> fieldType = field.getType();
+
+ // only consider this field if it isn't set yet
+ if (field.get(instance) == null) {
+ // look for well known types
+ if (NiFiProperties.class.isAssignableFrom(fieldType)) {
+ // nifi properties injection
+ field.set(instance, properties);
+ }
+ }
+
+ } finally {
+ field.setAccessible(isAccessible);
+ }
+ }
+ }
+
+ final Class parentClass = authorizerClass.getSuperclass();
+ if (parentClass != null && Authorizer.class.isAssignableFrom(parentClass)) {
+ performFieldInjection(instance, parentClass);
+ }
+ }
+
+ /**
+ * @return a default Authorizer to use when running unsecurely with no authorizer configured
+ */
+ private Authorizer createDefaultAuthorizer() {
+ return new Authorizer() {
+ @Override
+ public AuthorizationResult authorize(final AuthorizationRequest request) throws AuthorizationAccessException {
+ return AuthorizationResult.approved();
+ }
+
+ @Override
+ public void initialize(AuthorizerInitializationContext initializationContext) throws AuthorizerCreationException {
+ }
+
+ @Override
+ public void onConfigured(AuthorizerConfigurationContext configurationContext) throws AuthorizerCreationException {
+ }
+
+ @Override
+ public void preDestruction() throws AuthorizerDestructionException {
+ }
+ };
+ }
+
+ /**
+ * Decorates the base authorizer to ensure the nar context classloader is used when invoking the underlying methods.
+ *
+ * @param baseAuthorizer base authorizer
+ * @return authorizer
+ */
+ public Authorizer withNarLoader(final Authorizer baseAuthorizer) {
+ return new Authorizer() {
+ @Override
+ public AuthorizationResult authorize(final AuthorizationRequest request) throws AuthorizationAccessException {
+ try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ return baseAuthorizer.authorize(request);
+ }
+ }
+
+ @Override
+ public void initialize(AuthorizerInitializationContext initializationContext) throws AuthorizerCreationException {
+ try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ baseAuthorizer.initialize(initializationContext);
+ }
+ }
+
+ @Override
+ public void onConfigured(AuthorizerConfigurationContext configurationContext) throws AuthorizerCreationException {
+ try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ baseAuthorizer.onConfigured(configurationContext);
+ }
+ }
+
+ @Override
+ public void preDestruction() throws AuthorizerDestructionException {
+ try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+ baseAuthorizer.preDestruction();
+ }
+ }
+ };
+ }
+
+ @Override
+ public Class getObjectType() {
+ return Authorizer.class;
+ }
+
+ @Override
+ public boolean isSingleton() {
+ return true;
+ }
+
+ @Override
+ public void destroy() throws Exception {
+ if (authorizer != null) {
+ authorizer.preDestruction();
+ }
+ }
+
+ public void setProperties(NiFiProperties properties) {
+ this.properties = properties;
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/StandardAuthorizerConfigurationContext.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/StandardAuthorizerConfigurationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/StandardAuthorizerConfigurationContext.java
new file mode 100644
index 0000000..3010c92
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/StandardAuthorizerConfigurationContext.java
@@ -0,0 +1,54 @@
+/*
+ * 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.authorization;
+
+import org.apache.nifi.attribute.expression.language.StandardPropertyValue;
+import org.apache.nifi.components.PropertyValue;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ *
+ */
+public class StandardAuthorizerConfigurationContext implements AuthorizerConfigurationContext {
+
+ private final String identifier;
+ private final Map<String, String> properties;
+
+ public StandardAuthorizerConfigurationContext(String identifier, Map<String, String> properties) {
+ this.identifier = identifier;
+ this.properties = Collections.unmodifiableMap(new HashMap<String, String>(properties));
+ }
+
+ @Override
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public PropertyValue getProperty(String property) {
+ return new StandardPropertyValue(properties.get(property), null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/StandardAuthorizerInitializationContext.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/StandardAuthorizerInitializationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/StandardAuthorizerInitializationContext.java
new file mode 100644
index 0000000..344f49c
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/StandardAuthorizerInitializationContext.java
@@ -0,0 +1,41 @@
+/*
+ * 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.authorization;
+
+/**
+ *
+ */
+public class StandardAuthorizerInitializationContext implements AuthorizerInitializationContext {
+
+ private final String identifier;
+ private final AuthorizerLookup authorizerLookup;
+
+ public StandardAuthorizerInitializationContext(String identifier, AuthorizerLookup authorizerLookup) {
+ this.identifier = identifier;
+ this.authorizerLookup = authorizerLookup;
+ }
+
+ @Override
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ public AuthorizerLookup getAuthorizerLookup() {
+ return authorizerLookup;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/Authorizable.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/Authorizable.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/Authorizable.java
new file mode 100644
index 0000000..c897be2
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/Authorizable.java
@@ -0,0 +1,129 @@
+/*
+ * 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.authorization.resource;
+
+import org.apache.nifi.authorization.AccessDeniedException;
+import org.apache.nifi.authorization.AuthorizationRequest;
+import org.apache.nifi.authorization.AuthorizationResult;
+import org.apache.nifi.authorization.AuthorizationResult.Result;
+import org.apache.nifi.authorization.Authorizer;
+import org.apache.nifi.authorization.RequestAction;
+import org.apache.nifi.authorization.Resource;
+import org.apache.nifi.authorization.user.NiFiUser;
+import org.apache.nifi.authorization.user.NiFiUserUtils;
+
+public interface Authorizable {
+
+ /**
+ * The parent for this Authorizable. May be null.
+ *
+ * @return the parent authorizable or null
+ */
+ Authorizable getParentAuthorizable();
+
+ /**
+ * The Resource for this Authorizable.
+ *
+ * @return the parent resource
+ */
+ Resource getResource();
+
+ /**
+ * Returns whether the current user is authorized for the specified action on the specified resource. This
+ * method does not imply the user is directly attempting to access the specified resource. If the user is
+ * attempting a direct access use Authorizable.authorize().
+ *
+ * @param authorizer authorizer
+ * @param action action
+ * @return is authorized
+ */
+ default boolean isAuthorized(Authorizer authorizer, RequestAction action) {
+ return Result.Approved.equals(checkAuthorization(authorizer, action).getResult());
+ }
+
+ /**
+ * Returns the result of an authorization request for the current user for the specified action on the specified
+ * resource. This method does not imply the user is directly attempting to access the specified resource. If the user is
+ * attempting a direct access use Authorizable.authorize().
+ *
+ * @param authorizer authorizer
+ * @param action action
+ * @return is authorized
+ */
+ default AuthorizationResult checkAuthorization(Authorizer authorizer, RequestAction action) {
+ final NiFiUser user = NiFiUserUtils.getNiFiUser();
+
+ // TODO - include user details context
+
+ // build the request
+ final AuthorizationRequest request = new AuthorizationRequest.Builder()
+ .identity(user.getIdentity())
+ .anonymous(user.isAnonymous())
+ .accessAttempt(false)
+ .action(action)
+ .resource(getResource())
+ .build();
+
+ // perform the authorization
+ final AuthorizationResult result = authorizer.authorize(request);
+
+ // verify the results
+ if (Result.ResourceNotFound.equals(result.getResult())) {
+ final Authorizable parent = getParentAuthorizable();
+ if (parent == null) {
+ return AuthorizationResult.denied();
+ } else {
+ return parent.checkAuthorization(authorizer, action);
+ }
+ } else {
+ return result;
+ }
+ }
+
+ /**
+ * Authorizes the current user for the specified action on the specified resource. This method does imply the user is
+ * directly accessing the specified resource.
+ *
+ * @param authorizer authorizer
+ * @param action action
+ */
+ default void authorize(Authorizer authorizer, RequestAction action) throws AccessDeniedException {
+ final NiFiUser user = NiFiUserUtils.getNiFiUser();
+
+ // TODO - include user details context
+
+ final AuthorizationRequest request = new AuthorizationRequest.Builder()
+ .identity(user.getIdentity())
+ .anonymous(user.isAnonymous())
+ .accessAttempt(true)
+ .action(action)
+ .resource(getResource())
+ .build();
+
+ final AuthorizationResult result = authorizer.authorize(request);
+ if (Result.ResourceNotFound.equals(result.getResult())) {
+ final Authorizable parent = getParentAuthorizable();
+ if (parent == null) {
+ throw new AccessDeniedException("Access is denied");
+ } else {
+ parent.authorize(authorizer, action);
+ }
+ } else if (Result.Denied.equals(result.getResult())) {
+ throw new AccessDeniedException(result.getExplanation());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceFactory.java
index a641810..ce8f1bf 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceFactory.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceFactory.java
@@ -203,7 +203,6 @@ public final class ResourceFactory {
public static Resource getComponentResource(final ResourceType resourceType, final String identifier, final String name) {
Objects.requireNonNull(resourceType, "The resource must be specified.");
Objects.requireNonNull(identifier, "The component identifier must be specified.");
- Objects.requireNonNull(name, "The component name must be specified.");
return new Resource() {
@Override
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceType.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceType.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceType.java
index 20ace59..f3e9b6c 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceType.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/resource/ResourceType.java
@@ -20,6 +20,7 @@ public enum ResourceType {
Processor("/processors"),
InputPort("/input-ports"),
OutputPort("/output-ports"),
+ Funnel("/funnel"),
Connection("/connections"),
ProcessGroup("/process-groups"),
RemoteProcessGroup("/remote-process-groups"),
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/user/NiFiUser.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/user/NiFiUser.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/user/NiFiUser.java
new file mode 100644
index 0000000..80e7406
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/user/NiFiUser.java
@@ -0,0 +1,97 @@
+/*
+ * 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.authorization.user;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * An NiFiUser.
+ */
+public class NiFiUser implements Serializable {
+
+ public static final NiFiUser ANONYMOUS = new NiFiUser("anonymous");
+
+ private String identity;
+ private String userName;
+
+ private NiFiUser chain;
+
+ public NiFiUser(String identity) {
+ this(identity, identity, null);
+ }
+
+ public NiFiUser(String identity, String userName) {
+ this(identity, userName, null);
+ }
+
+ public NiFiUser(String identity, NiFiUser chain) {
+ this(identity, identity, chain);
+ }
+
+ public NiFiUser(String identity, String userName, NiFiUser chain) {
+ this.identity = identity;
+ this.userName = userName;
+ this.chain = chain;
+ }
+
+ /* getters / setters */
+
+ public String getIdentity() {
+ return identity;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public NiFiUser getChain() {
+ return chain;
+ }
+
+ public boolean isAnonymous() {
+ return this == ANONYMOUS;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final NiFiUser other = (NiFiUser) obj;
+ if (!Objects.equals(this.identity, other.identity)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 53 * hash + Objects.hashCode(this.identity);
+ return hash;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("identity[%s], userName[%s]", getIdentity(), getUserName(), ", ");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/user/NiFiUserDetails.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/user/NiFiUserDetails.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/user/NiFiUserDetails.java
new file mode 100644
index 0000000..f8b7c18
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-authorization/src/main/java/org/apache/nifi/authorization/user/NiFiUserDetails.java
@@ -0,0 +1,91 @@
+/*
+ * 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.authorization.user;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * User details for a NiFi user.
+ */
+public class NiFiUserDetails implements UserDetails {
+
+ private final NiFiUser user;
+
+ /**
+ * Creates a new NiFiUserDetails.
+ *
+ * @param user user
+ */
+ public NiFiUserDetails(NiFiUser user) {
+ this.user = user;
+ }
+
+ /**
+ * Get the user for this UserDetails.
+ *
+ * @return user
+ */
+ public NiFiUser getNiFiUser() {
+ return user;
+ }
+
+ /**
+ * Returns the authorities that this NiFi user has.
+ *
+ * @return authorities
+ */
+ @Override
+ public Collection<? extends GrantedAuthority> getAuthorities() {
+ return Collections.EMPTY_SET;
+ }
+
+ @Override
+ public String getPassword() {
+ return StringUtils.EMPTY;
+ }
+
+ @Override
+ public String getUsername() {
+ return user.getIdentity();
+ }
+
+ @Override
+ public boolean isAccountNonExpired() {
+ return true;
+ }
+
+ @Override
+ public boolean isAccountNonLocked() {
+ return true;
+ }
+
+ @Override
+ public boolean isCredentialsNonExpired() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+}