{"action":"created","comment":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/comments/55576249","id":55576249,"diff_hunk":"@@ -781,4 +799,34 @@ private void writeSystemMetadata(Id.Artifact artifactId, ArtifactInfo artifactIn\n     ArtifactSystemMetadataWriter writer = new ArtifactSystemMetadataWriter(metadataStore, artifactId, artifactInfo);\n     writer.write();\n   }\n+\n+  public String callPluginMethod(Id.Namespace namespace, ArtifactDetail artifactDetail, String pluginType,\n+                                 String pluginName, ArtifactDescriptor parentArtifactDescriptor,\n+                                 String methodName, String requestBody)\n+    throws NotFoundException, IOException, InvalidArtifactException {\n+\n+    try (CloseableClassLoader parentClassLoader =\n+           artifactClassLoaderFactory.createClassLoader(parentArtifactDescriptor.getLocation())) {\n+      Id.Artifact artifactId = Id.Artifact.from(namespace, artifactDetail.getDescriptor().getArtifactId());\n+      File stageDir = DirUtils.createTempDir(baseUnpackDir);\n+      try (PluginInstantiator pluginInstantiator = new PluginInstantiator(cConf, parentClassLoader, stageDir)) {\n+        // we pass the parent artifact to endpoint plugin context, as the endpoint can try to load a plugin\n+        // and we provide app as the parent for plugins.\n+        // using parent artifact will help in finding the plugins from endpoint method.\n+        DefaultEndpointPluginContext defaultEndpointPluginContext =\n+          new DefaultEndpointPluginContext(namespace, this, pluginInstantiator,\n+                                           Id.Artifact.from(namespace, parentArtifactDescriptor.getArtifactId()));\n+\n+        pluginInstantiator.addArtifact(artifactDetail.getDescriptor().getLocation(), artifactId.toArtifactId());\n+        File artifactFile = new File(artifactDetail.getDescriptor().getLocation().toURI());","path":"cdap-app-fabric/src/main/java/co/cask/cdap/internal/app/runtime/artifact/ArtifactRepository.java","position":114,"original_position":114,"commit_id":"a9d05f12d2f405b607625983148233674c7d3265","original_commit_id":"a9d05f12d2f405b607625983148233674c7d3265","user":{"login":"chtyim","id":885032,"avatar_url":"https://avatars.githubusercontent.com/u/885032?v=3","gravatar_id":"","url":"https://api.github.com/users/chtyim","html_url":"https://github.com/chtyim","followers_url":"https://api.github.com/users/chtyim/followers","following_url":"https://api.github.com/users/chtyim/following{/other_user}","gists_url":"https://api.github.com/users/chtyim/gists{/gist_id}","starred_url":"https://api.github.com/users/chtyim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chtyim/subscriptions","organizations_url":"https://api.github.com/users/chtyim/orgs","repos_url":"https://api.github.com/users/chtyim/repos","events_url":"https://api.github.com/users/chtyim/events{/privacy}","received_events_url":"https://api.github.com/users/chtyim/received_events","type":"User","site_admin":false},"body":"Is it always local? Isn't that artifacts are stored in HDFS in distributed mode?","created_at":"2016-03-09T19:40:30Z","updated_at":"2016-03-09T19:40:30Z","html_url":"https://github.com/caskdata/cdap/pull/5264#discussion_r55576249","pull_request_url":"https://api.github.com/repos/caskdata/cdap/pulls/5264","_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments/55576249"},"html":{"href":"https://github.com/caskdata/cdap/pull/5264#discussion_r55576249"},"pull_request":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/5264"}}},"pull_request":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/5264","id":62282744,"html_url":"https://github.com/caskdata/cdap/pull/5264","diff_url":"https://github.com/caskdata/cdap/pull/5264.diff","patch_url":"https://github.com/caskdata/cdap/pull/5264.patch","issue_url":"https://api.github.com/repos/caskdata/cdap/issues/5264","number":5264,"state":"open","locked":false,"title":"CDAP-5152 Invoke Plugin endpoint method from Artifact handler","user":{"login":"gsps1","id":1328150,"avatar_url":"https://avatars.githubusercontent.com/u/1328150?v=3","gravatar_id":"","url":"https://api.github.com/users/gsps1","html_url":"https://github.com/gsps1","followers_url":"https://api.github.com/users/gsps1/followers","following_url":"https://api.github.com/users/gsps1/following{/other_user}","gists_url":"https://api.github.com/users/gsps1/gists{/gist_id}","starred_url":"https://api.github.com/users/gsps1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsps1/subscriptions","organizations_url":"https://api.github.com/users/gsps1/orgs","repos_url":"https://api.github.com/users/gsps1/repos","events_url":"https://api.github.com/users/gsps1/events{/privacy}","received_events_url":"https://api.github.com/users/gsps1/received_events","type":"User","site_admin":false},"body":"Implementation of app-fabric endpoint to hit plugin endpoint methods. \r\n\r\nNext steps:\r\n1) Propagating the available endpoint methods from the plugin through plugin class.\r\n2) Implementation of plugin methods listTables and getSchema for DBSource in Hydrator plugins repo.\r\n\r\nJIRA : https://issues.cask.co/browse/CDAP-5152\r\nBuild : http://builds.cask.co/browse/CDAP-DUT3648-2","created_at":"2016-03-09T19:33:23Z","updated_at":"2016-03-09T19:40:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f3b3811c940a1870b599260f5caab53002f7b12d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/caskdata/cdap/pulls/5264/commits","review_comments_url":"https://api.github.com/repos/caskdata/cdap/pulls/5264/comments","review_comment_url":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/caskdata/cdap/issues/5264/comments","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/a9d05f12d2f405b607625983148233674c7d3265","head":{"label":"caskdata:feature/artifact-inspection-plugin-instantiate","ref":"feature/artifact-inspection-plugin-instantiate","sha":"a9d05f12d2f405b607625983148233674c7d3265","user":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments{/number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","deployments_url":"https://api.github.com/repos/caskdata/cdap/deployments","created_at":"2014-08-02T09:00:10Z","updated_at":"2016-03-07T20:33:21Z","pushed_at":"2016-03-09T19:39:46Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://cdap.io","size":534099,"stargazers_count":105,"watchers_count":105,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":35,"mirror_url":null,"open_issues_count":16,"forks":35,"open_issues":16,"watchers":105,"default_branch":"develop"}},"base":{"label":"caskdata:develop","ref":"develop","sha":"d4249c68c3c2eca49a0cb264dc1a8ffd6bfbe8ca","user":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments{/number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","deployments_url":"https://api.github.com/repos/caskdata/cdap/deployments","created_at":"2014-08-02T09:00:10Z","updated_at":"2016-03-07T20:33:21Z","pushed_at":"2016-03-09T19:39:46Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://cdap.io","size":534099,"stargazers_count":105,"watchers_count":105,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":35,"mirror_url":null,"open_issues_count":16,"forks":35,"open_issues":16,"watchers":105,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/5264"},"html":{"href":"https://github.com/caskdata/cdap/pull/5264"},"issue":{"href":"https://api.github.com/repos/caskdata/cdap/issues/5264"},"comments":{"href":"https://api.github.com/repos/caskdata/cdap/issues/5264/comments"},"review_comments":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/5264/comments"},"review_comment":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/5264/commits"},"statuses":{"href":"https://api.github.com/repos/caskdata/cdap/statuses/a9d05f12d2f405b607625983148233674c7d3265"}}}}