Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Bug 1655980 - Support EAP 7.2+ jgroups-cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
josejulio committed Apr 23, 2019
1 parent 3101c3c commit 44a9259
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 12 deletions.
@@ -0,0 +1,62 @@
package org.rhq.modules.plugins.wildfly10;

import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.CreateResourceStatus;
import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.core.pluginapi.inventory.CreateResourceReport;
import org.rhq.modules.plugins.wildfly10.json.ResultFailedException;

public class BroadcastGroupComponent extends BaseComponent {

static final String JGROUP_CLUSTERS = "jgroups-cluster";

private boolean jGroupClusterExists() throws Exception {
try {
this.readAttribute(JGROUP_CLUSTERS);
return true;
} catch (ResultFailedException ex) {
return false;
}
}

@Override
public void updateResourceConfiguration(ConfigurationUpdateReport report) {
// If no jgroup cluster found, remove it from the update call, as this property was introduced in EAP 7.2
try {
if (!this.jGroupClusterExists()) {
final ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition().copy();
configDef.getPropertyDefinitions().remove(JGROUP_CLUSTERS);
report.getConfiguration().remove(JGROUP_CLUSTERS);
ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef, getASConnection(), address);
delegate.updateResourceConfiguration(report);
} else {
super.updateResourceConfiguration(report);
}
} catch (Exception ex) {
getLog().error("Error while updating a BroadcastGroup", ex);
report.setStatus(ConfigurationUpdateStatus.FAILURE);
report.setErrorMessage(ex.getMessage());
}
}

@Override
public CreateResourceReport createResource(CreateResourceReport report) {
// If no jgroup cluster found, remove it from the create call, as this property was introduced in EAP 7.2
try {
if (!this.jGroupClusterExists()) {
ConfigurationDefinition configDef = report.getResourceType().getResourceConfigurationDefinition().copy();
configDef.getPropertyDefinitions().remove(JGROUP_CLUSTERS);
CreateResourceDelegate delegate = new CreateResourceDelegate(configDef, getASConnection(), address);
return delegate.createResource(report);
} else {
return super.createResource(report);
}
} catch (Exception ex) {
getLog().error("Error while creating a BroadcastGroup", ex);
report.setStatus(CreateResourceStatus.FAILURE);
report.setErrorMessage(ex.getMessage());
return report;
}
}
}
27 changes: 15 additions & 12 deletions modules/plugins/wfly-10/src/main/resources/META-INF/rhq-plugin.xml
Expand Up @@ -6032,7 +6032,7 @@

<service name="Broadcast Group (Managed Server)"
discovery="SubsystemDiscovery"
class="BaseComponent"
class="BroadcastGroupComponent"
description=""
createDeletePolicy="neither">

Expand Down Expand Up @@ -6065,11 +6065,12 @@
<c:list-property name="connectors" required="false" readOnly="true" description="Specifies the names of connectors that will be broadcast." >
<c:simple-property name="connectors" />
</c:list-property>
<c:simple-property name="socket-binding" required="false" type="string" readOnly="true" description="The broadcast group socket binding. Alternative to jgroups-channel">
<c:simple-property name="socket-binding" required="false" type="string" readOnly="true" description="The broadcast group socket binding. Alternative to Jgroups Channel. Since EAP 7.2 is an alternative to Jgroups Cluster">
<c:option-source target="configuration" expression="*/socket-binding=name:type=SocketBindingGroup" expressionScope="baseResource"/>
</c:simple-property>
<c:simple-property name="jgroups-channel" required="false" type="string" readOnly="true" description="The name used by a JGroups channel to join a cluster. Alternative to socket-binding."/>
<c:simple-property name="jgroups-stack" required="false" type="string" readOnly="true" description="The name of a stack defined in the org.jboss.as.clustering.jgroups subsystem that is used to form a cluster. Requires jgroups-channel"/>
<c:simple-property name="jgroups-cluster" required="false" type="string" readOnly="true" description="The logical cluster name. Introduced in EAP 7.2. Alternative to Socket Binding."/>
<c:simple-property name="jgroups-channel" required="false" type="string" readOnly="true" description="References the name of a JGroups channel. Since EAP 7.2: If undefined, the default channel will be used and requires Jgroups Cluster"/>
<c:simple-property name="jgroups-stack" required="false" type="string" readOnly="true" description="The name of a stack defined in the org.jboss.as.clustering.jgroups subsystem that is used to form a cluster. Before EAP 7.2 Requires Jgroups Channel and since EAP 7.2 requires Jgroups Cluster"/>
</resource-configuration>
</service>

