{"action":"created","comment":{"url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/comments/129226024","pull_request_review_id":51974429,"id":129226024,"diff_hunk":"@@ -0,0 +1,64 @@\n+/*\n+ * Copyright 2017 King's College London and The Hyve\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.radarcns.stream;\n+\n+import org.radarcns.config.RadarBackendOptions;\n+import org.radarcns.config.RadarPropertyHandler;\n+import org.radarcns.stream.empatica.E4StreamMaster;\n+import org.radarcns.stream.phone.PhoneStreamMaster;\n+\n+import java.io.IOException;\n+import java.util.Arrays;\n+\n+public class KafkaStreamFactory {\n+    private final RadarPropertyHandler properties;\n+    private final RadarBackendOptions options;\n+\n+    public KafkaStreamFactory(RadarBackendOptions options,\n+                              RadarPropertyHandler properties) {\n+        this.options = options;\n+        this.properties = properties;\n+    }\n+\n+    public StreamMaster createStreamWorker() throws IOException {\n+        String streamType = properties.getRadarProperties().getStreamWorker();\n+        if (streamType == null) {\n+            // Try to get the stream type from the commandline arguments\n+            String[] args = options.getSubCommandArgs();\n+            if (args == null || args.length == 0) {\n+                streamType = \"all\";\n+            } else {\n+                streamType = args[0];\n+            }\n+        }\n+\n+        boolean isStandalone = properties.getRadarProperties().isStandalone();\n+        switch (streamType) {\n+            case \"e4\":","path":"src/main/java/org/radarcns/stream/KafkaStreamFactory.java","position":51,"original_position":51,"commit_id":"3f8d262f1584d657998c7f99957b4fb2de546dc3","original_commit_id":"3f8d262f1584d657998c7f99957b4fb2de546dc3","user":{"login":"fnobilia","id":10063590,"avatar_url":"https://avatars1.githubusercontent.com/u/10063590?v=4","gravatar_id":"","url":"https://api.github.com/users/fnobilia","html_url":"https://github.com/fnobilia","followers_url":"https://api.github.com/users/fnobilia/followers","following_url":"https://api.github.com/users/fnobilia/following{/other_user}","gists_url":"https://api.github.com/users/fnobilia/gists{/gist_id}","starred_url":"https://api.github.com/users/fnobilia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fnobilia/subscriptions","organizations_url":"https://api.github.com/users/fnobilia/orgs","repos_url":"https://api.github.com/users/fnobilia/repos","events_url":"https://api.github.com/users/fnobilia/events{/privacy}","received_events_url":"https://api.github.com/users/fnobilia/received_events","type":"User","site_admin":false},"body":"Is it not better to define an enumerator for `e4`, `phone` and `all` that can be also reused in the `yml` file to configure the execution?","created_at":"2017-07-25T07:01:09Z","updated_at":"2017-07-25T07:58:44Z","html_url":"https://github.com/RADAR-CNS/RADAR-Backend/pull/25#discussion_r129226024","pull_request_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/comments/129226024"},"html":{"href":"https://github.com/RADAR-CNS/RADAR-Backend/pull/25#discussion_r129226024"},"pull_request":{"href":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/25","id":129133443,"html_url":"https://github.com/RADAR-CNS/RADAR-Backend/pull/25","diff_url":"https://github.com/RADAR-CNS/RADAR-Backend/pull/25.diff","patch_url":"https://github.com/RADAR-CNS/RADAR-Backend/pull/25.patch","issue_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/issues/25","number":25,"state":"open","locked":false,"title":"Initial implementation of adding app category to usage event","user":{"login":"MaximMoinat","id":17825660,"avatar_url":"https://avatars1.githubusercontent.com/u/17825660?v=4","gravatar_id":"","url":"https://api.github.com/users/MaximMoinat","html_url":"https://github.com/MaximMoinat","followers_url":"https://api.github.com/users/MaximMoinat/followers","following_url":"https://api.github.com/users/MaximMoinat/following{/other_user}","gists_url":"https://api.github.com/users/MaximMoinat/gists{/gist_id}","starred_url":"https://api.github.com/users/MaximMoinat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaximMoinat/subscriptions","organizations_url":"https://api.github.com/users/MaximMoinat/orgs","repos_url":"https://api.github.com/users/MaximMoinat/repos","events_url":"https://api.github.com/users/MaximMoinat/events{/privacy}","received_events_url":"https://api.github.com/users/MaximMoinat/received_events","type":"User","site_admin":false},"body":"Takes Usage Events stream and adds:\r\n- app category name (from Play Store webpage or from cache)\r\n- timestamp category fetched from Play Store\r\n\r\nStill needs to be tested.\r\n","created_at":"2017-07-06T08:51:35Z","updated_at":"2017-07-25T07:58:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e8118810348945b66f573a060f9be3fc9790eec","assignee":null,"assignees":[],"requested_reviewers":[{"login":"nivemaham","id":1315378,"avatar_url":"https://avatars3.githubusercontent.com/u/1315378?v=4","gravatar_id":"","url":"https://api.github.com/users/nivemaham","html_url":"https://github.com/nivemaham","followers_url":"https://api.github.com/users/nivemaham/followers","following_url":"https://api.github.com/users/nivemaham/following{/other_user}","gists_url":"https://api.github.com/users/nivemaham/gists{/gist_id}","starred_url":"https://api.github.com/users/nivemaham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nivemaham/subscriptions","organizations_url":"https://api.github.com/users/nivemaham/orgs","repos_url":"https://api.github.com/users/nivemaham/repos","events_url":"https://api.github.com/users/nivemaham/events{/privacy}","received_events_url":"https://api.github.com/users/nivemaham/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/25/commits","review_comments_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/25/comments","review_comment_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/issues/25/comments","statuses_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/statuses/3f8d262f1584d657998c7f99957b4fb2de546dc3","head":{"label":"thehyve:phone-streams","ref":"phone-streams","sha":"3f8d262f1584d657998c7f99957b4fb2de546dc3","user":{"login":"thehyve","id":1502440,"avatar_url":"https://avatars3.githubusercontent.com/u/1502440?v=4","gravatar_id":"","url":"https://api.github.com/users/thehyve","html_url":"https://github.com/thehyve","followers_url":"https://api.github.com/users/thehyve/followers","following_url":"https://api.github.com/users/thehyve/following{/other_user}","gists_url":"https://api.github.com/users/thehyve/gists{/gist_id}","starred_url":"https://api.github.com/users/thehyve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thehyve/subscriptions","organizations_url":"https://api.github.com/users/thehyve/orgs","repos_url":"https://api.github.com/users/thehyve/repos","events_url":"https://api.github.com/users/thehyve/events{/privacy}","received_events_url":"https://api.github.com/users/thehyve/received_events","type":"Organization","site_admin":false},"repo":{"id":70575752,"name":"RADAR-Backend","full_name":"thehyve/RADAR-Backend","owner":{"login":"thehyve","id":1502440,"avatar_url":"https://avatars3.githubusercontent.com/u/1502440?v=4","gravatar_id":"","url":"https://api.github.com/users/thehyve","html_url":"https://github.com/thehyve","followers_url":"https://api.github.com/users/thehyve/followers","following_url":"https://api.github.com/users/thehyve/following{/other_user}","gists_url":"https://api.github.com/users/thehyve/gists{/gist_id}","starred_url":"https://api.github.com/users/thehyve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thehyve/subscriptions","organizations_url":"https://api.github.com/users/thehyve/orgs","repos_url":"https://api.github.com/users/thehyve/repos","events_url":"https://api.github.com/users/thehyve/events{/privacy}","received_events_url":"https://api.github.com/users/thehyve/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thehyve/RADAR-Backend","description":"Kafka backend for processing device data","fork":true,"url":"https://api.github.com/repos/thehyve/RADAR-Backend","forks_url":"https://api.github.com/repos/thehyve/RADAR-Backend/forks","keys_url":"https://api.github.com/repos/thehyve/RADAR-Backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thehyve/RADAR-Backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thehyve/RADAR-Backend/teams","hooks_url":"https://api.github.com/repos/thehyve/RADAR-Backend/hooks","issue_events_url":"https://api.github.com/repos/thehyve/RADAR-Backend/issues/events{/number}","events_url":"https://api.github.com/repos/thehyve/RADAR-Backend/events","assignees_url":"https://api.github.com/repos/thehyve/RADAR-Backend/assignees{/user}","branches_url":"https://api.github.com/repos/thehyve/RADAR-Backend/branches{/branch}","tags_url":"https://api.github.com/repos/thehyve/RADAR-Backend/tags","blobs_url":"https://api.github.com/repos/thehyve/RADAR-Backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thehyve/RADAR-Backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thehyve/RADAR-Backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/thehyve/RADAR-Backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thehyve/RADAR-Backend/statuses/{sha}","languages_url":"https://api.github.com/repos/thehyve/RADAR-Backend/languages","stargazers_url":"https://api.github.com/repos/thehyve/RADAR-Backend/stargazers","contributors_url":"https://api.github.com/repos/thehyve/RADAR-Backend/contributors","subscribers_url":"https://api.github.com/repos/thehyve/RADAR-Backend/subscribers","subscription_url":"https://api.github.com/repos/thehyve/RADAR-Backend/subscription","commits_url":"https://api.github.com/repos/thehyve/RADAR-Backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/thehyve/RADAR-Backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/thehyve/RADAR-Backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/thehyve/RADAR-Backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/thehyve/RADAR-Backend/contents/{+path}","compare_url":"https://api.github.com/repos/thehyve/RADAR-Backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thehyve/RADAR-Backend/merges","archive_url":"https://api.github.com/repos/thehyve/RADAR-Backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thehyve/RADAR-Backend/downloads","issues_url":"https://api.github.com/repos/thehyve/RADAR-Backend/issues{/number}","pulls_url":"https://api.github.com/repos/thehyve/RADAR-Backend/pulls{/number}","milestones_url":"https://api.github.com/repos/thehyve/RADAR-Backend/milestones{/number}","notifications_url":"https://api.github.com/repos/thehyve/RADAR-Backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thehyve/RADAR-Backend/labels{/name}","releases_url":"https://api.github.com/repos/thehyve/RADAR-Backend/releases{/id}","deployments_url":"https://api.github.com/repos/thehyve/RADAR-Backend/deployments","created_at":"2016-10-11T09:05:31Z","updated_at":"2016-10-11T09:05:33Z","pushed_at":"2017-07-24T11:27:35Z","git_url":"git://github.com/thehyve/RADAR-Backend.git","ssh_url":"git@github.com:thehyve/RADAR-Backend.git","clone_url":"https://github.com/thehyve/RADAR-Backend.git","svn_url":"https://github.com/thehyve/RADAR-Backend","homepage":null,"size":4377,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"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":"RADAR-CNS:dev","ref":"dev","sha":"349c766ef448733c7c7bd984345cde329070c923","user":{"login":"RADAR-CNS","id":22225205,"avatar_url":"https://avatars0.githubusercontent.com/u/22225205?v=4","gravatar_id":"","url":"https://api.github.com/users/RADAR-CNS","html_url":"https://github.com/RADAR-CNS","followers_url":"https://api.github.com/users/RADAR-CNS/followers","following_url":"https://api.github.com/users/RADAR-CNS/following{/other_user}","gists_url":"https://api.github.com/users/RADAR-CNS/gists{/gist_id}","starred_url":"https://api.github.com/users/RADAR-CNS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RADAR-CNS/subscriptions","organizations_url":"https://api.github.com/users/RADAR-CNS/orgs","repos_url":"https://api.github.com/users/RADAR-CNS/repos","events_url":"https://api.github.com/users/RADAR-CNS/events{/privacy}","received_events_url":"https://api.github.com/users/RADAR-CNS/received_events","type":"Organization","site_admin":false},"repo":{"id":68805727,"name":"RADAR-Backend","full_name":"RADAR-CNS/RADAR-Backend","owner":{"login":"RADAR-CNS","id":22225205,"avatar_url":"https://avatars0.githubusercontent.com/u/22225205?v=4","gravatar_id":"","url":"https://api.github.com/users/RADAR-CNS","html_url":"https://github.com/RADAR-CNS","followers_url":"https://api.github.com/users/RADAR-CNS/followers","following_url":"https://api.github.com/users/RADAR-CNS/following{/other_user}","gists_url":"https://api.github.com/users/RADAR-CNS/gists{/gist_id}","starred_url":"https://api.github.com/users/RADAR-CNS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RADAR-CNS/subscriptions","organizations_url":"https://api.github.com/users/RADAR-CNS/orgs","repos_url":"https://api.github.com/users/RADAR-CNS/repos","events_url":"https://api.github.com/users/RADAR-CNS/events{/privacy}","received_events_url":"https://api.github.com/users/RADAR-CNS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RADAR-CNS/RADAR-Backend","description":"Kafka backend for processing device data","fork":false,"url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend","forks_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/forks","keys_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/teams","hooks_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/hooks","issue_events_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/issues/events{/number}","events_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/events","assignees_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/assignees{/user}","branches_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/branches{/branch}","tags_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/tags","blobs_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/statuses/{sha}","languages_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/languages","stargazers_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/stargazers","contributors_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/contributors","subscribers_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/subscribers","subscription_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/subscription","commits_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/contents/{+path}","compare_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/merges","archive_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/downloads","issues_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/issues{/number}","pulls_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls{/number}","milestones_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/milestones{/number}","notifications_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/labels{/name}","releases_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/releases{/id}","deployments_url":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/deployments","created_at":"2016-09-21T10:20:59Z","updated_at":"2017-05-25T16:51:28Z","pushed_at":"2017-07-24T11:27:36Z","git_url":"git://github.com/RADAR-CNS/RADAR-Backend.git","ssh_url":"git@github.com:RADAR-CNS/RADAR-Backend.git","clone_url":"https://github.com/RADAR-CNS/RADAR-Backend.git","svn_url":"https://github.com/RADAR-CNS/RADAR-Backend","homepage":null,"size":4108,"stargazers_count":11,"watchers_count":11,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":11,"forks":2,"open_issues":11,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/25"},"html":{"href":"https://github.com/RADAR-CNS/RADAR-Backend/pull/25"},"issue":{"href":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/issues/25"},"comments":{"href":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/RADAR-CNS/RADAR-Backend/statuses/3f8d262f1584d657998c7f99957b4fb2de546dc3"}}}}
{"actor":{"display_login":"fnobilia"}}