{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/189640748","pull_request_review_id":120855906,"id":189640748,"diff_hunk":"@@ -0,0 +1,135 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements. See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * the License. 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.apache.kafka.connect.runtime.rest;\n+\n+import org.glassfish.jersey.server.ResourceConfig;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import java.util.Map;\n+import java.util.Objects;\n+\n+import javax.ws.rs.core.Configurable;\n+import javax.ws.rs.core.Configuration;\n+\n+/**\n+ * The implementation delegates to {@link ResourceConfig} so that we can handle duplicate\n+ * registrations deterministically by no re-registering them again.\n+ */\n+public class ConnectRestConfigurable implements Configurable<ResourceConfig> {\n+\n+    private static final Logger log = LoggerFactory.getLogger(ConnectRestConfigurable.class);\n+\n+    private ResourceConfig resourceConfig;\n+\n+    public ConnectRestConfigurable(ResourceConfig resourceConfig) {\n+        Objects.requireNonNull(resourceConfig, \"ResourceConfig can't be null\");\n+        this.resourceConfig = resourceConfig;\n+    }\n+\n+\n+    @Override\n+    public Configuration getConfiguration() {\n+        return resourceConfig.getConfiguration();\n+    }\n+\n+    @Override\n+    public ResourceConfig property(String name, Object value) {\n+        return resourceConfig.property(name, value);\n+    }\n+\n+    @Override\n+    public ResourceConfig register(Object component) {\n+        if (allowedToRegister(component)) {\n+            resourceConfig.register(component);\n+        }\n+        return resourceConfig;\n+    }\n+\n+    @Override\n+    public ResourceConfig register(Object component, int priority) {\n+        if (allowedToRegister(component)) {\n+            resourceConfig.register(component, priority);\n+        }\n+        return resourceConfig;\n+    }\n+\n+    @Override\n+    public ResourceConfig register(Object component, Map contracts) {\n+        if (allowedToRegister(component)) {\n+            resourceConfig.register(component, contracts);\n+        }\n+        return resourceConfig;\n+    }\n+\n+    @Override\n+    public ResourceConfig register(Object component, Class[] contracts) {\n+        if (allowedToRegister(component)) {\n+            resourceConfig.register(component, contracts);\n+        }\n+        return resourceConfig;\n+    }\n+\n+    @Override\n+    public ResourceConfig register(Class componentClass, Map contracts) {\n+        if (allowedToRegister(componentClass)) {\n+            resourceConfig.register(componentClass, contracts);\n+        }\n+        return resourceConfig;\n+    }\n+\n+    @Override\n+    public ResourceConfig register(Class componentClass, Class[] contracts) {\n+        if (allowedToRegister(componentClass)) {\n+            resourceConfig.register(componentClass, contracts);\n+        }\n+        return resourceConfig;\n+    }\n+\n+    @Override\n+    public ResourceConfig register(Class componentClass, int priority) {\n+        if (allowedToRegister(componentClass)) {\n+            resourceConfig.register(componentClass, priority);\n+        }\n+        return resourceConfig;\n+    }\n+\n+    @Override\n+    public ResourceConfig register(Class componentClass) {\n+        if (allowedToRegister(componentClass)) {\n+            resourceConfig.register(componentClass);\n+        }\n+        return resourceConfig;\n+    }\n+\n+    private boolean allowedToRegister(Object component) {\n+        if (resourceConfig.isRegistered(component)) {","path":"connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/ConnectRestConfigurable.java","position":121,"original_position":121,"commit_id":"6ab088c0b80c21a65733e02a8916bc27b1ae9bdb","original_commit_id":"6ab088c0b80c21a65733e02a8916bc27b1ae9bdb","user":{"login":"rhauch","id":84732,"avatar_url":"https://avatars0.githubusercontent.com/u/84732?v=4","gravatar_id":"","url":"https://api.github.com/users/rhauch","html_url":"https://github.com/rhauch","followers_url":"https://api.github.com/users/rhauch/followers","following_url":"https://api.github.com/users/rhauch/following{/other_user}","gists_url":"https://api.github.com/users/rhauch/gists{/gist_id}","starred_url":"https://api.github.com/users/rhauch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhauch/subscriptions","organizations_url":"https://api.github.com/users/rhauch/orgs","repos_url":"https://api.github.com/users/rhauch/repos","events_url":"https://api.github.com/users/rhauch/events{/privacy}","received_events_url":"https://api.github.com/users/rhauch/received_events","type":"User","site_admin":false},"body":"Seems like this boolean check is backwards. Shouldn't this method return true if the component is _not_ already registered?","created_at":"2018-05-21T16:23:33Z","updated_at":"2018-05-21T16:27:55Z","html_url":"https://github.com/apache/kafka/pull/4931#discussion_r189640748","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/4931","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/189640748"},"html":{"href":"https://github.com/apache/kafka/pull/4931#discussion_r189640748"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/4931"}}},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/4931","id":184146651,"html_url":"https://github.com/apache/kafka/pull/4931","diff_url":"https://github.com/apache/kafka/pull/4931.diff","patch_url":"https://github.com/apache/kafka/pull/4931.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/4931","number":4931,"state":"open","locked":false,"title":"KAFKA-6776 : ConnectRestExtension Interfaces & Rest integration","user":{"login":"mageshn","id":7535516,"avatar_url":"https://avatars3.githubusercontent.com/u/7535516?v=4","gravatar_id":"","url":"https://api.github.com/users/mageshn","html_url":"https://github.com/mageshn","followers_url":"https://api.github.com/users/mageshn/followers","following_url":"https://api.github.com/users/mageshn/following{/other_user}","gists_url":"https://api.github.com/users/mageshn/gists{/gist_id}","starred_url":"https://api.github.com/users/mageshn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mageshn/subscriptions","organizations_url":"https://api.github.com/users/mageshn/orgs","repos_url":"https://api.github.com/users/mageshn/repos","events_url":"https://api.github.com/users/mageshn/events{/privacy}","received_events_url":"https://api.github.com/users/mageshn/received_events","type":"User","site_admin":false},"body":"This PR provides the implementation for KIP-285 and also a reference implementation for authenticating BasicAuth credentials using JAAS LoginModule\r\n\r\n### Committer Checklist (excluded from commit message)\r\n- [ ] Verify design and implementation \r\n- [ ] Verify test coverage and CI build status\r\n- [ ] Verify documentation (including upgrade notes)\r\n","created_at":"2018-04-25T19:58:35Z","updated_at":"2018-05-21T16:27:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cff96f5c159c510e250b48d956338c6dc8df48ee","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/4931/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/4931/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/4931/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/6ab088c0b80c21a65733e02a8916bc27b1ae9bdb","head":{"label":"mageshn:KIP-285","ref":"KIP-285","sha":"6ab088c0b80c21a65733e02a8916bc27b1ae9bdb","user":{"login":"mageshn","id":7535516,"avatar_url":"https://avatars3.githubusercontent.com/u/7535516?v=4","gravatar_id":"","url":"https://api.github.com/users/mageshn","html_url":"https://github.com/mageshn","followers_url":"https://api.github.com/users/mageshn/followers","following_url":"https://api.github.com/users/mageshn/following{/other_user}","gists_url":"https://api.github.com/users/mageshn/gists{/gist_id}","starred_url":"https://api.github.com/users/mageshn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mageshn/subscriptions","organizations_url":"https://api.github.com/users/mageshn/orgs","repos_url":"https://api.github.com/users/mageshn/repos","events_url":"https://api.github.com/users/mageshn/events{/privacy}","received_events_url":"https://api.github.com/users/mageshn/received_events","type":"User","site_admin":false},"repo":{"id":118654341,"name":"kafka","full_name":"mageshn/kafka","owner":{"login":"mageshn","id":7535516,"avatar_url":"https://avatars3.githubusercontent.com/u/7535516?v=4","gravatar_id":"","url":"https://api.github.com/users/mageshn","html_url":"https://github.com/mageshn","followers_url":"https://api.github.com/users/mageshn/followers","following_url":"https://api.github.com/users/mageshn/following{/other_user}","gists_url":"https://api.github.com/users/mageshn/gists{/gist_id}","starred_url":"https://api.github.com/users/mageshn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mageshn/subscriptions","organizations_url":"https://api.github.com/users/mageshn/orgs","repos_url":"https://api.github.com/users/mageshn/repos","events_url":"https://api.github.com/users/mageshn/events{/privacy}","received_events_url":"https://api.github.com/users/mageshn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mageshn/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/mageshn/kafka","forks_url":"https://api.github.com/repos/mageshn/kafka/forks","keys_url":"https://api.github.com/repos/mageshn/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mageshn/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mageshn/kafka/teams","hooks_url":"https://api.github.com/repos/mageshn/kafka/hooks","issue_events_url":"https://api.github.com/repos/mageshn/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/mageshn/kafka/events","assignees_url":"https://api.github.com/repos/mageshn/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/mageshn/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/mageshn/kafka/tags","blobs_url":"https://api.github.com/repos/mageshn/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mageshn/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mageshn/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/mageshn/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mageshn/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/mageshn/kafka/languages","stargazers_url":"https://api.github.com/repos/mageshn/kafka/stargazers","contributors_url":"https://api.github.com/repos/mageshn/kafka/contributors","subscribers_url":"https://api.github.com/repos/mageshn/kafka/subscribers","subscription_url":"https://api.github.com/repos/mageshn/kafka/subscription","commits_url":"https://api.github.com/repos/mageshn/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/mageshn/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/mageshn/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/mageshn/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/mageshn/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/mageshn/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mageshn/kafka/merges","archive_url":"https://api.github.com/repos/mageshn/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mageshn/kafka/downloads","issues_url":"https://api.github.com/repos/mageshn/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/mageshn/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/mageshn/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/mageshn/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mageshn/kafka/labels{/name}","releases_url":"https://api.github.com/repos/mageshn/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/mageshn/kafka/deployments","created_at":"2018-01-23T18:53:00Z","updated_at":"2018-01-23T18:53:12Z","pushed_at":"2018-05-17T21:32:10Z","git_url":"git://github.com/mageshn/kafka.git","ssh_url":"git@github.com:mageshn/kafka.git","clone_url":"https://github.com/mageshn/kafka.git","svn_url":"https://github.com/mageshn/kafka","homepage":null,"size":63934,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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":"trunk"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"b82252b1e03c2cff9ca4059157dc850afbe047bf","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":2211243,"name":"kafka","full_name":"apache/kafka","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/kafka","description":"Mirror of Apache Kafka","fork":false,"url":"https://api.github.com/repos/apache/kafka","forks_url":"https://api.github.com/repos/apache/kafka/forks","keys_url":"https://api.github.com/repos/apache/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/kafka/teams","hooks_url":"https://api.github.com/repos/apache/kafka/hooks","issue_events_url":"https://api.github.com/repos/apache/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/apache/kafka/events","assignees_url":"https://api.github.com/repos/apache/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/apache/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/apache/kafka/tags","blobs_url":"https://api.github.com/repos/apache/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/kafka/languages","stargazers_url":"https://api.github.com/repos/apache/kafka/stargazers","contributors_url":"https://api.github.com/repos/apache/kafka/contributors","subscribers_url":"https://api.github.com/repos/apache/kafka/subscribers","subscription_url":"https://api.github.com/repos/apache/kafka/subscription","commits_url":"https://api.github.com/repos/apache/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/apache/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/kafka/merges","archive_url":"https://api.github.com/repos/apache/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/kafka/downloads","issues_url":"https://api.github.com/repos/apache/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/apache/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/kafka/labels{/name}","releases_url":"https://api.github.com/repos/apache/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/apache/kafka/deployments","created_at":"2011-08-15T18:06:16Z","updated_at":"2018-05-21T15:39:44Z","pushed_at":"2018-05-21T16:27:07Z","git_url":"git://github.com/apache/kafka.git","ssh_url":"git@github.com:apache/kafka.git","clone_url":"https://github.com/apache/kafka.git","svn_url":"https://github.com/apache/kafka","homepage":null,"size":65592,"stargazers_count":8399,"watchers_count":8399,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4877,"mirror_url":null,"archived":false,"open_issues_count":466,"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":4877,"open_issues":466,"watchers":8399,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/4931"},"html":{"href":"https://github.com/apache/kafka/pull/4931"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/4931"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/4931/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/4931/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/4931/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/6ab088c0b80c21a65733e02a8916bc27b1ae9bdb"}},"author_association":"NONE"}}
{"actor":{"display_login":"rhauch"}}