{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/comments/103889801","pull_request_review_id":24693242,"id":103889801,"diff_hunk":"@@ -0,0 +1,159 @@\n+/*\n+ *  Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.\n+ *\n+ *  Licensed under the Apache License, Version 2.0 (the \"License\");\n+ *  you may not use this file except 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, 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+\n+package org.wso2.maven.p2.utils;\n+\n+import org.apache.maven.artifact.Artifact;\n+import org.apache.maven.plugin.MojoExecutionException;\n+import org.apache.maven.project.MavenProject;\n+import org.wso2.maven.p2.beans.carbon.product.Configurations;\n+import org.wso2.maven.p2.beans.carbon.product.Feature;\n+import org.wso2.maven.p2.beans.carbon.product.Features;\n+import org.wso2.maven.p2.beans.carbon.product.Product;\n+import org.wso2.maven.p2.beans.carbon.product.config.ProductConfig;\n+import org.wso2.maven.p2.beans.carbon.product.config.ProductFileConfig;\n+\n+import java.io.File;\n+import java.util.ArrayList;\n+import java.util.List;\n+import javax.xml.bind.JAXBContext;\n+import javax.xml.bind.JAXBException;\n+import javax.xml.bind.Marshaller;\n+\n+/**\n+ * Utility class for helper functions in generating and reading a product file at build-time.\n+ *\n+ * This class is to be used by publish-product and\n+ * generate-runtime maven goals.\n+ *\n+ * @since 3.1.0\n+ */\n+public class ProductFileUtils {\n+\n+    /**\n+     * Write Product bean as an XML to a product file.\n+     *\n+     * @param productFileConfig productFileConfig bean as read from project pom.\n+     * @param mavenProject mavenProject bean as read from project pom.\n+     * @throws javax.xml.bind.JAXBException Is thrown if an error occurs in writing configurations into product file.\n+     */\n+    public static void writeToFile(ProductFileConfig productFileConfig,\n+                                   MavenProject mavenProject) throws JAXBException, MojoExecutionException {\n+        // validating version and featureConfig values captured from project pom\n+        ProductConfig validatedProductConfig = ProductFileUtils.\n+                validateProductConfigForVersionAndFeatureConfig(productFileConfig.getProductConfig(), mavenProject);\n+\n+        // populating a product instance with validated values for writing to a product file\n+        Product product = new Product();\n+\n+        product.setName(validatedProductConfig.getName());\n+        product.setUid(validatedProductConfig.getUid());\n+        product.setId(validatedProductConfig.getId());\n+        product.setApplication(validatedProductConfig.getApplication());\n+        product.setVersion(validatedProductConfig.getVersion());\n+        product.setUseFeatures(validatedProductConfig.getUseFeatures());\n+        product.setIncludeLaunchers(validatedProductConfig.getIncludeLaunchers());\n+        product.setVersion(validatedProductConfig.getVersion());\n+        product.setConfigIni(validatedProductConfig.getConfigIni());\n+        product.setLauncherArgs(validatedProductConfig.getLauncherArgs());\n+        product.setLauncher(validatedProductConfig.getLauncher());\n+        product.setPlugins(validatedProductConfig.getPlugins());\n+\n+        Features features = new Features(validatedProductConfig.getFeatureConfig());\n+        Configurations configurations = new Configurations(validatedProductConfig.getPluginConfig(),\n+                validatedProductConfig.getPropertyConfig());\n+\n+        product.setFeatures(features);\n+        product.setConfigurations(configurations);\n+\n+        // writing to a product file\n+        JAXBContext jaxbContext = JAXBContext.newInstance(Product.class);\n+        Marshaller jaxbMarshaller = jaxbContext.createMarshaller();\n+\n+        jaxbMarshaller.setProperty(\"com.sun.xml.internal.bind.xmlHeaders\",","path":"carbon-feature-plugin/src/main/java/org/wso2/maven/p2/utils/ProductFileUtils.java","position":null,"original_position":86,"commit_id":"8be4f48bc1afacdcba5c889fc630c7e7140939a0","original_commit_id":"3780da8be795df21b3a930ce85613ec8ed6899e8","user":{"login":"DilanUA","id":8347682,"avatar_url":"https://avatars0.githubusercontent.com/u/8347682?v=3","gravatar_id":"","url":"https://api.github.com/users/DilanUA","html_url":"https://github.com/DilanUA","followers_url":"https://api.github.com/users/DilanUA/followers","following_url":"https://api.github.com/users/DilanUA/following{/other_user}","gists_url":"https://api.github.com/users/DilanUA/gists{/gist_id}","starred_url":"https://api.github.com/users/DilanUA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DilanUA/subscriptions","organizations_url":"https://api.github.com/users/DilanUA/orgs","repos_url":"https://api.github.com/users/DilanUA/repos","events_url":"https://api.github.com/users/DilanUA/events{/privacy}","received_events_url":"https://api.github.com/users/DilanUA/received_events","type":"User","site_admin":false},"body":"Fixed by commit 8be4f48bc1afacdcba5c889fc630c7e7140939a0","created_at":"2017-03-02T10:10:33Z","updated_at":"2017-03-02T10:10:33Z","html_url":"https://github.com/wso2/carbon-maven-plugins/pull/60#discussion_r103889801","pull_request_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/60","_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/comments/103889801"},"html":{"href":"https://github.com/wso2/carbon-maven-plugins/pull/60#discussion_r103889801"},"pull_request":{"href":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/60"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/60","id":107342326,"html_url":"https://github.com/wso2/carbon-maven-plugins/pull/60","diff_url":"https://github.com/wso2/carbon-maven-plugins/pull/60.diff","patch_url":"https://github.com/wso2/carbon-maven-plugins/pull/60.patch","issue_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/issues/60","number":60,"state":"open","locked":false,"title":"Dynamic Product file support","user":{"login":"DilanUA","id":8347682,"avatar_url":"https://avatars0.githubusercontent.com/u/8347682?v=3","gravatar_id":"","url":"https://api.github.com/users/DilanUA","html_url":"https://github.com/DilanUA","followers_url":"https://api.github.com/users/DilanUA/followers","following_url":"https://api.github.com/users/DilanUA/following{/other_user}","gists_url":"https://api.github.com/users/DilanUA/gists{/gist_id}","starred_url":"https://api.github.com/users/DilanUA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DilanUA/subscriptions","organizations_url":"https://api.github.com/users/DilanUA/orgs","repos_url":"https://api.github.com/users/DilanUA/repos","events_url":"https://api.github.com/users/DilanUA/events{/privacy}","received_events_url":"https://api.github.com/users/DilanUA/received_events","type":"User","site_admin":false},"body":"This feature resolves #56 and adds an improvement to carbon-feature-plugin in supporting\r\na dynamically generated product file for the reference of publish-product and generate-runtime maven goals. A dynamically generated product file during build-time overcomes the issue of having to manually update a statically maintained product file with version-bumps for a release-build, thus contributing to a fully-automated release process.","created_at":"2017-02-22T06:18:29Z","updated_at":"2017-03-02T10:10:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0c2563f8b397ac5c196e1b983c700f7290883a3b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/60/commits","review_comments_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/60/comments","review_comment_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/issues/60/comments","statuses_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/statuses/8be4f48bc1afacdcba5c889fc630c7e7140939a0","head":{"label":"DilanUA:master","ref":"master","sha":"8be4f48bc1afacdcba5c889fc630c7e7140939a0","user":{"login":"DilanUA","id":8347682,"avatar_url":"https://avatars0.githubusercontent.com/u/8347682?v=3","gravatar_id":"","url":"https://api.github.com/users/DilanUA","html_url":"https://github.com/DilanUA","followers_url":"https://api.github.com/users/DilanUA/followers","following_url":"https://api.github.com/users/DilanUA/following{/other_user}","gists_url":"https://api.github.com/users/DilanUA/gists{/gist_id}","starred_url":"https://api.github.com/users/DilanUA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DilanUA/subscriptions","organizations_url":"https://api.github.com/users/DilanUA/orgs","repos_url":"https://api.github.com/users/DilanUA/repos","events_url":"https://api.github.com/users/DilanUA/events{/privacy}","received_events_url":"https://api.github.com/users/DilanUA/received_events","type":"User","site_admin":false},"repo":{"id":81906695,"name":"carbon-maven-plugins","full_name":"DilanUA/carbon-maven-plugins","owner":{"login":"DilanUA","id":8347682,"avatar_url":"https://avatars0.githubusercontent.com/u/8347682?v=3","gravatar_id":"","url":"https://api.github.com/users/DilanUA","html_url":"https://github.com/DilanUA","followers_url":"https://api.github.com/users/DilanUA/followers","following_url":"https://api.github.com/users/DilanUA/following{/other_user}","gists_url":"https://api.github.com/users/DilanUA/gists{/gist_id}","starred_url":"https://api.github.com/users/DilanUA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DilanUA/subscriptions","organizations_url":"https://api.github.com/users/DilanUA/orgs","repos_url":"https://api.github.com/users/DilanUA/repos","events_url":"https://api.github.com/users/DilanUA/events{/privacy}","received_events_url":"https://api.github.com/users/DilanUA/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DilanUA/carbon-maven-plugins","description":null,"fork":true,"url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins","forks_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/forks","keys_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/teams","hooks_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/hooks","issue_events_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/issues/events{/number}","events_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/events","assignees_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/assignees{/user}","branches_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/branches{/branch}","tags_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/tags","blobs_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/languages","stargazers_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/stargazers","contributors_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/contributors","subscribers_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/subscribers","subscription_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/subscription","commits_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/contents/{+path}","compare_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/merges","archive_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/downloads","issues_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/issues{/number}","pulls_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/labels{/name}","releases_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/releases{/id}","deployments_url":"https://api.github.com/repos/DilanUA/carbon-maven-plugins/deployments","created_at":"2017-02-14T04:58:10Z","updated_at":"2017-02-14T04:58:12Z","pushed_at":"2017-03-02T10:08:57Z","git_url":"git://github.com/DilanUA/carbon-maven-plugins.git","ssh_url":"git@github.com:DilanUA/carbon-maven-plugins.git","clone_url":"https://github.com/DilanUA/carbon-maven-plugins.git","svn_url":"https://github.com/DilanUA/carbon-maven-plugins","homepage":null,"size":825,"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":"c06f193f2dc128c870d629aead074f16354fa036","user":{"login":"wso2","id":533043,"avatar_url":"https://avatars0.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":44228907,"name":"carbon-maven-plugins","full_name":"wso2/carbon-maven-plugins","owner":{"login":"wso2","id":533043,"avatar_url":"https://avatars0.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-maven-plugins","description":null,"fork":false,"url":"https://api.github.com/repos/wso2/carbon-maven-plugins","forks_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/forks","keys_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/teams","hooks_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/hooks","issue_events_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/events","assignees_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/tags","blobs_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/languages","stargazers_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/stargazers","contributors_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/contributors","subscribers_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/subscribers","subscription_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/subscription","commits_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/merges","archive_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/downloads","issues_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/labels{/name}","releases_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/releases{/id}","deployments_url":"https://api.github.com/repos/wso2/carbon-maven-plugins/deployments","created_at":"2015-10-14T06:39:10Z","updated_at":"2016-11-22T11:11:56Z","pushed_at":"2017-03-02T10:08:58Z","git_url":"git://github.com/wso2/carbon-maven-plugins.git","ssh_url":"git@github.com:wso2/carbon-maven-plugins.git","clone_url":"https://github.com/wso2/carbon-maven-plugins.git","svn_url":"https://github.com/wso2/carbon-maven-plugins","homepage":null,"size":810,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":9,"forks":14,"open_issues":9,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/60"},"html":{"href":"https://github.com/wso2/carbon-maven-plugins/pull/60"},"issue":{"href":"https://api.github.com/repos/wso2/carbon-maven-plugins/issues/60"},"comments":{"href":"https://api.github.com/repos/wso2/carbon-maven-plugins/issues/60/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/60/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/carbon-maven-plugins/pulls/60/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/carbon-maven-plugins/statuses/8be4f48bc1afacdcba5c889fc630c7e7140939a0"}}}}
{"actor":{"display_login":"DilanUA"}}