{"action":"created","comment":{"url":"https://api.github.com/repos/wildfly/wildfly/pulls/comments/35706696","id":35706696,"diff_hunk":"@@ -0,0 +1,110 @@\n+/*\n+ * JBoss, Home of Professional Open Source.\n+ * Copyright 2015, Red Hat, Inc., and individual contributors\n+ * as indicated by the @author tags. See the copyright.txt file in the\n+ * distribution for a full listing of individual contributors.\n+ *\n+ * This is free software; you can redistribute it and/or modify it\n+ * under the terms of the GNU Lesser General Public License as\n+ * published by the Free Software Foundation; either version 2.1 of\n+ * the License, or (at your option) any later version.\n+ *\n+ * This software is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ * Lesser General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public\n+ * License along with this software; if not, write to the Free\n+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n+ */\n+\n+package org.wildfly.extension.clustering.singleton;\n+\n+import org.jboss.as.clustering.controller.CapabilityReference;\n+import org.jboss.as.clustering.controller.RequiredCapability;\n+import org.jboss.as.clustering.controller.Registration;\n+import org.jboss.as.clustering.controller.ReloadRequiredWriteAttributeHandler;\n+import org.jboss.as.controller.AttributeDefinition;\n+import org.jboss.as.controller.CapabilityReferenceRecorder;\n+import org.jboss.as.controller.PathAddress;\n+import org.jboss.as.controller.PathElement;\n+import org.jboss.as.controller.SimpleResourceDefinition;\n+import org.jboss.as.controller.StringListAttributeDefinition;\n+import org.jboss.as.controller.capability.RuntimeCapability;\n+import org.jboss.as.controller.descriptions.ResourceDescriptionResolver;\n+import org.jboss.as.controller.registry.ManagementResourceRegistration;\n+import org.jboss.as.network.OutboundSocketBinding;\n+\n+/**\n+ * Definition of an election policy resource.\n+ * @author Paul Ferraro\n+ */\n+public class ElectionPolicyResourceDefinition extends SimpleResourceDefinition implements Registration {\n+\n+    static final PathElement WILDCARD_PATH = pathElement(PathElement.WILDCARD_VALUE);\n+\n+    static PathElement pathElement(String value) {\n+        return PathElement.pathElement(\"election-policy\", value);\n+    }\n+\n+    enum Capability implements org.jboss.as.clustering.controller.Capability {\n+        SOCKET_BINDING_PREFERENCE(\"org.wildfly.clustering.singleton-deployer.deployment-policy.election-policy.socket-binding-preference\", OutboundSocketBinding.class),\n+        ;\n+        private final RuntimeCapability<Void> definition;\n+\n+        Capability(String name, Class<?> serviceType) {\n+            this.definition = RuntimeCapability.Builder.of(name, true).setServiceType(serviceType).build();\n+        }\n+\n+        @Override\n+        public RuntimeCapability<Void> getDefinition() {\n+            return this.definition;\n+        }\n+\n+        @Override\n+        public RuntimeCapability<Void> getRuntimeCapability(PathAddress address) {\n+            return this.definition.fromBaseCapability(address.getParent().getLastElement().getValue());","path":"clustering/singleton/extension/src/main/java/org/wildfly/extension/clustering/singleton/ElectionPolicyResourceDefinition.java","position":68,"original_position":68,"commit_id":"092ca0f7f053324d935638ebe8f791b385762fad","original_commit_id":"092ca0f7f053324d935638ebe8f791b385762fad","user":{"login":"pferraro","id":352192,"avatar_url":"https://avatars.githubusercontent.com/u/352192?v=3","gravatar_id":"","url":"https://api.github.com/users/pferraro","html_url":"https://github.com/pferraro","followers_url":"https://api.github.com/users/pferraro/followers","following_url":"https://api.github.com/users/pferraro/following{/other_user}","gists_url":"https://api.github.com/users/pferraro/gists{/gist_id}","starred_url":"https://api.github.com/users/pferraro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pferraro/subscriptions","organizations_url":"https://api.github.com/users/pferraro/orgs","repos_url":"https://api.github.com/users/pferraro/repos","events_url":"https://api.github.com/users/pferraro/events{/privacy}","received_events_url":"https://api.github.com/users/pferraro/received_events","type":"User","site_admin":false},"body":"I don't understand what you mean.\r\nThe point of this method is to encapsulate how a fully-qualified capability name is generated from the PathAddress of an operation (instead of having to specify this same behavior in 2 places, i.e. the add operation handler and the CapabilityReferenceRecorder).  In both instances, the address argument to this method is already the result of OperationContext.getCurrentAddress();","created_at":"2015-07-28T21:57:52Z","updated_at":"2015-07-28T21:57:52Z","html_url":"https://github.com/wildfly/wildfly/pull/7783#discussion_r35706696","pull_request_url":"https://api.github.com/repos/wildfly/wildfly/pulls/7783","_links":{"self":{"href":"https://api.github.com/repos/wildfly/wildfly/pulls/comments/35706696"},"html":{"href":"https://github.com/wildfly/wildfly/pull/7783#discussion_r35706696"},"pull_request":{"href":"https://api.github.com/repos/wildfly/wildfly/pulls/7783"}}},"pull_request":{"url":"https://api.github.com/repos/wildfly/wildfly/pulls/7783","id":40237006,"html_url":"https://github.com/wildfly/wildfly/pull/7783","diff_url":"https://github.com/wildfly/wildfly/pull/7783.diff","patch_url":"https://github.com/wildfly/wildfly/pull/7783.patch","issue_url":"https://api.github.com/repos/wildfly/wildfly/issues/7783","number":7783,"state":"open","locked":false,"title":"WFLY-334 HA Singleton deployments","user":{"login":"pferraro","id":352192,"avatar_url":"https://avatars.githubusercontent.com/u/352192?v=3","gravatar_id":"","url":"https://api.github.com/users/pferraro","html_url":"https://github.com/pferraro","followers_url":"https://api.github.com/users/pferraro/followers","following_url":"https://api.github.com/users/pferraro/following{/other_user}","gists_url":"https://api.github.com/users/pferraro/gists{/gist_id}","starred_url":"https://api.github.com/users/pferraro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pferraro/subscriptions","organizations_url":"https://api.github.com/users/pferraro/orgs","repos_url":"https://api.github.com/users/pferraro/repos","events_url":"https://api.github.com/users/pferraro/events{/privacy}","received_events_url":"https://api.github.com/users/pferraro/received_events","type":"User","site_admin":false},"body":"https://issues.jboss.org/browse/WFLY-334\r\n\r\nFinally.\r\n\r\nThis PR introduces a new subsystem for defining singleton deployment policies.  The new subsystem includes 4 DUPs:\r\n 1. A JBossAllXmlParserRegisteringProcessor for parsing the singleton-deployment namespace within jboss-all.xml\r\n 1. A SingletonDeploymentParsingProcessor for parsing a standalone singleton-deployment.xml deployment descriptor.  Users can use this to overlay singleton behavior to an existing deployment archive.\r\n 1. A SingletonDeploymentDependencyProcessor that adds a dependency to the deployment on a configured deployment policy\r\n 1. A SingletonDeploymentProcessor that attaches a DeploymentUnitPhaseServiceBuilder to the deployment phase context - that will install the next phase as a singleton service\r\n\r\nThis PR also introduces some abstractions for dealing with capabilities, specifically to define how a capability name is resolved against a PathAddress, such that this behavior only needs to be defined once.","created_at":"2015-07-17T14:35:14Z","updated_at":"2015-07-28T21:57:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e324b77f1b0e76bab7b62d8bcf7be1830678928","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wildfly/wildfly/pulls/7783/commits","review_comments_url":"https://api.github.com/repos/wildfly/wildfly/pulls/7783/comments","review_comment_url":"https://api.github.com/repos/wildfly/wildfly/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wildfly/wildfly/issues/7783/comments","statuses_url":"https://api.github.com/repos/wildfly/wildfly/statuses/092ca0f7f053324d935638ebe8f791b385762fad","head":{"label":"pferraro:singleton","ref":"singleton","sha":"092ca0f7f053324d935638ebe8f791b385762fad","user":{"login":"pferraro","id":352192,"avatar_url":"https://avatars.githubusercontent.com/u/352192?v=3","gravatar_id":"","url":"https://api.github.com/users/pferraro","html_url":"https://github.com/pferraro","followers_url":"https://api.github.com/users/pferraro/followers","following_url":"https://api.github.com/users/pferraro/following{/other_user}","gists_url":"https://api.github.com/users/pferraro/gists{/gist_id}","starred_url":"https://api.github.com/users/pferraro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pferraro/subscriptions","organizations_url":"https://api.github.com/users/pferraro/orgs","repos_url":"https://api.github.com/users/pferraro/repos","events_url":"https://api.github.com/users/pferraro/events{/privacy}","received_events_url":"https://api.github.com/users/pferraro/received_events","type":"User","site_admin":false},"repo":{"id":1920890,"name":"wildfly","full_name":"pferraro/wildfly","owner":{"login":"pferraro","id":352192,"avatar_url":"https://avatars.githubusercontent.com/u/352192?v=3","gravatar_id":"","url":"https://api.github.com/users/pferraro","html_url":"https://github.com/pferraro","followers_url":"https://api.github.com/users/pferraro/followers","following_url":"https://api.github.com/users/pferraro/following{/other_user}","gists_url":"https://api.github.com/users/pferraro/gists{/gist_id}","starred_url":"https://api.github.com/users/pferraro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pferraro/subscriptions","organizations_url":"https://api.github.com/users/pferraro/orgs","repos_url":"https://api.github.com/users/pferraro/repos","events_url":"https://api.github.com/users/pferraro/events{/privacy}","received_events_url":"https://api.github.com/users/pferraro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pferraro/wildfly","description":"JBoss Application Server","fork":true,"url":"https://api.github.com/repos/pferraro/wildfly","forks_url":"https://api.github.com/repos/pferraro/wildfly/forks","keys_url":"https://api.github.com/repos/pferraro/wildfly/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pferraro/wildfly/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pferraro/wildfly/teams","hooks_url":"https://api.github.com/repos/pferraro/wildfly/hooks","issue_events_url":"https://api.github.com/repos/pferraro/wildfly/issues/events{/number}","events_url":"https://api.github.com/repos/pferraro/wildfly/events","assignees_url":"https://api.github.com/repos/pferraro/wildfly/assignees{/user}","branches_url":"https://api.github.com/repos/pferraro/wildfly/branches{/branch}","tags_url":"https://api.github.com/repos/pferraro/wildfly/tags","blobs_url":"https://api.github.com/repos/pferraro/wildfly/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pferraro/wildfly/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pferraro/wildfly/git/refs{/sha}","trees_url":"https://api.github.com/repos/pferraro/wildfly/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pferraro/wildfly/statuses/{sha}","languages_url":"https://api.github.com/repos/pferraro/wildfly/languages","stargazers_url":"https://api.github.com/repos/pferraro/wildfly/stargazers","contributors_url":"https://api.github.com/repos/pferraro/wildfly/contributors","subscribers_url":"https://api.github.com/repos/pferraro/wildfly/subscribers","subscription_url":"https://api.github.com/repos/pferraro/wildfly/subscription","commits_url":"https://api.github.com/repos/pferraro/wildfly/commits{/sha}","git_commits_url":"https://api.github.com/repos/pferraro/wildfly/git/commits{/sha}","comments_url":"https://api.github.com/repos/pferraro/wildfly/comments{/number}","issue_comment_url":"https://api.github.com/repos/pferraro/wildfly/issues/comments{/number}","contents_url":"https://api.github.com/repos/pferraro/wildfly/contents/{+path}","compare_url":"https://api.github.com/repos/pferraro/wildfly/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pferraro/wildfly/merges","archive_url":"https://api.github.com/repos/pferraro/wildfly/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pferraro/wildfly/downloads","issues_url":"https://api.github.com/repos/pferraro/wildfly/issues{/number}","pulls_url":"https://api.github.com/repos/pferraro/wildfly/pulls{/number}","milestones_url":"https://api.github.com/repos/pferraro/wildfly/milestones{/number}","notifications_url":"https://api.github.com/repos/pferraro/wildfly/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pferraro/wildfly/labels{/name}","releases_url":"https://api.github.com/repos/pferraro/wildfly/releases{/id}","created_at":"2011-06-19T21:52:07Z","updated_at":"2015-05-08T11:49:52Z","pushed_at":"2015-07-28T20:06:59Z","git_url":"git://github.com/pferraro/wildfly.git","ssh_url":"git@github.com:pferraro/wildfly.git","clone_url":"https://github.com/pferraro/wildfly.git","svn_url":"https://github.com/pferraro/wildfly","homepage":"","size":144011,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"wildfly:master","ref":"master","sha":"2d0a75f85eb8dda146dc58df1f8b88d694dfc01e","user":{"login":"wildfly","id":3066274,"avatar_url":"https://avatars.githubusercontent.com/u/3066274?v=3","gravatar_id":"","url":"https://api.github.com/users/wildfly","html_url":"https://github.com/wildfly","followers_url":"https://api.github.com/users/wildfly/followers","following_url":"https://api.github.com/users/wildfly/following{/other_user}","gists_url":"https://api.github.com/users/wildfly/gists{/gist_id}","starred_url":"https://api.github.com/users/wildfly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildfly/subscriptions","organizations_url":"https://api.github.com/users/wildfly/orgs","repos_url":"https://api.github.com/users/wildfly/repos","events_url":"https://api.github.com/users/wildfly/events{/privacy}","received_events_url":"https://api.github.com/users/wildfly/received_events","type":"Organization","site_admin":false},"repo":{"id":764708,"name":"wildfly","full_name":"wildfly/wildfly","owner":{"login":"wildfly","id":3066274,"avatar_url":"https://avatars.githubusercontent.com/u/3066274?v=3","gravatar_id":"","url":"https://api.github.com/users/wildfly","html_url":"https://github.com/wildfly","followers_url":"https://api.github.com/users/wildfly/followers","following_url":"https://api.github.com/users/wildfly/following{/other_user}","gists_url":"https://api.github.com/users/wildfly/gists{/gist_id}","starred_url":"https://api.github.com/users/wildfly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildfly/subscriptions","organizations_url":"https://api.github.com/users/wildfly/orgs","repos_url":"https://api.github.com/users/wildfly/repos","events_url":"https://api.github.com/users/wildfly/events{/privacy}","received_events_url":"https://api.github.com/users/wildfly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wildfly/wildfly","description":"WildFly Application Server","fork":false,"url":"https://api.github.com/repos/wildfly/wildfly","forks_url":"https://api.github.com/repos/wildfly/wildfly/forks","keys_url":"https://api.github.com/repos/wildfly/wildfly/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wildfly/wildfly/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wildfly/wildfly/teams","hooks_url":"https://api.github.com/repos/wildfly/wildfly/hooks","issue_events_url":"https://api.github.com/repos/wildfly/wildfly/issues/events{/number}","events_url":"https://api.github.com/repos/wildfly/wildfly/events","assignees_url":"https://api.github.com/repos/wildfly/wildfly/assignees{/user}","branches_url":"https://api.github.com/repos/wildfly/wildfly/branches{/branch}","tags_url":"https://api.github.com/repos/wildfly/wildfly/tags","blobs_url":"https://api.github.com/repos/wildfly/wildfly/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wildfly/wildfly/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wildfly/wildfly/git/refs{/sha}","trees_url":"https://api.github.com/repos/wildfly/wildfly/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wildfly/wildfly/statuses/{sha}","languages_url":"https://api.github.com/repos/wildfly/wildfly/languages","stargazers_url":"https://api.github.com/repos/wildfly/wildfly/stargazers","contributors_url":"https://api.github.com/repos/wildfly/wildfly/contributors","subscribers_url":"https://api.github.com/repos/wildfly/wildfly/subscribers","subscription_url":"https://api.github.com/repos/wildfly/wildfly/subscription","commits_url":"https://api.github.com/repos/wildfly/wildfly/commits{/sha}","git_commits_url":"https://api.github.com/repos/wildfly/wildfly/git/commits{/sha}","comments_url":"https://api.github.com/repos/wildfly/wildfly/comments{/number}","issue_comment_url":"https://api.github.com/repos/wildfly/wildfly/issues/comments{/number}","contents_url":"https://api.github.com/repos/wildfly/wildfly/contents/{+path}","compare_url":"https://api.github.com/repos/wildfly/wildfly/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wildfly/wildfly/merges","archive_url":"https://api.github.com/repos/wildfly/wildfly/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wildfly/wildfly/downloads","issues_url":"https://api.github.com/repos/wildfly/wildfly/issues{/number}","pulls_url":"https://api.github.com/repos/wildfly/wildfly/pulls{/number}","milestones_url":"https://api.github.com/repos/wildfly/wildfly/milestones{/number}","notifications_url":"https://api.github.com/repos/wildfly/wildfly/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wildfly/wildfly/labels{/name}","releases_url":"https://api.github.com/repos/wildfly/wildfly/releases{/id}","created_at":"2010-07-08T20:46:07Z","updated_at":"2015-07-28T11:00:10Z","pushed_at":"2015-07-28T20:11:04Z","git_url":"git://github.com/wildfly/wildfly.git","ssh_url":"git@github.com:wildfly/wildfly.git","clone_url":"https://github.com/wildfly/wildfly.git","svn_url":"https://github.com/wildfly/wildfly","homepage":"http://wildfly.org","size":320117,"stargazers_count":1410,"watchers_count":1410,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1408,"mirror_url":null,"open_issues_count":43,"forks":1408,"open_issues":43,"watchers":1410,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wildfly/wildfly/pulls/7783"},"html":{"href":"https://github.com/wildfly/wildfly/pull/7783"},"issue":{"href":"https://api.github.com/repos/wildfly/wildfly/issues/7783"},"comments":{"href":"https://api.github.com/repos/wildfly/wildfly/issues/7783/comments"},"review_comments":{"href":"https://api.github.com/repos/wildfly/wildfly/pulls/7783/comments"},"review_comment":{"href":"https://api.github.com/repos/wildfly/wildfly/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wildfly/wildfly/pulls/7783/commits"},"statuses":{"href":"https://api.github.com/repos/wildfly/wildfly/statuses/092ca0f7f053324d935638ebe8f791b385762fad"}}}}