Expand Down Expand Up @@ -8968,7 +8969,7 @@

<service name="Broadcast Group (Profile)"
discovery="SubsystemDiscovery"
class="BaseComponent"
class="BroadcastGroupComponent"
description=""
createDeletePolicy="both">

Expand All @@ -8981,11 +8982,12 @@
<c:list-property name="connectors" required="false" description="Specifies the names of connectors that will be broadcast." >
<c:simple-property name="connectors" />
</c:list-property>
<c:simple-property name="socket-binding" required="false" type="string" readOnly="false" description="The broadcast group socket binding. Alternative to jgroups-channel">
<c:simple-property name="socket-binding" required="false" type="string" readOnly="false" description="The broadcast group socket binding. Alternative to Jgroups Channel. Since EAP 7.2 is an alternative to Jgroups Cluster">
<c:option-source target="configuration" expression="*/socket-binding=name:type=SocketBindingGroup ProfileBaseResource.plugin=&pluginName;" expressionScope="baseResource"/>
</c:simple-property>
<c:simple-property name="jgroups-channel" required="false" type="string" readOnly="false" description="The name used by a JGroups channel to join a cluster. Alternative to socket-binding."/>
<c:simple-property name="jgroups-stack" required="false" type="string" readOnly="false" description="The name of a stack defined in the org.jboss.as.clustering.jgroups subsystem that is used to form a cluster. Requires jgroups-channel"/>
<c:simple-property name="jgroups-cluster" required="false" type="string" readOnly="false" description="The logical cluster name. Introduced in EAP 7.2. Alternative to Socket Binding."/>
<c:simple-property name="jgroups-channel" required="false" type="string" readOnly="false" description="References the name of a JGroups channel. Since EAP 7.2: If undefined, the default channel will be used and requires Jgroups Cluster"/>
<c:simple-property name="jgroups-stack" required="false" type="string" readOnly="false" description="The name of a stack defined in the org.jboss.as.clustering.jgroups subsystem that is used to form a cluster. Before EAP 7.2 Requires Jgroups Channel and since EAP 7.2 requires Jgroups Cluster"/>
</resource-configuration>
</service>

Expand Down Expand Up @@ -15829,7 +15831,7 @@

<service name="Broadcast Group"
discovery="SubsystemDiscovery"
class="BaseComponent"
class="BroadcastGroupComponent"
description=""
createDeletePolicy="both">

Expand Down Expand Up @@ -15862,11 +15864,12 @@
<c:list-property name="connectors" required="false" description="Specifies the names of connectors that will be broadcast.">
<c:simple-property name="connectors"/>
</c:list-property>
<c:simple-property name="socket-binding" required="false" type="string" readOnly="false" description="The broadcast group socket binding. Alternative to jgroups-channel">
<c:simple-property name="socket-binding" required="false" type="string" readOnly="false" description="The broadcast group socket binding. Alternative to Jgroups Channel. Since EAP 7.2 is an alternative to Jgroups Cluster">
<c:option-source target="configuration" expression="*/socket-binding=name:type=SocketBindingGroup"/>
</c:simple-property>
<c:simple-property name="jgroups-channel" required="false" type="string" readOnly="false" description="The name used by a JGroups channel to join a cluster. Alternative to socket-binding."/>
<c:simple-property name="jgroups-stack" required="false" type="string" readOnly="false" description="The name of a stack defined in the org.jboss.as.clustering.jgroups subsystem that is used to form a cluster. Requires jgroups-channel"/>
<c:simple-property name="jgroups-cluster" required="false" type="string" readOnly="false" description="The logical cluster name. Introduced in EAP 7.2. Alternative to Socket Binding."/>
<c:simple-property name="jgroups-channel" required="false" type="string" readOnly="false" description="References the name of a JGroups channel. Since EAP 7.2: If undefined, the default channel will be used and requires Jgroups Cluster"/>
<c:simple-property name="jgroups-stack" required="false" type="string" readOnly="false" description="The name of a stack defined in the org.jboss.as.clustering.jgroups subsystem that is used to form a cluster. Before EAP 7.2 Requires Jgroups Channel and since EAP 7.2 requires Jgroups Cluster"/>
</resource-configuration>
</service>

Expand Down

0 comments on commit 44a9259

Please sign in to comment.