{"action":"created","comment":{"url":"https://api.github.com/repos/OpenNMS/opennms/pulls/comments/31613849","id":31613849,"diff_hunk":"@@ -0,0 +1,254 @@\n+/*\n+* OCA CONTRIBUTION ACKNOWLEDGEMENT - NOT PART OF LEGAL BOILERPLATE\n+* DO NOT DUPLICATE THIS COMMENT BLOCK WHEN CREATING NEW FILES!\n+*\n+* This file was contributed to the OpenNMS(R) project under the\n+* terms of the OpenNMS Contributor Agreement (OCA).  For details on\n+* the OCA, see http://www.opennms.org/index.php/Contributor_Agreement\n+*\n+* Contributed under the terms of the OCA by:\n+*\n+* Bobby Krupczak <rdk@krupczak.org>\n+* THE KRUPCZAK ORGANIZATION, LLC\n+* http://www.krupczak.org/\n+*/\n+\n+/**\n+ * OpenNMS XMP Detector allows for discovery of service/protocols via \n+ * provisiond.  Our detector is pretty simple right now.  All it does is\n+ * attempt to establish an XmpSession with a system and if it succeeds,\n+ * it queries a few core MIB variables and returns success.\n+ * Future enhancements could include more capability information like\n+ * supported MIBs, modules/plugins, and various dependencies to\n+ * determine if something is a server for some service (noted by an\n+ * inbound dependency relationship).\n+ */\n+\n+package org.opennms.protocols.xmp.detector;\n+\n+import java.net.InetAddress;\n+import java.util.Date;\n+import org.opennms.netmgt.provision.support.BasicDetector;\n+import org.opennms.netmgt.provision.support.AbstractDetector;\n+import org.opennms.netmgt.provision.ServiceDetector;\n+import org.opennms.netmgt.provision.SyncServiceDetector;\n+import org.krupczak.xmp.*;\n+import org.opennms.netmgt.config.xmpConfig.XmpConfig;    \n+import org.opennms.netmgt.protocols.xmp.config.XmpConfigFactory;\n+import org.opennms.netmgt.protocols.xmp.collector.XmpCollector;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import org.springframework.context.annotation.Scope;\n+import org.springframework.stereotype.Component;\n+\n+@Component\n+/**\n+ * XmpDetector class\n+ * @author rdk <rdk@krupczak.org>\n+ * @version $Id: $\n+ *\n+ */\n+@Scope(\"prototype\")\n+public class XmpDetector implements SyncServiceDetector\n+{\n+    // class variables\n+\n+    private static final String DEFAULT_SERVICE_NAME = \"XMP\";\n+    private static final Logger LOG = LoggerFactory.getLogger(XmpDetector.class);\n+    private static int XMP_DEFAULT_TIMEOUT = 3000;\n+    private static int XMP_DEFAULT_RETRIES = 1;\n+    \n+    // instance variables\n+    SocketOpts sockopts;\n+    XmpConfig protoConfig;\n+    int xmpPort;\n+    int xmpTimeout;\n+    int xmpRetries;\n+    String xmpAuthenUser;\n+    String xmpServiceName; \n+    String m_ipMatch;\n+    Date createTimeDate;\n+\n+    /* \n+     * @param serviceName a {@link java.lang.String} object\n+     * @param port an int specifying tcp port number\n+     */\n+    \n+    public XmpDetector(String serviceName, int port)\n+    {\n+\t//super(serviceName,port,XMP_DEFAULT_TIMEOUT,XMP_DEFAULT_RETRIES);\n+\t\n+        // set default config\n+        xmpPort = port;\n+        xmpAuthenUser = new String(\"xmpUser\"); ","path":"protocols/xmp/src/main/java/org/opennms/netmgt/protocols/xmp/detector/XmpDetector.java","position":83,"original_position":83,"commit_id":"d97574d7bc419291a7556ffe62946e88e17d2f49","original_commit_id":"d97574d7bc419291a7556ffe62946e88e17d2f49","user":{"login":"mvrueden","id":4202259,"avatar_url":"https://avatars.githubusercontent.com/u/4202259?v=3","gravatar_id":"","url":"https://api.github.com/users/mvrueden","html_url":"https://github.com/mvrueden","followers_url":"https://api.github.com/users/mvrueden/followers","following_url":"https://api.github.com/users/mvrueden/following{/other_user}","gists_url":"https://api.github.com/users/mvrueden/gists{/gist_id}","starred_url":"https://api.github.com/users/mvrueden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvrueden/subscriptions","organizations_url":"https://api.github.com/users/mvrueden/orgs","repos_url":"https://api.github.com/users/mvrueden/repos","events_url":"https://api.github.com/users/mvrueden/events{/privacy}","received_events_url":"https://api.github.com/users/mvrueden/received_events","type":"User","site_admin":false},"body":"Please create a static member for the default authenticated user. \r\nPlease do not create a String using `new String(\"...\")` Simply use `\"...\"`.","created_at":"2015-06-03T11:30:28Z","updated_at":"2015-06-03T11:30:28Z","html_url":"https://github.com/OpenNMS/opennms/pull/215#discussion_r31613849","pull_request_url":"https://api.github.com/repos/OpenNMS/opennms/pulls/215","_links":{"self":{"href":"https://api.github.com/repos/OpenNMS/opennms/pulls/comments/31613849"},"html":{"href":"https://github.com/OpenNMS/opennms/pull/215#discussion_r31613849"},"pull_request":{"href":"https://api.github.com/repos/OpenNMS/opennms/pulls/215"}}},"pull_request":{"url":"https://api.github.com/repos/OpenNMS/opennms/pulls/215","id":28318818,"html_url":"https://github.com/OpenNMS/opennms/pull/215","diff_url":"https://github.com/OpenNMS/opennms/pull/215.diff","patch_url":"https://github.com/OpenNMS/opennms/pull/215.patch","issue_url":"https://api.github.com/repos/OpenNMS/opennms/issues/215","number":215,"state":"open","locked":false,"title":"NMS-7404: Create a detector for XMP","user":{"login":"rdkgit","id":3226880,"avatar_url":"https://avatars.githubusercontent.com/u/3226880?v=3","gravatar_id":"","url":"https://api.github.com/users/rdkgit","html_url":"https://github.com/rdkgit","followers_url":"https://api.github.com/users/rdkgit/followers","following_url":"https://api.github.com/users/rdkgit/following{/other_user}","gists_url":"https://api.github.com/users/rdkgit/gists{/gist_id}","starred_url":"https://api.github.com/users/rdkgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdkgit/subscriptions","organizations_url":"https://api.github.com/users/rdkgit/orgs","repos_url":"https://api.github.com/users/rdkgit/repos","events_url":"https://api.github.com/users/rdkgit/events{/privacy}","received_events_url":"https://api.github.com/users/rdkgit/received_events","type":"User","site_admin":false},"body":"XmpDetector and associated config files for adding detector to ONMS xmp protocol jar.\r\n\r\nJIRA: http://issues.opennms.org/browse/NMS-7404\r\nReference to XMP: http://www.opennms.org/wiki/XMP\r\n\r\nTodo:\r\n- [x] OCA signed\r\n- [ ] Code review\r\n- [ ] Pass unit tests\r\n- [ ] Documentation\r\n- [ ] Merge to develop and close JIRA issue","created_at":"2015-01-29T22:00:06Z","updated_at":"2015-06-03T11:30:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db07698fa98542be2e258f7b83d8dd436dbe7dab","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OpenNMS/opennms/pulls/215/commits","review_comments_url":"https://api.github.com/repos/OpenNMS/opennms/pulls/215/comments","review_comment_url":"https://api.github.com/repos/OpenNMS/opennms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenNMS/opennms/issues/215/comments","statuses_url":"https://api.github.com/repos/OpenNMS/opennms/statuses/d97574d7bc419291a7556ffe62946e88e17d2f49","head":{"label":"rdkgit:XmpDetector","ref":"XmpDetector","sha":"d97574d7bc419291a7556ffe62946e88e17d2f49","user":{"login":"rdkgit","id":3226880,"avatar_url":"https://avatars.githubusercontent.com/u/3226880?v=3","gravatar_id":"","url":"https://api.github.com/users/rdkgit","html_url":"https://github.com/rdkgit","followers_url":"https://api.github.com/users/rdkgit/followers","following_url":"https://api.github.com/users/rdkgit/following{/other_user}","gists_url":"https://api.github.com/users/rdkgit/gists{/gist_id}","starred_url":"https://api.github.com/users/rdkgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdkgit/subscriptions","organizations_url":"https://api.github.com/users/rdkgit/orgs","repos_url":"https://api.github.com/users/rdkgit/repos","events_url":"https://api.github.com/users/rdkgit/events{/privacy}","received_events_url":"https://api.github.com/users/rdkgit/received_events","type":"User","site_admin":false},"repo":{"id":28884212,"name":"opennms","full_name":"rdkgit/opennms","owner":{"login":"rdkgit","id":3226880,"avatar_url":"https://avatars.githubusercontent.com/u/3226880?v=3","gravatar_id":"","url":"https://api.github.com/users/rdkgit","html_url":"https://github.com/rdkgit","followers_url":"https://api.github.com/users/rdkgit/followers","following_url":"https://api.github.com/users/rdkgit/following{/other_user}","gists_url":"https://api.github.com/users/rdkgit/gists{/gist_id}","starred_url":"https://api.github.com/users/rdkgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdkgit/subscriptions","organizations_url":"https://api.github.com/users/rdkgit/orgs","repos_url":"https://api.github.com/users/rdkgit/repos","events_url":"https://api.github.com/users/rdkgit/events{/privacy}","received_events_url":"https://api.github.com/users/rdkgit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rdkgit/opennms","description":"","fork":true,"url":"https://api.github.com/repos/rdkgit/opennms","forks_url":"https://api.github.com/repos/rdkgit/opennms/forks","keys_url":"https://api.github.com/repos/rdkgit/opennms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rdkgit/opennms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rdkgit/opennms/teams","hooks_url":"https://api.github.com/repos/rdkgit/opennms/hooks","issue_events_url":"https://api.github.com/repos/rdkgit/opennms/issues/events{/number}","events_url":"https://api.github.com/repos/rdkgit/opennms/events","assignees_url":"https://api.github.com/repos/rdkgit/opennms/assignees{/user}","branches_url":"https://api.github.com/repos/rdkgit/opennms/branches{/branch}","tags_url":"https://api.github.com/repos/rdkgit/opennms/tags","blobs_url":"https://api.github.com/repos/rdkgit/opennms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rdkgit/opennms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rdkgit/opennms/git/refs{/sha}","trees_url":"https://api.github.com/repos/rdkgit/opennms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rdkgit/opennms/statuses/{sha}","languages_url":"https://api.github.com/repos/rdkgit/opennms/languages","stargazers_url":"https://api.github.com/repos/rdkgit/opennms/stargazers","contributors_url":"https://api.github.com/repos/rdkgit/opennms/contributors","subscribers_url":"https://api.github.com/repos/rdkgit/opennms/subscribers","subscription_url":"https://api.github.com/repos/rdkgit/opennms/subscription","commits_url":"https://api.github.com/repos/rdkgit/opennms/commits{/sha}","git_commits_url":"https://api.github.com/repos/rdkgit/opennms/git/commits{/sha}","comments_url":"https://api.github.com/repos/rdkgit/opennms/comments{/number}","issue_comment_url":"https://api.github.com/repos/rdkgit/opennms/issues/comments{/number}","contents_url":"https://api.github.com/repos/rdkgit/opennms/contents/{+path}","compare_url":"https://api.github.com/repos/rdkgit/opennms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rdkgit/opennms/merges","archive_url":"https://api.github.com/repos/rdkgit/opennms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rdkgit/opennms/downloads","issues_url":"https://api.github.com/repos/rdkgit/opennms/issues{/number}","pulls_url":"https://api.github.com/repos/rdkgit/opennms/pulls{/number}","milestones_url":"https://api.github.com/repos/rdkgit/opennms/milestones{/number}","notifications_url":"https://api.github.com/repos/rdkgit/opennms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rdkgit/opennms/labels{/name}","releases_url":"https://api.github.com/repos/rdkgit/opennms/releases{/id}","created_at":"2015-01-06T21:22:43Z","updated_at":"2015-01-31T15:43:20Z","pushed_at":"2015-01-31T21:36:52Z","git_url":"git://github.com/rdkgit/opennms.git","ssh_url":"git@github.com:rdkgit/opennms.git","clone_url":"https://github.com/rdkgit/opennms.git","svn_url":"https://github.com/rdkgit/opennms","homepage":"http://www.opennms.org/","size":374684,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"develop"}},"base":{"label":"OpenNMS:develop","ref":"develop","sha":"397ad6402965a971b41d8a8d4ceb76deed0e4331","user":{"login":"OpenNMS","id":2972482,"avatar_url":"https://avatars.githubusercontent.com/u/2972482?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenNMS","html_url":"https://github.com/OpenNMS","followers_url":"https://api.github.com/users/OpenNMS/followers","following_url":"https://api.github.com/users/OpenNMS/following{/other_user}","gists_url":"https://api.github.com/users/OpenNMS/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenNMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenNMS/subscriptions","organizations_url":"https://api.github.com/users/OpenNMS/orgs","repos_url":"https://api.github.com/users/OpenNMS/repos","events_url":"https://api.github.com/users/OpenNMS/events{/privacy}","received_events_url":"https://api.github.com/users/OpenNMS/received_events","type":"Organization","site_admin":false},"repo":{"id":9377198,"name":"opennms","full_name":"OpenNMS/opennms","owner":{"login":"OpenNMS","id":2972482,"avatar_url":"https://avatars.githubusercontent.com/u/2972482?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenNMS","html_url":"https://github.com/OpenNMS","followers_url":"https://api.github.com/users/OpenNMS/followers","following_url":"https://api.github.com/users/OpenNMS/following{/other_user}","gists_url":"https://api.github.com/users/OpenNMS/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenNMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenNMS/subscriptions","organizations_url":"https://api.github.com/users/OpenNMS/orgs","repos_url":"https://api.github.com/users/OpenNMS/repos","events_url":"https://api.github.com/users/OpenNMS/events{/privacy}","received_events_url":"https://api.github.com/users/OpenNMS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenNMS/opennms","description":"","fork":false,"url":"https://api.github.com/repos/OpenNMS/opennms","forks_url":"https://api.github.com/repos/OpenNMS/opennms/forks","keys_url":"https://api.github.com/repos/OpenNMS/opennms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenNMS/opennms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenNMS/opennms/teams","hooks_url":"https://api.github.com/repos/OpenNMS/opennms/hooks","issue_events_url":"https://api.github.com/repos/OpenNMS/opennms/issues/events{/number}","events_url":"https://api.github.com/repos/OpenNMS/opennms/events","assignees_url":"https://api.github.com/repos/OpenNMS/opennms/assignees{/user}","branches_url":"https://api.github.com/repos/OpenNMS/opennms/branches{/branch}","tags_url":"https://api.github.com/repos/OpenNMS/opennms/tags","blobs_url":"https://api.github.com/repos/OpenNMS/opennms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenNMS/opennms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenNMS/opennms/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenNMS/opennms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenNMS/opennms/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenNMS/opennms/languages","stargazers_url":"https://api.github.com/repos/OpenNMS/opennms/stargazers","contributors_url":"https://api.github.com/repos/OpenNMS/opennms/contributors","subscribers_url":"https://api.github.com/repos/OpenNMS/opennms/subscribers","subscription_url":"https://api.github.com/repos/OpenNMS/opennms/subscription","commits_url":"https://api.github.com/repos/OpenNMS/opennms/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenNMS/opennms/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenNMS/opennms/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenNMS/opennms/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenNMS/opennms/contents/{+path}","compare_url":"https://api.github.com/repos/OpenNMS/opennms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenNMS/opennms/merges","archive_url":"https://api.github.com/repos/OpenNMS/opennms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenNMS/opennms/downloads","issues_url":"https://api.github.com/repos/OpenNMS/opennms/issues{/number}","pulls_url":"https://api.github.com/repos/OpenNMS/opennms/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenNMS/opennms/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenNMS/opennms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenNMS/opennms/labels{/name}","releases_url":"https://api.github.com/repos/OpenNMS/opennms/releases{/id}","created_at":"2013-04-11T18:22:33Z","updated_at":"2015-06-03T07:41:34Z","pushed_at":"2015-06-03T10:32:04Z","git_url":"git://github.com/OpenNMS/opennms.git","ssh_url":"git@github.com:OpenNMS/opennms.git","clone_url":"https://github.com/OpenNMS/opennms.git","svn_url":"https://github.com/OpenNMS/opennms","homepage":"http://www.opennms.org/","size":1030667,"stargazers_count":88,"watchers_count":88,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":186,"mirror_url":null,"open_issues_count":18,"forks":186,"open_issues":18,"watchers":88,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenNMS/opennms/pulls/215"},"html":{"href":"https://github.com/OpenNMS/opennms/pull/215"},"issue":{"href":"https://api.github.com/repos/OpenNMS/opennms/issues/215"},"comments":{"href":"https://api.github.com/repos/OpenNMS/opennms/issues/215/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenNMS/opennms/pulls/215/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenNMS/opennms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenNMS/opennms/pulls/215/commits"},"statuses":{"href":"https://api.github.com/repos/OpenNMS/opennms/statuses/d97574d7bc419291a7556ffe62946e88e17d2f49"}}}}