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/12/18 16:43:42 UTC

nifi git commit: NIFI-108: - Including queue size statistics in listing request. - Ensuring verifyCanList runs when appropriate.

Repository: nifi
Updated Branches:
  refs/heads/NIFI-108 ba54e8e3f -> 0676165e0


NIFI-108:
- Including queue size statistics in listing request.
- Ensuring verifyCanList runs when appropriate.


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

Branch: refs/heads/NIFI-108
Commit: 0676165e0701c43a997bb7998ee37173c5c57d25
Parents: ba54e8e
Author: Matt Gilman <ma...@gmail.com>
Authored: Fri Dec 18 10:43:33 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Fri Dec 18 10:43:33 2015 -0500

----------------------------------------------------------------------
 .../apache/nifi/web/api/dto/QueueSizeDTO.java   | 59 ++++++++++++++++++++
 .../web/dao/impl/StandardConnectionDAO.java     | 10 +++-
 2 files changed, 68 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/0676165e/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/QueueSizeDTO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/QueueSizeDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/QueueSizeDTO.java
new file mode 100644
index 0000000..cc46c57
--- /dev/null
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/QueueSizeDTO.java
@@ -0,0 +1,59 @@
+/*
+ * 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 com.wordnik.swagger.annotations.ApiModelProperty;
+
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * The stats for a queue.
+ */
+@XmlType(name = "queueSize")
+public class QueueSizeDTO {
+
+    private long byteCount;
+    private int objectCount;
+
+    /**
+     * @return the count of objects in a queue
+     */
+    @ApiModelProperty(
+            value = "The count of objects in a queue."
+    )
+    public int getObjectCount() {
+        return objectCount;
+    }
+
+    public void setObjectCount(int objectCount) {
+        this.objectCount = objectCount;
+    }
+
+    /**
+     * @return the size of objects in a queue
+     */
+    @ApiModelProperty(
+            value = "The size of objects in a queue."
+    )
+    public long getByteCount() {
+        return byteCount;
+    }
+
+    public void setByteCount(long byteCount) {
+        this.byteCount = byteCount;
+    }
+}

http://git-wip-us.apache.org/repos/asf/nifi/blob/0676165e/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java
index 24601b3..d5fb713 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java
@@ -378,6 +378,10 @@ public class StandardConnectionDAO extends ComponentDAO implements ConnectionDAO
     public ListFlowFileStatus createFlowFileListingRequest(String groupId, String id, String listingRequestId, SortColumn column, SortDirection direction) {
         final Connection connection = locateConnection(groupId, id);
         final FlowFileQueue queue = connection.getFlowFileQueue();
+
+        // ensure we can list
+        verifyList(queue);
+
         return queue.listFlowFiles(listingRequestId, 100, column, direction);
     }
 
@@ -392,11 +396,15 @@ public class StandardConnectionDAO extends ComponentDAO implements ConnectionDAO
         }
     }
 
+    private void verifyList(final FlowFileQueue queue) {
+        queue.verifyCanList();
+    }
+
     @Override
     public void verifyList(String groupId, String id) {
         final Connection connection = locateConnection(groupId, id);
         final FlowFileQueue queue = connection.getFlowFileQueue();
-        queue.verifyCanList();
+        verifyList(queue);
     }
 
     @Override