{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/carbon-analytics/pulls/comments/191793206","pull_request_review_id":124435953,"id":191793206,"diff_hunk":"@@ -0,0 +1,176 @@\n+/*\n+ * Copyright (c) 2018, 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.data.provider.websocket.endpoint;\n+\n+\n+import com.google.gson.Gson;\n+import com.google.gson.JsonElement;\n+import org.osgi.service.component.annotations.Component;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import org.w3c.dom.Document;\n+import org.w3c.dom.Element;\n+import org.w3c.dom.Node;\n+import org.w3c.dom.NodeList;\n+import org.wso2.carbon.data.provider.endpoint.DataProviderEndPoint;\n+import org.wso2.carbon.data.provider.websocket.bean.WebSocketChannel;\n+import org.wso2.msf4j.websocket.WebSocketEndpoint;\n+import org.xml.sax.InputSource;\n+import org.xml.sax.SAXException;\n+\n+import javax.websocket.*;\n+import javax.websocket.server.PathParam;\n+import javax.websocket.server.ServerEndpoint;\n+import javax.xml.parsers.DocumentBuilder;\n+import javax.xml.parsers.DocumentBuilderFactory;\n+import javax.xml.parsers.ParserConfigurationException;\n+import javax.xml.xpath.*;","path":"components/org.wso2.carbon.data.provider/src/main/java/org/wso2/carbon/data/provider/websocket/endpoint/WebSocketProviderEndPoint.java","position":43,"original_position":43,"commit_id":"f22ecdb0061fd6dabd517a31f8f47a5251207e37","original_commit_id":"f22ecdb0061fd6dabd517a31f8f47a5251207e37","user":{"login":"pcnfernando","id":15815199,"avatar_url":"https://avatars3.githubusercontent.com/u/15815199?v=4","gravatar_id":"","url":"https://api.github.com/users/pcnfernando","html_url":"https://github.com/pcnfernando","followers_url":"https://api.github.com/users/pcnfernando/followers","following_url":"https://api.github.com/users/pcnfernando/following{/other_user}","gists_url":"https://api.github.com/users/pcnfernando/gists{/gist_id}","starred_url":"https://api.github.com/users/pcnfernando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcnfernando/subscriptions","organizations_url":"https://api.github.com/users/pcnfernando/orgs","repos_url":"https://api.github.com/users/pcnfernando/repos","events_url":"https://api.github.com/users/pcnfernando/events{/privacy}","received_events_url":"https://api.github.com/users/pcnfernando/received_events","type":"User","site_admin":false},"body":"Avoid wild card imports","created_at":"2018-05-30T14:37:07Z","updated_at":"2018-05-30T14:37:07Z","html_url":"https://github.com/wso2/carbon-analytics/pull/1264#discussion_r191793206","pull_request_url":"https://api.github.com/repos/wso2/carbon-analytics/pulls/1264","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-analytics/pulls/comments/191793206"},"html":{"href":"https://github.com/wso2/carbon-analytics/pull/1264#discussion_r191793206"},"pull_request":{"href":"https://api.github.com/repos/wso2/carbon-analytics/pulls/1264"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/carbon-analytics/pulls/1264","id":191466295,"html_url":"https://github.com/wso2/carbon-analytics/pull/1264","diff_url":"https://github.com/wso2/carbon-analytics/pull/1264.diff","patch_url":"https://github.com/wso2/carbon-analytics/pull/1264.patch","issue_url":"https://api.github.com/repos/wso2/carbon-analytics/issues/1264","number":1264,"state":"open","locked":false,"title":"Add WebSocket Provider","user":{"login":"CharukaK","id":18122888,"avatar_url":"https://avatars0.githubusercontent.com/u/18122888?v=4","gravatar_id":"","url":"https://api.github.com/users/CharukaK","html_url":"https://github.com/CharukaK","followers_url":"https://api.github.com/users/CharukaK/followers","following_url":"https://api.github.com/users/CharukaK/following{/other_user}","gists_url":"https://api.github.com/users/CharukaK/gists{/gist_id}","starred_url":"https://api.github.com/users/CharukaK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CharukaK/subscriptions","organizations_url":"https://api.github.com/users/CharukaK/orgs","repos_url":"https://api.github.com/users/CharukaK/repos","events_url":"https://api.github.com/users/CharukaK/events{/privacy}","received_events_url":"https://api.github.com/users/CharukaK/received_events","type":"User","site_admin":false},"body":"## Purpose\r\nIntroduce a web socket provider to provide data for the dashboards etc.\r\n\r\n## Goals\r\nIntroduce a data provider that utilizes web siddhi-io-websocket sink to provide data to the clients.\r\n\r\n## Approach\r\n- Create a web-socket server endpoint that accepts a topic as a path parameter siddhi websocket sinks(or any other websocket sink) can connect to.\r\n- Register clients that request websocket data provider in that end point under the topics given in their data provider configuration.\r\n- When a web socket sink publish a message to the endpoint with the topic parameter if there are clients registered to that topic those messages will be published to the clients via the data provider.\r\n\r\n## Documentation\r\nThis Provider will create the following end points to web socket sinks to connect and publish to.\r\n```\r\n    wss://host:port/websocket-provider/{topic}\r\n```\r\nIn order to initialize the Data provider and connect to the end point following json should be provided to the data-provider endpoint\r\n```javascript\r\n        {\r\n            configs: {\r\n                type: 'WebSocketProvider', // type of the data provider to initialize\r\n                config: {\r\n                    subscriberTopic: 'sampleStream', // topic the client subscribing to\r\n                    mapType: 'json' // mapping used in the web socket sink\r\n                }\r\n            }\r\n        }\r\n```\r\nProvider supports mappings of `text`, `json` and `xml`.\r\n\r\n## Security checks\r\n - Followed secure coding standards in http://wso2.com/technical-reports/wso2-secure-engineering-guidelines? yes\r\n - Ran FindSecurityBugs plugin and verified report? yes\r\n - Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? yes\r\n\r\n## Test environment\r\nJDK v1.8.0_171","created_at":"2018-05-30T14:08:44Z","updated_at":"2018-05-30T14:37:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3a7e73ec7cea349da1a4aff22cb55ee398a275f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/wso2/carbon-analytics/pulls/1264/commits","review_comments_url":"https://api.github.com/repos/wso2/carbon-analytics/pulls/1264/comments","review_comment_url":"https://api.github.com/repos/wso2/carbon-analytics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/carbon-analytics/issues/1264/comments","statuses_url":"https://api.github.com/repos/wso2/carbon-analytics/statuses/f22ecdb0061fd6dabd517a31f8f47a5251207e37","head":{"label":"CharukaK:master","ref":"master","sha":"f22ecdb0061fd6dabd517a31f8f47a5251207e37","user":{"login":"CharukaK","id":18122888,"avatar_url":"https://avatars0.githubusercontent.com/u/18122888?v=4","gravatar_id":"","url":"https://api.github.com/users/CharukaK","html_url":"https://github.com/CharukaK","followers_url":"https://api.github.com/users/CharukaK/followers","following_url":"https://api.github.com/users/CharukaK/following{/other_user}","gists_url":"https://api.github.com/users/CharukaK/gists{/gist_id}","starred_url":"https://api.github.com/users/CharukaK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CharukaK/subscriptions","organizations_url":"https://api.github.com/users/CharukaK/orgs","repos_url":"https://api.github.com/users/CharukaK/repos","events_url":"https://api.github.com/users/CharukaK/events{/privacy}","received_events_url":"https://api.github.com/users/CharukaK/received_events","type":"User","site_admin":false},"repo":{"id":133769019,"name":"carbon-analytics","full_name":"CharukaK/carbon-analytics","owner":{"login":"CharukaK","id":18122888,"avatar_url":"https://avatars0.githubusercontent.com/u/18122888?v=4","gravatar_id":"","url":"https://api.github.com/users/CharukaK","html_url":"https://github.com/CharukaK","followers_url":"https://api.github.com/users/CharukaK/followers","following_url":"https://api.github.com/users/CharukaK/following{/other_user}","gists_url":"https://api.github.com/users/CharukaK/gists{/gist_id}","starred_url":"https://api.github.com/users/CharukaK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CharukaK/subscriptions","organizations_url":"https://api.github.com/users/CharukaK/orgs","repos_url":"https://api.github.com/users/CharukaK/repos","events_url":"https://api.github.com/users/CharukaK/events{/privacy}","received_events_url":"https://api.github.com/users/CharukaK/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CharukaK/carbon-analytics","description":null,"fork":true,"url":"https://api.github.com/repos/CharukaK/carbon-analytics","forks_url":"https://api.github.com/repos/CharukaK/carbon-analytics/forks","keys_url":"https://api.github.com/repos/CharukaK/carbon-analytics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CharukaK/carbon-analytics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CharukaK/carbon-analytics/teams","hooks_url":"https://api.github.com/repos/CharukaK/carbon-analytics/hooks","issue_events_url":"https://api.github.com/repos/CharukaK/carbon-analytics/issues/events{/number}","events_url":"https://api.github.com/repos/CharukaK/carbon-analytics/events","assignees_url":"https://api.github.com/repos/CharukaK/carbon-analytics/assignees{/user}","branches_url":"https://api.github.com/repos/CharukaK/carbon-analytics/branches{/branch}","tags_url":"https://api.github.com/repos/CharukaK/carbon-analytics/tags","blobs_url":"https://api.github.com/repos/CharukaK/carbon-analytics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CharukaK/carbon-analytics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CharukaK/carbon-analytics/git/refs{/sha}","trees_url":"https://api.github.com/repos/CharukaK/carbon-analytics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CharukaK/carbon-analytics/statuses/{sha}","languages_url":"https://api.github.com/repos/CharukaK/carbon-analytics/languages","stargazers_url":"https://api.github.com/repos/CharukaK/carbon-analytics/stargazers","contributors_url":"https://api.github.com/repos/CharukaK/carbon-analytics/contributors","subscribers_url":"https://api.github.com/repos/CharukaK/carbon-analytics/subscribers","subscription_url":"https://api.github.com/repos/CharukaK/carbon-analytics/subscription","commits_url":"https://api.github.com/repos/CharukaK/carbon-analytics/commits{/sha}","git_commits_url":"https://api.github.com/repos/CharukaK/carbon-analytics/git/commits{/sha}","comments_url":"https://api.github.com/repos/CharukaK/carbon-analytics/comments{/number}","issue_comment_url":"https://api.github.com/repos/CharukaK/carbon-analytics/issues/comments{/number}","contents_url":"https://api.github.com/repos/CharukaK/carbon-analytics/contents/{+path}","compare_url":"https://api.github.com/repos/CharukaK/carbon-analytics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CharukaK/carbon-analytics/merges","archive_url":"https://api.github.com/repos/CharukaK/carbon-analytics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CharukaK/carbon-analytics/downloads","issues_url":"https://api.github.com/repos/CharukaK/carbon-analytics/issues{/number}","pulls_url":"https://api.github.com/repos/CharukaK/carbon-analytics/pulls{/number}","milestones_url":"https://api.github.com/repos/CharukaK/carbon-analytics/milestones{/number}","notifications_url":"https://api.github.com/repos/CharukaK/carbon-analytics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CharukaK/carbon-analytics/labels{/name}","releases_url":"https://api.github.com/repos/CharukaK/carbon-analytics/releases{/id}","deployments_url":"https://api.github.com/repos/CharukaK/carbon-analytics/deployments","created_at":"2018-05-17T06:29:16Z","updated_at":"2018-05-30T12:17:32Z","pushed_at":"2018-05-30T12:17:24Z","git_url":"git://github.com/CharukaK/carbon-analytics.git","ssh_url":"git@github.com:CharukaK/carbon-analytics.git","clone_url":"https://github.com/CharukaK/carbon-analytics.git","svn_url":"https://github.com/CharukaK/carbon-analytics","homepage":null,"size":92245,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"wso2:master","ref":"master","sha":"ffcb70128ba9f42fbdd48baf8ab13f0252e760e0","user":{"login":"wso2","id":533043,"avatar_url":"https://avatars3.githubusercontent.com/u/533043?v=4","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":16543113,"name":"carbon-analytics","full_name":"wso2/carbon-analytics","owner":{"login":"wso2","id":533043,"avatar_url":"https://avatars3.githubusercontent.com/u/533043?v=4","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-analytics","description":null,"fork":false,"url":"https://api.github.com/repos/wso2/carbon-analytics","forks_url":"https://api.github.com/repos/wso2/carbon-analytics/forks","keys_url":"https://api.github.com/repos/wso2/carbon-analytics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/carbon-analytics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/carbon-analytics/teams","hooks_url":"https://api.github.com/repos/wso2/carbon-analytics/hooks","issue_events_url":"https://api.github.com/repos/wso2/carbon-analytics/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/carbon-analytics/events","assignees_url":"https://api.github.com/repos/wso2/carbon-analytics/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/carbon-analytics/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/carbon-analytics/tags","blobs_url":"https://api.github.com/repos/wso2/carbon-analytics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/carbon-analytics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/carbon-analytics/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/carbon-analytics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/carbon-analytics/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/carbon-analytics/languages","stargazers_url":"https://api.github.com/repos/wso2/carbon-analytics/stargazers","contributors_url":"https://api.github.com/repos/wso2/carbon-analytics/contributors","subscribers_url":"https://api.github.com/repos/wso2/carbon-analytics/subscribers","subscription_url":"https://api.github.com/repos/wso2/carbon-analytics/subscription","commits_url":"https://api.github.com/repos/wso2/carbon-analytics/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/carbon-analytics/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/carbon-analytics/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/carbon-analytics/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/carbon-analytics/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/carbon-analytics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/carbon-analytics/merges","archive_url":"https://api.github.com/repos/wso2/carbon-analytics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/carbon-analytics/downloads","issues_url":"https://api.github.com/repos/wso2/carbon-analytics/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/carbon-analytics/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/carbon-analytics/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/carbon-analytics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/carbon-analytics/labels{/name}","releases_url":"https://api.github.com/repos/wso2/carbon-analytics/releases{/id}","deployments_url":"https://api.github.com/repos/wso2/carbon-analytics/deployments","created_at":"2014-02-05T11:40:58Z","updated_at":"2018-05-25T11:17:09Z","pushed_at":"2018-05-30T14:23:38Z","git_url":"git://github.com/wso2/carbon-analytics.git","ssh_url":"git@github.com:wso2/carbon-analytics.git","clone_url":"https://github.com/wso2/carbon-analytics.git","svn_url":"https://github.com/wso2/carbon-analytics","homepage":null,"size":91987,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":128,"mirror_url":null,"archived":false,"open_issues_count":36,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":128,"open_issues":36,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-analytics/pulls/1264"},"html":{"href":"https://github.com/wso2/carbon-analytics/pull/1264"},"issue":{"href":"https://api.github.com/repos/wso2/carbon-analytics/issues/1264"},"comments":{"href":"https://api.github.com/repos/wso2/carbon-analytics/issues/1264/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/carbon-analytics/pulls/1264/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/carbon-analytics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/carbon-analytics/pulls/1264/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/carbon-analytics/statuses/f22ecdb0061fd6dabd517a31f8f47a5251207e37"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pcnfernando"}}