{"action":"created","comment":{"url":"https://api.github.com/repos/apache/nifi/pulls/comments/230117182","pull_request_review_id":170779918,"id":230117182,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDExNzE4Mg==","diff_hunk":"@@ -0,0 +1,160 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements.  See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * the License.  You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.apache.nifi.nar;\n+\n+import org.apache.nifi.bundle.Bundle;\n+import org.apache.nifi.bundle.BundleCoordinate;\n+import org.apache.nifi.bundle.BundleDetails;\n+import org.apache.nifi.documentation.DocGenerator;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import java.io.File;\n+import java.util.ArrayList;\n+import java.util.Collections;\n+import java.util.List;\n+import java.util.Set;\n+import java.util.jar.Attributes;\n+import java.util.jar.JarFile;\n+import java.util.jar.Manifest;\n+\n+/**\n+ * Loads a set of NARs from the file system into the running application.\n+ *\n+ * NOTE: Initially this will only be used from the NarAutoLoader which is watching a directory for new files, but eventually\n+ * this may also be used for loading a NAR that was downloaded from the extension registry, and thus the load method\n+ * is synchronized to ensure only one set of NARs can be in process of loading at a given time.\n+ */\n+public class NarLoader {\n+\n+    private static Logger LOGGER = LoggerFactory.getLogger(NarLoader.class);\n+\n+    private File extensionsWorkingDir;\n+    private File docsWorkingDir;\n+    private NarClassLoaders narClassLoaders;\n+    private ExtensionDiscoveringManager extensionManager;\n+    private ExtensionMapping extensionMapping;\n+    private ExtensionUiLoader extensionUiLoader;\n+\n+    public NarLoader(final File extensionsWorkingDir,\n+                     final File docsWorkingDir,\n+                     final NarClassLoaders narClassLoaders,\n+                     final ExtensionDiscoveringManager extensionManager,\n+                     final ExtensionMapping extensionMapping,\n+                     final ExtensionUiLoader extensionUiLoader) {\n+        this.extensionsWorkingDir = extensionsWorkingDir;\n+        this.docsWorkingDir = docsWorkingDir;\n+        this.narClassLoaders = narClassLoaders;\n+        this.extensionManager = extensionManager;\n+        this.extensionMapping = extensionMapping;\n+        this.extensionUiLoader = extensionUiLoader;\n+    }\n+\n+    public synchronized NarLoadResult load(final List<File> narFiles, final Set<BundleDetails> previouslySkippedBundles) {","path":"nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/main/java/org/apache/nifi/nar/NarLoader.java","position":67,"original_position":67,"commit_id":"01a7feb9bdd02ef3407a3b3acd5f05c0938e2e49","original_commit_id":"01a7feb9bdd02ef3407a3b3acd5f05c0938e2e49","user":{"login":"markap14","id":184268,"node_id":"MDQ6VXNlcjE4NDI2OA==","avatar_url":"https://avatars2.githubusercontent.com/u/184268?v=4","gravatar_id":"","url":"https://api.github.com/users/markap14","html_url":"https://github.com/markap14","followers_url":"https://api.github.com/users/markap14/followers","following_url":"https://api.github.com/users/markap14/following{/other_user}","gists_url":"https://api.github.com/users/markap14/gists{/gist_id}","starred_url":"https://api.github.com/users/markap14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markap14/subscriptions","organizations_url":"https://api.github.com/users/markap14/orgs","repos_url":"https://api.github.com/users/markap14/repos","events_url":"https://api.github.com/users/markap14/events{/privacy}","received_events_url":"https://api.github.com/users/markap14/received_events","type":"User","site_admin":false},"body":"The `Set<BundleDetails>`, I feel, is really internal state that should be maintained by this class, rather than having another Object responsible for maintaining the previously skipped bundles and then having it tell this component which ones it has already skipped.\r\nI would also recommend accepting a `Collection<File>` instead of `List<File>` because the ordering of the given Files does not matter, and `List` implies (or at least hints that) the order is relevant","created_at":"2018-11-01T17:00:10Z","updated_at":"2018-11-01T17:18:00Z","html_url":"https://github.com/apache/nifi/pull/3119#discussion_r230117182","pull_request_url":"https://api.github.com/repos/apache/nifi/pulls/3119","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/nifi/pulls/comments/230117182"},"html":{"href":"https://github.com/apache/nifi/pull/3119#discussion_r230117182"},"pull_request":{"href":"https://api.github.com/repos/apache/nifi/pulls/3119"}}},"pull_request":{"url":"https://api.github.com/repos/apache/nifi/pulls/3119","id":227429909,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3NDI5OTA5","html_url":"https://github.com/apache/nifi/pull/3119","diff_url":"https://github.com/apache/nifi/pull/3119.diff","patch_url":"https://github.com/apache/nifi/pull/3119.patch","issue_url":"https://api.github.com/repos/apache/nifi/issues/3119","number":3119,"state":"open","locked":false,"title":"NIFI-5673 Support auto loading of new NARs","user":{"login":"bbende","id":605416,"node_id":"MDQ6VXNlcjYwNTQxNg==","avatar_url":"https://avatars2.githubusercontent.com/u/605416?v=4","gravatar_id":"","url":"https://api.github.com/users/bbende","html_url":"https://github.com/bbende","followers_url":"https://api.github.com/users/bbende/followers","following_url":"https://api.github.com/users/bbende/following{/other_user}","gists_url":"https://api.github.com/users/bbende/gists{/gist_id}","starred_url":"https://api.github.com/users/bbende/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbende/subscriptions","organizations_url":"https://api.github.com/users/bbende/orgs","repos_url":"https://api.github.com/users/bbende/repos","events_url":"https://api.github.com/users/bbende/events{/privacy}","received_events_url":"https://api.github.com/users/bbende/received_events","type":"User","site_admin":false},"body":"This PR introduces a new property in nifi.properties where you can specify a directory that will be watched for new NARs (defaults ./extensions), and upon finding them will make any extensions in those NARs available to the running application without requiring a restart.\r\n\r\nIn addition, this PR includes a refactoring of the ExtensionManager to remove it's static use and make it an instance that is injected everywhere. This will help make the framework code more testable going forward.\r\n\r\nNOTE: Currently the UI retrieves the available types during initial load of the UI and never retrieves them again because they couldn't change, so this will have to be changed in a follow on PR.\r\n\r\nSome scenarios to consider when testing...\r\n\r\n- Dependencies across NARs - handled by keeping track of skipped NARs until the a new NAR is available matching the required dependency\r\n\r\n- NARs still being written - handled by only consider the NAR once the last modified time is at least 5 seconds old\r\n \r\n- Custom UIs - make sure the custom UI is available for a component that was auto-loaded\r\n","created_at":"2018-10-31T20:24:16Z","updated_at":"2018-11-01T17:18:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c5e88cca9952b26b22a8c4c9d07e7946b7a179ed","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/nifi/pulls/3119/commits","review_comments_url":"https://api.github.com/repos/apache/nifi/pulls/3119/comments","review_comment_url":"https://api.github.com/repos/apache/nifi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/nifi/issues/3119/comments","statuses_url":"https://api.github.com/repos/apache/nifi/statuses/01a7feb9bdd02ef3407a3b3acd5f05c0938e2e49","head":{"label":"bbende:NIFI-5673","ref":"NIFI-5673","sha":"01a7feb9bdd02ef3407a3b3acd5f05c0938e2e49","user":{"login":"bbende","id":605416,"node_id":"MDQ6VXNlcjYwNTQxNg==","avatar_url":"https://avatars2.githubusercontent.com/u/605416?v=4","gravatar_id":"","url":"https://api.github.com/users/bbende","html_url":"https://github.com/bbende","followers_url":"https://api.github.com/users/bbende/followers","following_url":"https://api.github.com/users/bbende/following{/other_user}","gists_url":"https://api.github.com/users/bbende/gists{/gist_id}","starred_url":"https://api.github.com/users/bbende/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbende/subscriptions","organizations_url":"https://api.github.com/users/bbende/orgs","repos_url":"https://api.github.com/users/bbende/repos","events_url":"https://api.github.com/users/bbende/events{/privacy}","received_events_url":"https://api.github.com/users/bbende/received_events","type":"User","site_admin":false},"repo":{"id":48186740,"node_id":"MDEwOlJlcG9zaXRvcnk0ODE4Njc0MA==","name":"nifi","full_name":"bbende/nifi","private":false,"owner":{"login":"bbende","id":605416,"node_id":"MDQ6VXNlcjYwNTQxNg==","avatar_url":"https://avatars2.githubusercontent.com/u/605416?v=4","gravatar_id":"","url":"https://api.github.com/users/bbende","html_url":"https://github.com/bbende","followers_url":"https://api.github.com/users/bbende/followers","following_url":"https://api.github.com/users/bbende/following{/other_user}","gists_url":"https://api.github.com/users/bbende/gists{/gist_id}","starred_url":"https://api.github.com/users/bbende/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbende/subscriptions","organizations_url":"https://api.github.com/users/bbende/orgs","repos_url":"https://api.github.com/users/bbende/repos","events_url":"https://api.github.com/users/bbende/events{/privacy}","received_events_url":"https://api.github.com/users/bbende/received_events","type":"User","site_admin":false},"html_url":"https://github.com/bbende/nifi","description":"Mirror of Apache NiFi","fork":true,"url":"https://api.github.com/repos/bbende/nifi","forks_url":"https://api.github.com/repos/bbende/nifi/forks","keys_url":"https://api.github.com/repos/bbende/nifi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbende/nifi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbende/nifi/teams","hooks_url":"https://api.github.com/repos/bbende/nifi/hooks","issue_events_url":"https://api.github.com/repos/bbende/nifi/issues/events{/number}","events_url":"https://api.github.com/repos/bbende/nifi/events","assignees_url":"https://api.github.com/repos/bbende/nifi/assignees{/user}","branches_url":"https://api.github.com/repos/bbende/nifi/branches{/branch}","tags_url":"https://api.github.com/repos/bbende/nifi/tags","blobs_url":"https://api.github.com/repos/bbende/nifi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbende/nifi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbende/nifi/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbende/nifi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbende/nifi/statuses/{sha}","languages_url":"https://api.github.com/repos/bbende/nifi/languages","stargazers_url":"https://api.github.com/repos/bbende/nifi/stargazers","contributors_url":"https://api.github.com/repos/bbende/nifi/contributors","subscribers_url":"https://api.github.com/repos/bbende/nifi/subscribers","subscription_url":"https://api.github.com/repos/bbende/nifi/subscription","commits_url":"https://api.github.com/repos/bbende/nifi/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbende/nifi/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbende/nifi/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbende/nifi/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbende/nifi/contents/{+path}","compare_url":"https://api.github.com/repos/bbende/nifi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbende/nifi/merges","archive_url":"https://api.github.com/repos/bbende/nifi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbende/nifi/downloads","issues_url":"https://api.github.com/repos/bbende/nifi/issues{/number}","pulls_url":"https://api.github.com/repos/bbende/nifi/pulls{/number}","milestones_url":"https://api.github.com/repos/bbende/nifi/milestones{/number}","notifications_url":"https://api.github.com/repos/bbende/nifi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbende/nifi/labels{/name}","releases_url":"https://api.github.com/repos/bbende/nifi/releases{/id}","deployments_url":"https://api.github.com/repos/bbende/nifi/deployments","created_at":"2015-12-17T16:52:44Z","updated_at":"2018-10-31T19:26:15Z","pushed_at":"2018-10-31T19:26:10Z","git_url":"git://github.com/bbende/nifi.git","ssh_url":"git@github.com:bbende/nifi.git","clone_url":"https://github.com/bbende/nifi.git","svn_url":"https://github.com/bbende/nifi","homepage":"","size":126430,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"4c10b47e602741adc52ad693a9bc56b9964cd7ef","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":27911088,"node_id":"MDEwOlJlcG9zaXRvcnkyNzkxMTA4OA==","name":"nifi","full_name":"apache/nifi","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apache/nifi","description":"Mirror of Apache NiFi","fork":false,"url":"https://api.github.com/repos/apache/nifi","forks_url":"https://api.github.com/repos/apache/nifi/forks","keys_url":"https://api.github.com/repos/apache/nifi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/nifi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/nifi/teams","hooks_url":"https://api.github.com/repos/apache/nifi/hooks","issue_events_url":"https://api.github.com/repos/apache/nifi/issues/events{/number}","events_url":"https://api.github.com/repos/apache/nifi/events","assignees_url":"https://api.github.com/repos/apache/nifi/assignees{/user}","branches_url":"https://api.github.com/repos/apache/nifi/branches{/branch}","tags_url":"https://api.github.com/repos/apache/nifi/tags","blobs_url":"https://api.github.com/repos/apache/nifi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/nifi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/nifi/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/nifi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/nifi/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/nifi/languages","stargazers_url":"https://api.github.com/repos/apache/nifi/stargazers","contributors_url":"https://api.github.com/repos/apache/nifi/contributors","subscribers_url":"https://api.github.com/repos/apache/nifi/subscribers","subscription_url":"https://api.github.com/repos/apache/nifi/subscription","commits_url":"https://api.github.com/repos/apache/nifi/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/nifi/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/nifi/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/nifi/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/nifi/contents/{+path}","compare_url":"https://api.github.com/repos/apache/nifi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/nifi/merges","archive_url":"https://api.github.com/repos/apache/nifi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/nifi/downloads","issues_url":"https://api.github.com/repos/apache/nifi/issues{/number}","pulls_url":"https://api.github.com/repos/apache/nifi/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/nifi/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/nifi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/nifi/labels{/name}","releases_url":"https://api.github.com/repos/apache/nifi/releases{/id}","deployments_url":"https://api.github.com/repos/apache/nifi/deployments","created_at":"2014-12-12T08:00:05Z","updated_at":"2018-11-01T15:30:45Z","pushed_at":"2018-11-01T15:30:19Z","git_url":"git://github.com/apache/nifi.git","ssh_url":"git@github.com:apache/nifi.git","clone_url":"https://github.com/apache/nifi.git","svn_url":"https://github.com/apache/nifi","homepage":"","size":127523,"stargazers_count":1149,"watchers_count":1149,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1060,"mirror_url":null,"archived":false,"open_issues_count":146,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1060,"open_issues":146,"watchers":1149,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/nifi/pulls/3119"},"html":{"href":"https://github.com/apache/nifi/pull/3119"},"issue":{"href":"https://api.github.com/repos/apache/nifi/issues/3119"},"comments":{"href":"https://api.github.com/repos/apache/nifi/issues/3119/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/nifi/pulls/3119/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/nifi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/nifi/pulls/3119/commits"},"statuses":{"href":"https://api.github.com/repos/apache/nifi/statuses/01a7feb9bdd02ef3407a3b3acd5f05c0938e2e49"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"markap14"}}