{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/msf4j/pulls/comments/105083449","pull_request_review_id":25945623,"id":105083449,"diff_hunk":"@@ -0,0 +1,146 @@\n+/*\n+ *  Copyright (c) 2017, 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.msf4j.internal.websocket;\n+\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import org.wso2.carbon.messaging.CarbonMessage;\n+import org.wso2.carbon.transport.http.netty.common.Constants;\n+import org.wso2.msf4j.internal.router.PatternPathRouter;\n+import org.wso2.msf4j.websocket.WebSocketEndpointsRegistry;\n+import org.wso2.msf4j.websocket.exception.WebSocketEndpointAnnotationException;\n+\n+import java.util.List;\n+import java.util.Map;\n+import java.util.Set;\n+import java.util.concurrent.ConcurrentHashMap;\n+import java.util.stream.Collectors;\n+\n+/**\n+ * Implementation for {@link WebSocketEndpointsRegistry}.\n+ * Endpoints are Dispatched and Stored in a {@link PatternPathRouter}. So when new request comes it will be routed to\n+ * best matching URI.\n+ */\n+public class EndpointsRegistryImpl implements WebSocketEndpointsRegistry {\n+\n+    private static final Logger log = LoggerFactory.getLogger(EndpointsRegistryImpl.class);\n+    private static final EndpointsRegistryImpl webSocketEndpointsRegistry = new EndpointsRegistryImpl();\n+\n+    // Map <uri, WebSocketEndpoint>\n+    private final Map<String, Object> webSocketEndpointMap = new ConcurrentHashMap<>();\n+    // PatterPathRouter<WebSocketEndpoint>\n+    private PatternPathRouter<Object> endpointPatternPathRouter = PatternPathRouter.create();\n+\n+    // Makes this class singleton.\n+    private EndpointsRegistryImpl() {\n+    }\n+\n+    /**\n+     * @return this singleton instance of {@link EndpointsRegistryImpl}.\n+     */\n+    public static EndpointsRegistryImpl getInstance() {\n+        return webSocketEndpointsRegistry;\n+    }\n+\n+    /**\n+     * Adding endpoints to the registry.\n+     * @param webSocketEndpoints to add.\n+     */\n+    public void addEndpoint(Object... webSocketEndpoints) throws WebSocketEndpointAnnotationException {\n+        for (Object endpoint: webSocketEndpoints) {\n+            EndpointDispatcher dispatcher = new EndpointDispatcher();\n+            webSocketEndpointMap.put(dispatcher.getUri(endpoint), endpoint);\n+            updatePatternPathRouter();\n+            log.info(\"Endpoint Registered : \" + dispatcher.getUri(endpoint));\n+        }\n+    }\n+\n+    /**\n+     * Remove WebSocket Endpoint from Registry.","path":"core/src/main/java/org/wso2/msf4j/internal/websocket/EndpointsRegistryImpl.java","position":75,"original_position":75,"commit_id":"e98a7d54f4e6c8758188afdae044175f57b4d245","original_commit_id":"e98a7d54f4e6c8758188afdae044175f57b4d245","user":{"login":"vidurananayakkara","id":8591787,"avatar_url":"https://avatars3.githubusercontent.com/u/8591787?v=3","gravatar_id":"","url":"https://api.github.com/users/vidurananayakkara","html_url":"https://github.com/vidurananayakkara","followers_url":"https://api.github.com/users/vidurananayakkara/followers","following_url":"https://api.github.com/users/vidurananayakkara/following{/other_user}","gists_url":"https://api.github.com/users/vidurananayakkara/gists{/gist_id}","starred_url":"https://api.github.com/users/vidurananayakkara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vidurananayakkara/subscriptions","organizations_url":"https://api.github.com/users/vidurananayakkara/orgs","repos_url":"https://api.github.com/users/vidurananayakkara/repos","events_url":"https://api.github.com/users/vidurananayakkara/events{/privacy}","received_events_url":"https://api.github.com/users/vidurananayakkara/received_events","type":"User","site_admin":false},"body":"There should be a blank line after the method description","created_at":"2017-03-09T04:11:01Z","updated_at":"2017-03-09T04:11:01Z","html_url":"https://github.com/wso2/msf4j/pull/364#discussion_r105083449","pull_request_url":"https://api.github.com/repos/wso2/msf4j/pulls/364","_links":{"self":{"href":"https://api.github.com/repos/wso2/msf4j/pulls/comments/105083449"},"html":{"href":"https://github.com/wso2/msf4j/pull/364#discussion_r105083449"},"pull_request":{"href":"https://api.github.com/repos/wso2/msf4j/pulls/364"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/msf4j/pulls/364","id":109687556,"html_url":"https://github.com/wso2/msf4j/pull/364","diff_url":"https://github.com/wso2/msf4j/pull/364.diff","patch_url":"https://github.com/wso2/msf4j/pull/364.patch","issue_url":"https://api.github.com/repos/wso2/msf4j/issues/364","number":364,"state":"open","locked":false,"title":"Websocket support for MSF4J","user":{"login":"irunika","id":9251082,"avatar_url":"https://avatars0.githubusercontent.com/u/9251082?v=3","gravatar_id":"","url":"https://api.github.com/users/irunika","html_url":"https://github.com/irunika","followers_url":"https://api.github.com/users/irunika/followers","following_url":"https://api.github.com/users/irunika/following{/other_user}","gists_url":"https://api.github.com/users/irunika/gists{/gist_id}","starred_url":"https://api.github.com/users/irunika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irunika/subscriptions","organizations_url":"https://api.github.com/users/irunika/orgs","repos_url":"https://api.github.com/users/irunika/repos","events_url":"https://api.github.com/users/irunika/events{/privacy}","received_events_url":"https://api.github.com/users/irunika/received_events","type":"User","site_admin":false},"body":"This includes the basic implementation of WebSocket for MSF4J\r\nresolves #272","created_at":"2017-03-08T12:40:16Z","updated_at":"2017-03-09T04:11:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e35390b4070c89e0edcbae54f5610ab21d9ec1ab","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/wso2/msf4j/pulls/364/commits","review_comments_url":"https://api.github.com/repos/wso2/msf4j/pulls/364/comments","review_comment_url":"https://api.github.com/repos/wso2/msf4j/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/msf4j/issues/364/comments","statuses_url":"https://api.github.com/repos/wso2/msf4j/statuses/e98a7d54f4e6c8758188afdae044175f57b4d245","head":{"label":"irunika:websocket-support","ref":"websocket-support","sha":"e98a7d54f4e6c8758188afdae044175f57b4d245","user":{"login":"irunika","id":9251082,"avatar_url":"https://avatars0.githubusercontent.com/u/9251082?v=3","gravatar_id":"","url":"https://api.github.com/users/irunika","html_url":"https://github.com/irunika","followers_url":"https://api.github.com/users/irunika/followers","following_url":"https://api.github.com/users/irunika/following{/other_user}","gists_url":"https://api.github.com/users/irunika/gists{/gist_id}","starred_url":"https://api.github.com/users/irunika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irunika/subscriptions","organizations_url":"https://api.github.com/users/irunika/orgs","repos_url":"https://api.github.com/users/irunika/repos","events_url":"https://api.github.com/users/irunika/events{/privacy}","received_events_url":"https://api.github.com/users/irunika/received_events","type":"User","site_admin":false},"repo":{"id":74013349,"name":"msf4j","full_name":"irunika/msf4j","owner":{"login":"irunika","id":9251082,"avatar_url":"https://avatars0.githubusercontent.com/u/9251082?v=3","gravatar_id":"","url":"https://api.github.com/users/irunika","html_url":"https://github.com/irunika","followers_url":"https://api.github.com/users/irunika/followers","following_url":"https://api.github.com/users/irunika/following{/other_user}","gists_url":"https://api.github.com/users/irunika/gists{/gist_id}","starred_url":"https://api.github.com/users/irunika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irunika/subscriptions","organizations_url":"https://api.github.com/users/irunika/orgs","repos_url":"https://api.github.com/users/irunika/repos","events_url":"https://api.github.com/users/irunika/events{/privacy}","received_events_url":"https://api.github.com/users/irunika/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/irunika/msf4j","description":"WSO2 Microservices Framework for Java (MSF4J)","fork":true,"url":"https://api.github.com/repos/irunika/msf4j","forks_url":"https://api.github.com/repos/irunika/msf4j/forks","keys_url":"https://api.github.com/repos/irunika/msf4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/irunika/msf4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/irunika/msf4j/teams","hooks_url":"https://api.github.com/repos/irunika/msf4j/hooks","issue_events_url":"https://api.github.com/repos/irunika/msf4j/issues/events{/number}","events_url":"https://api.github.com/repos/irunika/msf4j/events","assignees_url":"https://api.github.com/repos/irunika/msf4j/assignees{/user}","branches_url":"https://api.github.com/repos/irunika/msf4j/branches{/branch}","tags_url":"https://api.github.com/repos/irunika/msf4j/tags","blobs_url":"https://api.github.com/repos/irunika/msf4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/irunika/msf4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/irunika/msf4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/irunika/msf4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/irunika/msf4j/statuses/{sha}","languages_url":"https://api.github.com/repos/irunika/msf4j/languages","stargazers_url":"https://api.github.com/repos/irunika/msf4j/stargazers","contributors_url":"https://api.github.com/repos/irunika/msf4j/contributors","subscribers_url":"https://api.github.com/repos/irunika/msf4j/subscribers","subscription_url":"https://api.github.com/repos/irunika/msf4j/subscription","commits_url":"https://api.github.com/repos/irunika/msf4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/irunika/msf4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/irunika/msf4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/irunika/msf4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/irunika/msf4j/contents/{+path}","compare_url":"https://api.github.com/repos/irunika/msf4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/irunika/msf4j/merges","archive_url":"https://api.github.com/repos/irunika/msf4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/irunika/msf4j/downloads","issues_url":"https://api.github.com/repos/irunika/msf4j/issues{/number}","pulls_url":"https://api.github.com/repos/irunika/msf4j/pulls{/number}","milestones_url":"https://api.github.com/repos/irunika/msf4j/milestones{/number}","notifications_url":"https://api.github.com/repos/irunika/msf4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/irunika/msf4j/labels{/name}","releases_url":"https://api.github.com/repos/irunika/msf4j/releases{/id}","deployments_url":"https://api.github.com/repos/irunika/msf4j/deployments","created_at":"2016-11-17T09:51:20Z","updated_at":"2016-11-17T09:51:23Z","pushed_at":"2017-03-08T17:57:47Z","git_url":"git://github.com/irunika/msf4j.git","ssh_url":"git@github.com:irunika/msf4j.git","clone_url":"https://github.com/irunika/msf4j.git","svn_url":"https://github.com/irunika/msf4j","homepage":"http://wso2.com/products/microservices-framework-for-java/","size":31621,"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:msf4j-with-new-transport","ref":"msf4j-with-new-transport","sha":"8a85960a6bda46b5304d3e44d5dc1cea838a68bf","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":42847560,"name":"msf4j","full_name":"wso2/msf4j","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/msf4j","description":"WSO2 Microservices Framework for Java (MSF4J)","fork":false,"url":"https://api.github.com/repos/wso2/msf4j","forks_url":"https://api.github.com/repos/wso2/msf4j/forks","keys_url":"https://api.github.com/repos/wso2/msf4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/msf4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/msf4j/teams","hooks_url":"https://api.github.com/repos/wso2/msf4j/hooks","issue_events_url":"https://api.github.com/repos/wso2/msf4j/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/msf4j/events","assignees_url":"https://api.github.com/repos/wso2/msf4j/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/msf4j/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/msf4j/tags","blobs_url":"https://api.github.com/repos/wso2/msf4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/msf4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/msf4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/msf4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/msf4j/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/msf4j/languages","stargazers_url":"https://api.github.com/repos/wso2/msf4j/stargazers","contributors_url":"https://api.github.com/repos/wso2/msf4j/contributors","subscribers_url":"https://api.github.com/repos/wso2/msf4j/subscribers","subscription_url":"https://api.github.com/repos/wso2/msf4j/subscription","commits_url":"https://api.github.com/repos/wso2/msf4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/msf4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/msf4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/msf4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/msf4j/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/msf4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/msf4j/merges","archive_url":"https://api.github.com/repos/wso2/msf4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/msf4j/downloads","issues_url":"https://api.github.com/repos/wso2/msf4j/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/msf4j/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/msf4j/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/msf4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/msf4j/labels{/name}","releases_url":"https://api.github.com/repos/wso2/msf4j/releases{/id}","deployments_url":"https://api.github.com/repos/wso2/msf4j/deployments","created_at":"2015-09-21T06:19:29Z","updated_at":"2017-03-05T01:28:07Z","pushed_at":"2017-03-08T17:57:49Z","git_url":"git://github.com/wso2/msf4j.git","ssh_url":"git@github.com:wso2/msf4j.git","clone_url":"https://github.com/wso2/msf4j.git","svn_url":"https://github.com/wso2/msf4j","homepage":"http://wso2.com/products/microservices-framework-for-java/","size":31441,"stargazers_count":190,"watchers_count":190,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":179,"mirror_url":null,"open_issues_count":34,"forks":179,"open_issues":34,"watchers":190,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/msf4j/pulls/364"},"html":{"href":"https://github.com/wso2/msf4j/pull/364"},"issue":{"href":"https://api.github.com/repos/wso2/msf4j/issues/364"},"comments":{"href":"https://api.github.com/repos/wso2/msf4j/issues/364/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/msf4j/pulls/364/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/msf4j/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/msf4j/pulls/364/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/msf4j/statuses/e98a7d54f4e6c8758188afdae044175f57b4d245"}}}}
{"actor":{"display_login":"vidurananayakkara"}}