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 2015/02/11 17:25:18 UTC

[2/4] incubator-nifi git commit: NIFI-250: - Adding endpoints for retrieving and updating controller service referencing components.

NIFI-250:
- Adding endpoints for retrieving and updating controller service referencing components.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/ceede01b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/ceede01b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/ceede01b

Branch: refs/heads/NIFI-250
Commit: ceede01b8ffe57c003ac246b51854dd6b01ad70e
Parents: 8a414b3
Author: Matt Gilman <ma...@gmail.com>
Authored: Wed Feb 11 10:45:14 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Wed Feb 11 10:45:14 2015 -0500

----------------------------------------------------------------------
 .../nifi/web/api/dto/ControllerServiceDTO.java  | 146 +----------------
 ...ontrollerServiceReferencingComponentDTO.java | 160 +++++++++++++++++++
 ...ollerServiceReferencingComponentsEntity.java |  46 ++++++
 .../nifi/web/api/ControllerServiceResource.java |  10 +-
 4 files changed, 214 insertions(+), 148 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ceede01b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
index b6d707c..1372195 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
@@ -38,7 +38,7 @@ public class ControllerServiceDTO extends NiFiComponentDTO {
  
     private String annotationData;
     
-    private Set<ControllerServiceReferenceDTO> references;
+    private Set<ControllerServiceReferencingComponentDTO> references;
     
     private Collection<String> validationErrors;
 
@@ -151,11 +151,11 @@ public class ControllerServiceDTO extends NiFiComponentDTO {
      * 
      * @return 
      */
-    public Set<ControllerServiceReferenceDTO> getReferences() {
+    public Set<ControllerServiceReferencingComponentDTO> getReferences() {
         return references;
     }
 
-    public void setReferences(Set<ControllerServiceReferenceDTO> references) {
+    public void setReferences(Set<ControllerServiceReferencingComponentDTO> references) {
         this.references = references;
     }
 
@@ -173,144 +173,4 @@ public class ControllerServiceDTO extends NiFiComponentDTO {
     public void setValidationErrors(Collection<String> validationErrors) {
         this.validationErrors = validationErrors;
     }
-    
-    /**
-     * A component reference a controller service. This can either be another
-     * controller service or a processor. Depending on the type of component
-     * different properties may be set.
-     */
-    @XmlType(name = "controllerServiceReference")
-    public static class ControllerServiceReferenceDTO {
-        private String groupId;
-        private String id;
-        private String name;
-        private String type;
-        private String state;
-        private Boolean enabled;
-        
-        private String referenceType;
-        private Integer activeThreadCount;
-        private Set<ControllerServiceReferenceDTO> references;
-
-        /**
-         * Group id for this component referencing a controller service. If this
-         * component is another service, this field is blank.
-         * 
-         * @return 
-         */
-        public String getGroupId() {
-            return groupId;
-        }
-
-        public void setGroupId(String groupId) {
-            this.groupId = groupId;
-        }
-
-        /**
-         * The id for this component referencing a controller service.
-         * 
-         * @return 
-         */
-        public String getId() {
-            return id;
-        }
-
-        public void setId(String id) {
-            this.id = id;
-        }
-
-        /**
-         * The name for this component referencing a controller service.
-         * 
-         * @return 
-         */
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        /**
-         * The type for this component referencing a controller service.
-         * 
-         * @return 
-         */
-        public String getType() {
-            return type;
-        }
-
-        public void setType(String type) {
-            this.type = type;
-        }
-
-        /**
-         * The state of the processor referencing a controller service. If this
-         * component is another service, this field is blank.
-         * 
-         * @return 
-         */
-        public String getState() {
-            return state;
-        }
-
-        public void setState(String state) {
-            this.state = state;
-        }
-
-        /**
-         * The enabled state of the controller service referencing a controller service.
-         * If this component is a processor, this field is blank.
-         * 
-         * @return 
-         */
-        public Boolean getEnabled() {
-            return enabled;
-        }
-
-        public void setEnabled(Boolean enabled) {
-            this.enabled = enabled;
-        }
-
-        /**
-         * The type of reference this is (Processor, ControllerService, or ReportingTask).
-         * @return 
-         */
-        public String getReferenceType() {
-            return referenceType;
-        }
-
-        public void setReferenceType(String referenceType) {
-            this.referenceType = referenceType;
-        }
-
-        /**
-         * The active thread count for the referencing component.
-         * 
-         * @return 
-         */
-        public Integer getActiveThreadCount() {
-            return activeThreadCount;
-        }
-
-        public void setActiveThreadCount(Integer activeThreadCount) {
-            this.activeThreadCount = activeThreadCount;
-        }
-
-        /**
-         * If this referencing component represents a ControllerService, these
-         * are the components that reference it.
-         * 
-         * @return 
-         */
-        public Set<ControllerServiceReferenceDTO> getReferences() {
-            return references;
-        }
-
-        public void setReferences(Set<ControllerServiceReferenceDTO> references) {
-            this.references = references;
-        }
-        
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ceede01b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java
new file mode 100644
index 0000000..f9dcd97
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java
@@ -0,0 +1,160 @@
+/*
+ * 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.dto;
+
+import java.util.Set;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * A component referencing a controller service. This can either be another
+ * controller service or a processor. Depending on the type of component
+ * different properties may be set.
+ */
+@XmlType(name = "controllerServiceReferencingComponent")
+public class ControllerServiceReferencingComponentDTO {
+    private String groupId;
+    private String id;
+    private String name;
+    private String type;
+    private String state;
+    private Boolean enabled;
+
+    private String referenceType;
+    private Integer activeThreadCount;
+    private Set<ControllerServiceReferencingComponentDTO> references;
+
+    /**
+     * Group id for this component referencing a controller service. If this
+     * component is another service, this field is blank.
+     * 
+     * @return 
+     */
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    /**
+     * The id for this component referencing a controller service.
+     * 
+     * @return 
+     */
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    /**
+     * The name for this component referencing a controller service.
+     * 
+     * @return 
+     */
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * The type for this component referencing a controller service.
+     * 
+     * @return 
+     */
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    /**
+     * The state of the processor referencing a controller service. If this
+     * component is another service, this field is blank.
+     * 
+     * @return 
+     */
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    /**
+     * The enabled state of the controller service referencing a controller service.
+     * If this component is a processor, this field is blank.
+     * 
+     * @return 
+     */
+    public Boolean getEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(Boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    /**
+     * The type of reference this is (Processor, ControllerService, or ReportingTask).
+     * @return 
+     */
+    public String getReferenceType() {
+        return referenceType;
+    }
+
+    public void setReferenceType(String referenceType) {
+        this.referenceType = referenceType;
+    }
+
+    /**
+     * The active thread count for the referencing component.
+     * 
+     * @return 
+     */
+    public Integer getActiveThreadCount() {
+        return activeThreadCount;
+    }
+
+    public void setActiveThreadCount(Integer activeThreadCount) {
+        this.activeThreadCount = activeThreadCount;
+    }
+
+    /**
+     * If this referencing component represents a ControllerService, these
+     * are the components that reference it.
+     * 
+     * @return 
+     */
+    public Set<ControllerServiceReferencingComponentDTO> getReferences() {
+        return references;
+    }
+
+    public void setReferences(Set<ControllerServiceReferencingComponentDTO> references) {
+        this.references = references;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ceede01b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentsEntity.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentsEntity.java
new file mode 100644
index 0000000..6010f93
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentsEntity.java
@@ -0,0 +1,46 @@
+/*
+ * 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 java.util.Set;
+import javax.xml.bind.annotation.XmlRootElement;
+import org.apache.nifi.web.api.dto.ControllerServiceReferencingComponentDTO;
+
+/**
+ * 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
+ * controller services referencing components.
+ */
+@XmlRootElement(name = "controllerServiceReferencingComponentsEntity")
+public class ControllerServiceReferencingComponentsEntity extends Entity {
+
+    private Set<ControllerServiceReferencingComponentDTO> controllerServiceReferencingComponents;
+
+    /**
+     * The list of controller service referencing components that are being serialized.
+     *
+     * @return
+     */
+    public Set<ControllerServiceReferencingComponentDTO> getControllerServiceReferencingComponents() {
+        return controllerServiceReferencingComponents;
+    }
+
+    public void setControllerServiceReferencingComponents(Set<ControllerServiceReferencingComponentDTO> controllerServiceReferencingComponents) {
+        this.controllerServiceReferencingComponents = controllerServiceReferencingComponents;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ceede01b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java
index c6eff25..aaf3b40 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java
@@ -54,7 +54,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.nifi.web.api.dto.ControllerServiceDTO;
 import org.apache.nifi.web.api.dto.ControllerServiceReferencingComponentDTO;
 import org.apache.nifi.web.api.entity.ControllerServiceEntity;
-import org.apache.nifi.web.api.entity.ControllerServiceReferencesEntity;
+import org.apache.nifi.web.api.entity.ControllerServiceReferencingComponentsEntity;
 import org.apache.nifi.web.api.entity.ControllerServicesEntity;
 import org.apache.nifi.web.util.Availability;
 import org.codehaus.enunciate.jaxrs.TypeHint;
@@ -366,9 +366,9 @@ public class ControllerServiceResource extends ApplicationResource {
         revision.setClientId(clientId.getClientId());
 
         // create the response entity
-        final ControllerServiceReferencesEntity entity = new ControllerServiceReferencesEntity();
+        final ControllerServiceReferencingComponentsEntity entity = new ControllerServiceReferencingComponentsEntity();
         entity.setRevision(revision);
-        entity.setControllerServiceReferences(controllerServiceReferences);
+        entity.setControllerServiceReferencingComponents(controllerServiceReferences);
 
         return clusterContext(generateOkResponse(entity)).build();
     }
@@ -431,9 +431,9 @@ public class ControllerServiceResource extends ApplicationResource {
         revision.setVersion(response.getVersion());
 
         // create the response entity
-        final ControllerServiceReferencesEntity entity = new ControllerServiceReferencesEntity();
+        final ControllerServiceReferencingComponentsEntity entity = new ControllerServiceReferencingComponentsEntity();
         entity.setRevision(revision);
-        entity.setControllerServiceReferences(response.getConfiguration());
+        entity.setControllerServiceReferencingComponents(response.getConfiguration());
 
         return clusterContext(generateOkResponse(entity)).build();
     }