{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/comments/90230644","pull_request_review_id":10751895,"id":90230644,"diff_hunk":"@@ -0,0 +1,135 @@\n+/*\n+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.\n+ *\n+ * WSO2 Inc. licenses this file to you under the Apache License,\n+ * Version 2.0 (the \"License\"); you may not use this file except\n+ * in compliance with the License.\n+ * 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,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+\n+package org.wso2.carbon.uuf.maven.parser;\n+\n+import org.wso2.carbon.uuf.maven.exception.ParsingException;\n+import org.wso2.carbon.uuf.maven.model.DependencyNode;\n+\n+import java.io.IOException;\n+import java.nio.file.Files;\n+import java.nio.file.Paths;\n+import java.util.List;\n+\n+/**\n+ * Parser for dependency tree generated by executing goal {@code tree} of Maven Dependency plugin with {@code\n+ * outputType=text} and {@code verbose=true} parameters.({@code mvn dependency:tree -DoutputType=text -Dverbose=true})\n+ *\n+ * @since 1.0.0\n+ */\n+public class DependencyTreeParser {\n+\n+    /**\n+     * Parses the specified dependency tree file.\n+     *\n+     * @param dependencyTreeFilePath path to dependency tree file\n+     * @return root node of the dependency tree\n+     * @throws ParsingException if cannot read or parse the content of the dependency tree file\n+     */\n+    public DependencyNode parse(String dependencyTreeFilePath) throws ParsingException {\n+        List<String> lines;\n+        try {\n+            lines = Files.readAllLines(Paths.get(dependencyTreeFilePath));\n+        } catch (IOException e) {\n+            throw new ParsingException(\"Cannot read the content of dependency tree '\" + dependencyTreeFilePath + \"'.\",\n+                                       e);\n+        }\n+        return parse(lines);\n+    }\n+\n+    /**\n+     * Parses the specified dependency tree text.\n+     *\n+     * @param dependencyTreeLines lines of the dependency tree to parse\n+     * @return root node of the dependency tree\n+     * @throws ParsingException if an error occurred when parsing the dependency tree\n+     */\n+    DependencyNode parse(List<String> dependencyTreeLines) throws ParsingException {\n+        // First line is the root node.\n+        DependencyNode rootNode = createDependencyNode(dependencyTreeLines.get(0), null);\n+\n+        int previousLevel = 0;\n+        DependencyNode currentParentNode = rootNode; // parent node of the current line\n+        DependencyNode previousNode = rootNode; // node created in the previous iteration\n+        for (int i = 1; i < dependencyTreeLines.size(); i++) {\n+            String line = dependencyTreeLines.get(i);\n+            int level = countLevel(line);\n+            int jump = (level - previousLevel);\n+\n+            DependencyNode currentNode;\n+            if (jump < 0) {\n+                // Found a sibling, of the 'currentParentNode' or one of the 'currentParentNode's parent.\n+                currentParentNode = currentParentNode.getParent(jump * -1);\n+                currentNode = createDependencyNode(line, currentParentNode);\n+                currentParentNode.addDependency(currentNode);\n+            } else if (jump == 0) {\n+                // Found a sibling of the previously added node.\n+                currentNode = createDependencyNode(line, currentParentNode);\n+                currentParentNode.addDependency(currentNode);\n+            } else if (jump == 1) {\n+                // Found a dependency of the previously added node.\n+                currentParentNode = previousNode;\n+                currentNode = createDependencyNode(line, currentParentNode);\n+                currentParentNode.addDependency(currentNode);\n+            } else {","path":"plugin/src/main/java/org/wso2/carbon/uuf/maven/parser/DependencyTreeParser.java","position":89,"original_position":89,"commit_id":"26774b0185d3a8161d4a925a48a899478f42185a","original_commit_id":"26774b0185d3a8161d4a925a48a899478f42185a","user":{"login":"Niranjan-K","id":5525926,"avatar_url":"https://avatars.githubusercontent.com/u/5525926?v=3","gravatar_id":"","url":"https://api.github.com/users/Niranjan-K","html_url":"https://github.com/Niranjan-K","followers_url":"https://api.github.com/users/Niranjan-K/followers","following_url":"https://api.github.com/users/Niranjan-K/following{/other_user}","gists_url":"https://api.github.com/users/Niranjan-K/gists{/gist_id}","starred_url":"https://api.github.com/users/Niranjan-K/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Niranjan-K/subscriptions","organizations_url":"https://api.github.com/users/Niranjan-K/orgs","repos_url":"https://api.github.com/users/Niranjan-K/repos","events_url":"https://api.github.com/users/Niranjan-K/events{/privacy}","received_events_url":"https://api.github.com/users/Niranjan-K/received_events","type":"User","site_admin":false},"body":"It would be better to have debug logs here for each condition","created_at":"2016-11-30T13:25:29Z","updated_at":"2016-11-30T13:25:29Z","html_url":"https://github.com/wso2/carbon-uuf-maven-tools/pull/31#discussion_r90230644","pull_request_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/comments/90230644"},"html":{"href":"https://github.com/wso2/carbon-uuf-maven-tools/pull/31#discussion_r90230644"},"pull_request":{"href":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/31","id":95077934,"html_url":"https://github.com/wso2/carbon-uuf-maven-tools/pull/31","diff_url":"https://github.com/wso2/carbon-uuf-maven-tools/pull/31.diff","patch_url":"https://github.com/wso2/carbon-uuf-maven-tools/pull/31.patch","issue_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/issues/31","number":31,"state":"open","locked":false,"title":"Introducing 'dependency-tree.yaml' & 'component.yaml' files and combining all Component configs at the App build time","user":{"login":"this","id":11549922,"avatar_url":"https://avatars.githubusercontent.com/u/11549922?v=3","gravatar_id":"","url":"https://api.github.com/users/this","html_url":"https://github.com/this","followers_url":"https://api.github.com/users/this/followers","following_url":"https://api.github.com/users/this/following{/other_user}","gists_url":"https://api.github.com/users/this/gists{/gist_id}","starred_url":"https://api.github.com/users/this/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/this/subscriptions","organizations_url":"https://api.github.com/users/this/orgs","repos_url":"https://api.github.com/users/this/repos","events_url":"https://api.github.com/users/this/events{/privacy}","received_events_url":"https://api.github.com/users/this/received_events","type":"User","site_admin":false},"body":"- Introducing,\r\n  -  'dependency-tree.yaml' which replaces raw 'dependency.tree' file in an App (issue #30)\r\n  - 'component.yaml' which replaces 'bindings.yaml' in a Component\r\n- Combine all the 'config.yaml' files of dependency Components into a single 'config.yaml' file when building an App (issue #23)\r\n- Also fixes validation related issues #24, #25, #26, #27, #28, and #29\r\n- Also,\r\n  - Added missing javadocs.\r\n  - Removed Maven Assembly Plugin API usage and dependency.\r\n  - Added test cases for `DependencyTreeParser`.","created_at":"2016-11-23T20:54:53Z","updated_at":"2016-11-30T13:25:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6eac18736c563aeda7a7e6e2341ed201e7589a92","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/31/commits","review_comments_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/31/comments","review_comment_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/issues/31/comments","statuses_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/statuses/26774b0185d3a8161d4a925a48a899478f42185a","head":{"label":"this:master","ref":"master","sha":"26774b0185d3a8161d4a925a48a899478f42185a","user":{"login":"this","id":11549922,"avatar_url":"https://avatars.githubusercontent.com/u/11549922?v=3","gravatar_id":"","url":"https://api.github.com/users/this","html_url":"https://github.com/this","followers_url":"https://api.github.com/users/this/followers","following_url":"https://api.github.com/users/this/following{/other_user}","gists_url":"https://api.github.com/users/this/gists{/gist_id}","starred_url":"https://api.github.com/users/this/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/this/subscriptions","organizations_url":"https://api.github.com/users/this/orgs","repos_url":"https://api.github.com/users/this/repos","events_url":"https://api.github.com/users/this/events{/privacy}","received_events_url":"https://api.github.com/users/this/received_events","type":"User","site_admin":false},"repo":{"id":57386049,"name":"carbon-uuf-maven-tools","full_name":"this/carbon-uuf-maven-tools","owner":{"login":"this","id":11549922,"avatar_url":"https://avatars.githubusercontent.com/u/11549922?v=3","gravatar_id":"","url":"https://api.github.com/users/this","html_url":"https://github.com/this","followers_url":"https://api.github.com/users/this/followers","following_url":"https://api.github.com/users/this/following{/other_user}","gists_url":"https://api.github.com/users/this/gists{/gist_id}","starred_url":"https://api.github.com/users/this/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/this/subscriptions","organizations_url":"https://api.github.com/users/this/orgs","repos_url":"https://api.github.com/users/this/repos","events_url":"https://api.github.com/users/this/events{/privacy}","received_events_url":"https://api.github.com/users/this/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/this/carbon-uuf-maven-tools","description":null,"fork":true,"url":"https://api.github.com/repos/this/carbon-uuf-maven-tools","forks_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/forks","keys_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/teams","hooks_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/hooks","issue_events_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/issues/events{/number}","events_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/events","assignees_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/assignees{/user}","branches_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/branches{/branch}","tags_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/tags","blobs_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/languages","stargazers_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/stargazers","contributors_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/contributors","subscribers_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/subscribers","subscription_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/subscription","commits_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/contents/{+path}","compare_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/merges","archive_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/downloads","issues_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/issues{/number}","pulls_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/labels{/name}","releases_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/releases{/id}","deployments_url":"https://api.github.com/repos/this/carbon-uuf-maven-tools/deployments","created_at":"2016-04-29T13:27:16Z","updated_at":"2016-10-23T03:39:21Z","pushed_at":"2016-11-30T05:02:50Z","git_url":"git://github.com/this/carbon-uuf-maven-tools.git","ssh_url":"git@github.com:this/carbon-uuf-maven-tools.git","clone_url":"https://github.com/this/carbon-uuf-maven-tools.git","svn_url":"https://github.com/this/carbon-uuf-maven-tools","homepage":null,"size":3057,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"wso2:master","ref":"master","sha":"0ab06f2e9aca87233b1f7051679cd942459581b1","user":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"repo":{"id":57371842,"name":"carbon-uuf-maven-tools","full_name":"wso2/carbon-uuf-maven-tools","owner":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wso2/carbon-uuf-maven-tools","description":null,"fork":false,"url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools","forks_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/forks","keys_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/teams","hooks_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/hooks","issue_events_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/events","assignees_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/tags","blobs_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/languages","stargazers_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/stargazers","contributors_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/contributors","subscribers_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/subscribers","subscription_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/subscription","commits_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/merges","archive_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/downloads","issues_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/labels{/name}","releases_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/releases{/id}","deployments_url":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/deployments","created_at":"2016-04-29T09:07:30Z","updated_at":"2016-10-23T20:05:02Z","pushed_at":"2016-11-30T05:02:50Z","git_url":"git://github.com/wso2/carbon-uuf-maven-tools.git","ssh_url":"git@github.com:wso2/carbon-uuf-maven-tools.git","clone_url":"https://github.com/wso2/carbon-uuf-maven-tools.git","svn_url":"https://github.com/wso2/carbon-uuf-maven-tools","homepage":null,"size":2989,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":11,"forks":16,"open_issues":11,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/31"},"html":{"href":"https://github.com/wso2/carbon-uuf-maven-tools/pull/31"},"issue":{"href":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/issues/31"},"comments":{"href":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/carbon-uuf-maven-tools/statuses/26774b0185d3a8161d4a925a48a899478f42185a"}}}}
{"actor":{"display_login":"Niranjan-K"}}