{"action":"created","comment":{"url":"https://api.github.com/repos/zatar-iot/leshan/pulls/comments/34264203","id":34264203,"diff_hunk":"@@ -50,191 +57,211 @@\n  */\n public class LeshanServerBuilder {\n \n-\tprivate static final Logger LOG = LoggerFactory.getLogger(LeshanServer.class);\n+    private static final Logger LOG = LoggerFactory.getLogger(LeshanServer.class);\n+\n+    /** default loopback address */\n+    private static final String LOCALHOST = \"127.0.0.1\";\n \n-\t/**default loopback address*/\n-\tprivate static final String LOCALHOST = \"127.0.0.1\";\n \n+    /** IANA assigned UDP port for CoAP (so for LWM2M) */\n+    public static final int PORT = 5683;\n \n-\t/** IANA assigned UDP port for CoAP (so for LWM2M) */\n-\tpublic static final int PORT = 5683;\n+    /** IANA assigned UDP port for CoAP with DTLS (so for LWM2M) */\n+    public static final int PORT_DTLS = 5684;\n \n-\t/** IANA assigned UDP port for CoAP with DTLS (so for LWM2M) */\n-\tpublic static final int PORT_DTLS = 5684;    \n+    public static LeshanTcpServerBuilder<?> getLeshanTCPServerBuilder() {\n+        return new LeshanTcpServerBuilder();\n+    }\n \n-\tpublic static LeshanTCPServerBuilder<?> getLeshanTCPServerBuilder() {\n-\t\treturn new LeshanTCPServerBuilder();\n+    public static LeshanTlsServerBuilder getLeshanTLSServerBuilder() {\n+        return new LeshanTlsServerBuilder();\n+    }\n \n-\t}\n+    public static LeshanUDPServerBuilder getLeshanUDPServerBuilder() {\n+        return new LeshanUDPServerBuilder();\n \n-\tpublic static LeshanTLSServerBuilder getLeshanTLSServerBuilder() {\n-\t\treturn new LeshanTLSServerBuilder();\n-\t}\n+    }\n \n-\tpublic static LeshanUDPServerBuilder getLeshanUDPServerBuilder() {\n-\t\treturn new LeshanUDPServerBuilder();\n+    public static abstract class BasicLeshanServerBuilder<E extends BasicLeshanServerBuilder<E>> {\n \n-\t}\n+        private final EnumSet<BindingMode> bindingModes;\n \n-\tpublic static abstract class BasicLeshanServerBuilder<E extends BasicLeshanServerBuilder<E>> {\n+        protected SecurityRegistry securityRegistry;\n+        protected ObservationRegistry observationRegistry;\n+        protected ClientRegistry clientRegistry;\n+        protected LwM2mModelProvider modelProvider;\n+        protected String address;\n+        protected int port;\n+        protected ConnectionStateListener connectionStateListener;\n \n-\t\tprivate final EnumSet<BindingMode> bindingModes;\n+        private BasicLeshanServerBuilder(final BindingMode bMode) {\n+            bindingModes = BindingMode.getBindingMode(bMode);\n+        }\n \n-\t\tprotected SecurityRegistry securityRegistry;\n-\t\tprotected ObservationRegistry observationRegistry;\n-\t\tprotected ClientRegistry clientRegistry;\n-\t\tprotected LwM2mModelProvider modelProvider;\n+        public E setClientRegistry(final ClientRegistry clientRegistry) {\n+            this.clientRegistry = clientRegistry;\n+            return (E) this;\n+        }\n \n-\t\tprivate BasicLeshanServerBuilder(final BindingMode bMode){\n-\t\t\tbindingModes = BindingMode.getBindingMode(bMode);\n-\t\t}\n+        public E setObservationRegistry(final ObservationRegistry observationRegistry) {\n+            this.observationRegistry = observationRegistry;\n+            return (E) this;\n+        }\n \n-\t\tpublic E setClientRegistry(final ClientRegistry clientRegistry) {\n-\t\t\tthis.clientRegistry = clientRegistry;\n-\t\t\treturn (E)this;\n-\t\t}\n+        public E setSecurityRegistry(final SecurityRegistry securityRegistry) {\n+            this.securityRegistry = securityRegistry;\n+            return (E) this;\n+        }\n \n-\t\tpublic E setObservationRegistry(final ObservationRegistry observationRegistry) {\n-\t\t\tthis.observationRegistry = observationRegistry;\n-\t\t\treturn (E) this;\n-\t\t}\n+        public E setObjectModelProvider(final LwM2mModelProvider objectModelProvider) {\n+            this.modelProvider = objectModelProvider;\n+            return (E) this;\n+        }\n \n-\t\tpublic E setSecurityRegistry(final SecurityRegistry securityRegistry) {\n-\t\t\tthis.securityRegistry = securityRegistry;\n-\t\t\treturn (E) this;\n-\t\t}\n+        public E setAddress(final String address) {\n+            this.address = address;\n+            return (E) this;\n+        }\n \n-\t\tpublic E setObjectModelProvider(final LwM2mModelProvider objectModelProvider) {\n-\t\t\tthis.modelProvider = objectModelProvider;\n-\t\t\treturn (E)this;\n-\t\t}\n-\n-\t\tpublic LeshanServer build() {\n-\t\t\tif (clientRegistry == null)\n-\t\t\t\tclientRegistry = new ClientRegistryImpl();\n-\t\t\tif (securityRegistry == null)\n-\t\t\t\tsecurityRegistry = new SecurityRegistryImpl();\n-\t\t\tif (observationRegistry == null)\n-\t\t\t\tobservationRegistry = new ObservationRegistryImpl();\n-\t\t\tif (modelProvider == null) \n-\t\t\t\tmodelProvider = new StandardModelProvider();\n+        public E setPort(final int port) {\n+            this.port = port;\n+            return (E) this;\n+        }\n \n-\t\t\tif(bindingModes.contains(BindingMode.Q) || bindingModes.contains(BindingMode.S)) {\n-\t\t\t\tLOG.info(\"Binding Modes Q and S are not supported in this verison, they will be omitted\");\n-\t\t\t}\n+        public E setConnectionStateListener(final ConnectionStateListener listener) {\n+            this.connectionStateListener = listener;\n+            return (E) this;\n+        }\n \n-\t\t\tfinal ConnectionConfig connectionConfig = buildConnectionConfig();\n+        public LeshanServer build() {\n+            if (clientRegistry == null)\n+                clientRegistry = new ClientRegistryImpl();\n+            if (securityRegistry == null)\n+                securityRegistry = new SecurityRegistryImpl();\n+            if (observationRegistry == null)\n+                observationRegistry = new ObservationRegistryImpl();\n+            if (modelProvider == null)\n+                modelProvider = new StandardModelProvider();\n \n-\t\t\treturn new LeshanServer(clientRegistry, securityRegistry, observationRegistry, modelProvider, connectionConfig);\n-\t\t}\n+            if (bindingModes.contains(BindingMode.Q) || bindingModes.contains(BindingMode.S)) {","path":"leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanServerBuilder.java","position":193,"original_position":193,"commit_id":"706837dd0de9ab8d6491bae09ab28873dd43e8e3","original_commit_id":"ec80355d5ff9b82653d9d729d9a5d45cb167d7d5","user":{"login":"jschloman","id":1894609,"avatar_url":"https://avatars.githubusercontent.com/u/1894609?v=3","gravatar_id":"","url":"https://api.github.com/users/jschloman","html_url":"https://github.com/jschloman","followers_url":"https://api.github.com/users/jschloman/followers","following_url":"https://api.github.com/users/jschloman/following{/other_user}","gists_url":"https://api.github.com/users/jschloman/gists{/gist_id}","starred_url":"https://api.github.com/users/jschloman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jschloman/subscriptions","organizations_url":"https://api.github.com/users/jschloman/orgs","repos_url":"https://api.github.com/users/jschloman/repos","events_url":"https://api.github.com/users/jschloman/events{/privacy}","received_events_url":"https://api.github.com/users/jschloman/received_events","type":"User","site_admin":false},"body":"I guess I'd prefer to keep it around as we will need to evolve this in the near future to support multiple binding modes a bit better.  It is also used for internal logic in the Leshan Server stack.","created_at":"2015-07-09T14:58:20Z","updated_at":"2015-07-09T14:58:20Z","html_url":"https://github.com/zatar-iot/leshan/pull/3#discussion_r34264203","pull_request_url":"https://api.github.com/repos/zatar-iot/leshan/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/zatar-iot/leshan/pulls/comments/34264203"},"html":{"href":"https://github.com/zatar-iot/leshan/pull/3#discussion_r34264203"},"pull_request":{"href":"https://api.github.com/repos/zatar-iot/leshan/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/zatar-iot/leshan/pulls/3","id":39589368,"html_url":"https://github.com/zatar-iot/leshan/pull/3","diff_url":"https://github.com/zatar-iot/leshan/pull/3.diff","patch_url":"https://github.com/zatar-iot/leshan/pull/3.patch","issue_url":"https://api.github.com/repos/zatar-iot/leshan/issues/3","number":3,"state":"open","locked":false,"title":"Connection Configuration from CAium rolled in.","user":{"login":"jschloman","id":1894609,"avatar_url":"https://avatars.githubusercontent.com/u/1894609?v=3","gravatar_id":"","url":"https://api.github.com/users/jschloman","html_url":"https://github.com/jschloman","followers_url":"https://api.github.com/users/jschloman/followers","following_url":"https://api.github.com/users/jschloman/following{/other_user}","gists_url":"https://api.github.com/users/jschloman/gists{/gist_id}","starred_url":"https://api.github.com/users/jschloman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jschloman/subscriptions","organizations_url":"https://api.github.com/users/jschloman/orgs","repos_url":"https://api.github.com/users/jschloman/repos","events_url":"https://api.github.com/users/jschloman/events{/privacy}","received_events_url":"https://api.github.com/users/jschloman/received_events","type":"User","site_admin":false},"body":"This PR now uses Louis' new stuff from CAium and E-C.  All of the build logic is outside of the LeshanServer and LeshanClient.  The only tests that fail are the DTLS ones.","created_at":"2015-07-09T14:32:20Z","updated_at":"2015-07-09T14:58:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ed955e00178d2c493ac0497c32b80db1065c21fb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zatar-iot/leshan/pulls/3/commits","review_comments_url":"https://api.github.com/repos/zatar-iot/leshan/pulls/3/comments","review_comment_url":"https://api.github.com/repos/zatar-iot/leshan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zatar-iot/leshan/issues/3/comments","statuses_url":"https://api.github.com/repos/zatar-iot/leshan/statuses/706837dd0de9ab8d6491bae09ab28873dd43e8e3","head":{"label":"zatar-iot:configure_example","ref":"configure_example","sha":"706837dd0de9ab8d6491bae09ab28873dd43e8e3","user":{"login":"zatar-iot","id":7365347,"avatar_url":"https://avatars.githubusercontent.com/u/7365347?v=3","gravatar_id":"","url":"https://api.github.com/users/zatar-iot","html_url":"https://github.com/zatar-iot","followers_url":"https://api.github.com/users/zatar-iot/followers","following_url":"https://api.github.com/users/zatar-iot/following{/other_user}","gists_url":"https://api.github.com/users/zatar-iot/gists{/gist_id}","starred_url":"https://api.github.com/users/zatar-iot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zatar-iot/subscriptions","organizations_url":"https://api.github.com/users/zatar-iot/orgs","repos_url":"https://api.github.com/users/zatar-iot/repos","events_url":"https://api.github.com/users/zatar-iot/events{/privacy}","received_events_url":"https://api.github.com/users/zatar-iot/received_events","type":"Organization","site_admin":false},"repo":{"id":35633093,"name":"leshan","full_name":"zatar-iot/leshan","owner":{"login":"zatar-iot","id":7365347,"avatar_url":"https://avatars.githubusercontent.com/u/7365347?v=3","gravatar_id":"","url":"https://api.github.com/users/zatar-iot","html_url":"https://github.com/zatar-iot","followers_url":"https://api.github.com/users/zatar-iot/followers","following_url":"https://api.github.com/users/zatar-iot/following{/other_user}","gists_url":"https://api.github.com/users/zatar-iot/gists{/gist_id}","starred_url":"https://api.github.com/users/zatar-iot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zatar-iot/subscriptions","organizations_url":"https://api.github.com/users/zatar-iot/orgs","repos_url":"https://api.github.com/users/zatar-iot/repos","events_url":"https://api.github.com/users/zatar-iot/events{/privacy}","received_events_url":"https://api.github.com/users/zatar-iot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zatar-iot/leshan","description":"Leshan is an OMA Lightweight M2M (LWM2M) implementation in Java.","fork":true,"url":"https://api.github.com/repos/zatar-iot/leshan","forks_url":"https://api.github.com/repos/zatar-iot/leshan/forks","keys_url":"https://api.github.com/repos/zatar-iot/leshan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zatar-iot/leshan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zatar-iot/leshan/teams","hooks_url":"https://api.github.com/repos/zatar-iot/leshan/hooks","issue_events_url":"https://api.github.com/repos/zatar-iot/leshan/issues/events{/number}","events_url":"https://api.github.com/repos/zatar-iot/leshan/events","assignees_url":"https://api.github.com/repos/zatar-iot/leshan/assignees{/user}","branches_url":"https://api.github.com/repos/zatar-iot/leshan/branches{/branch}","tags_url":"https://api.github.com/repos/zatar-iot/leshan/tags","blobs_url":"https://api.github.com/repos/zatar-iot/leshan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zatar-iot/leshan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zatar-iot/leshan/git/refs{/sha}","trees_url":"https://api.github.com/repos/zatar-iot/leshan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zatar-iot/leshan/statuses/{sha}","languages_url":"https://api.github.com/repos/zatar-iot/leshan/languages","stargazers_url":"https://api.github.com/repos/zatar-iot/leshan/stargazers","contributors_url":"https://api.github.com/repos/zatar-iot/leshan/contributors","subscribers_url":"https://api.github.com/repos/zatar-iot/leshan/subscribers","subscription_url":"https://api.github.com/repos/zatar-iot/leshan/subscription","commits_url":"https://api.github.com/repos/zatar-iot/leshan/commits{/sha}","git_commits_url":"https://api.github.com/repos/zatar-iot/leshan/git/commits{/sha}","comments_url":"https://api.github.com/repos/zatar-iot/leshan/comments{/number}","issue_comment_url":"https://api.github.com/repos/zatar-iot/leshan/issues/comments{/number}","contents_url":"https://api.github.com/repos/zatar-iot/leshan/contents/{+path}","compare_url":"https://api.github.com/repos/zatar-iot/leshan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zatar-iot/leshan/merges","archive_url":"https://api.github.com/repos/zatar-iot/leshan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zatar-iot/leshan/downloads","issues_url":"https://api.github.com/repos/zatar-iot/leshan/issues{/number}","pulls_url":"https://api.github.com/repos/zatar-iot/leshan/pulls{/number}","milestones_url":"https://api.github.com/repos/zatar-iot/leshan/milestones{/number}","notifications_url":"https://api.github.com/repos/zatar-iot/leshan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zatar-iot/leshan/labels{/name}","releases_url":"https://api.github.com/repos/zatar-iot/leshan/releases{/id}","created_at":"2015-05-14T19:49:08Z","updated_at":"2015-05-14T19:49:09Z","pushed_at":"2015-07-09T14:56:12Z","git_url":"git://github.com/zatar-iot/leshan.git","ssh_url":"git@github.com:zatar-iot/leshan.git","clone_url":"https://github.com/zatar-iot/leshan.git","svn_url":"https://github.com/zatar-iot/leshan","homepage":null,"size":1487,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"zatar-iot:impl_tls","ref":"impl_tls","sha":"7cf3968f9c3761be5161fc56883532293f3484bd","user":{"login":"zatar-iot","id":7365347,"avatar_url":"https://avatars.githubusercontent.com/u/7365347?v=3","gravatar_id":"","url":"https://api.github.com/users/zatar-iot","html_url":"https://github.com/zatar-iot","followers_url":"https://api.github.com/users/zatar-iot/followers","following_url":"https://api.github.com/users/zatar-iot/following{/other_user}","gists_url":"https://api.github.com/users/zatar-iot/gists{/gist_id}","starred_url":"https://api.github.com/users/zatar-iot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zatar-iot/subscriptions","organizations_url":"https://api.github.com/users/zatar-iot/orgs","repos_url":"https://api.github.com/users/zatar-iot/repos","events_url":"https://api.github.com/users/zatar-iot/events{/privacy}","received_events_url":"https://api.github.com/users/zatar-iot/received_events","type":"Organization","site_admin":false},"repo":{"id":35633093,"name":"leshan","full_name":"zatar-iot/leshan","owner":{"login":"zatar-iot","id":7365347,"avatar_url":"https://avatars.githubusercontent.com/u/7365347?v=3","gravatar_id":"","url":"https://api.github.com/users/zatar-iot","html_url":"https://github.com/zatar-iot","followers_url":"https://api.github.com/users/zatar-iot/followers","following_url":"https://api.github.com/users/zatar-iot/following{/other_user}","gists_url":"https://api.github.com/users/zatar-iot/gists{/gist_id}","starred_url":"https://api.github.com/users/zatar-iot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zatar-iot/subscriptions","organizations_url":"https://api.github.com/users/zatar-iot/orgs","repos_url":"https://api.github.com/users/zatar-iot/repos","events_url":"https://api.github.com/users/zatar-iot/events{/privacy}","received_events_url":"https://api.github.com/users/zatar-iot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zatar-iot/leshan","description":"Leshan is an OMA Lightweight M2M (LWM2M) implementation in Java.","fork":true,"url":"https://api.github.com/repos/zatar-iot/leshan","forks_url":"https://api.github.com/repos/zatar-iot/leshan/forks","keys_url":"https://api.github.com/repos/zatar-iot/leshan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zatar-iot/leshan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zatar-iot/leshan/teams","hooks_url":"https://api.github.com/repos/zatar-iot/leshan/hooks","issue_events_url":"https://api.github.com/repos/zatar-iot/leshan/issues/events{/number}","events_url":"https://api.github.com/repos/zatar-iot/leshan/events","assignees_url":"https://api.github.com/repos/zatar-iot/leshan/assignees{/user}","branches_url":"https://api.github.com/repos/zatar-iot/leshan/branches{/branch}","tags_url":"https://api.github.com/repos/zatar-iot/leshan/tags","blobs_url":"https://api.github.com/repos/zatar-iot/leshan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zatar-iot/leshan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zatar-iot/leshan/git/refs{/sha}","trees_url":"https://api.github.com/repos/zatar-iot/leshan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zatar-iot/leshan/statuses/{sha}","languages_url":"https://api.github.com/repos/zatar-iot/leshan/languages","stargazers_url":"https://api.github.com/repos/zatar-iot/leshan/stargazers","contributors_url":"https://api.github.com/repos/zatar-iot/leshan/contributors","subscribers_url":"https://api.github.com/repos/zatar-iot/leshan/subscribers","subscription_url":"https://api.github.com/repos/zatar-iot/leshan/subscription","commits_url":"https://api.github.com/repos/zatar-iot/leshan/commits{/sha}","git_commits_url":"https://api.github.com/repos/zatar-iot/leshan/git/commits{/sha}","comments_url":"https://api.github.com/repos/zatar-iot/leshan/comments{/number}","issue_comment_url":"https://api.github.com/repos/zatar-iot/leshan/issues/comments{/number}","contents_url":"https://api.github.com/repos/zatar-iot/leshan/contents/{+path}","compare_url":"https://api.github.com/repos/zatar-iot/leshan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zatar-iot/leshan/merges","archive_url":"https://api.github.com/repos/zatar-iot/leshan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zatar-iot/leshan/downloads","issues_url":"https://api.github.com/repos/zatar-iot/leshan/issues{/number}","pulls_url":"https://api.github.com/repos/zatar-iot/leshan/pulls{/number}","milestones_url":"https://api.github.com/repos/zatar-iot/leshan/milestones{/number}","notifications_url":"https://api.github.com/repos/zatar-iot/leshan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zatar-iot/leshan/labels{/name}","releases_url":"https://api.github.com/repos/zatar-iot/leshan/releases{/id}","created_at":"2015-05-14T19:49:08Z","updated_at":"2015-05-14T19:49:09Z","pushed_at":"2015-07-09T14:56:12Z","git_url":"git://github.com/zatar-iot/leshan.git","ssh_url":"git@github.com:zatar-iot/leshan.git","clone_url":"https://github.com/zatar-iot/leshan.git","svn_url":"https://github.com/zatar-iot/leshan","homepage":null,"size":1487,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zatar-iot/leshan/pulls/3"},"html":{"href":"https://github.com/zatar-iot/leshan/pull/3"},"issue":{"href":"https://api.github.com/repos/zatar-iot/leshan/issues/3"},"comments":{"href":"https://api.github.com/repos/zatar-iot/leshan/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/zatar-iot/leshan/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/zatar-iot/leshan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zatar-iot/leshan/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/zatar-iot/leshan/statuses/706837dd0de9ab8d6491bae09ab28873dd43e8e3"}}}}