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

Commit

Permalink
Bug 1333929 - Error when trying to save "Connection Factory" configur…
Browse files Browse the repository at this point in the history
…ation on Profile.

  Also checks if the (Profile) sufix exists.
  Skips some checks on JMS Queue and JMS Topic
  Changed to readonly two attributes of JMS Queue.
  • Loading branch information
josejulio committed May 12, 2016
1 parent 4387729 commit c60333b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
Expand Up @@ -97,6 +97,8 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone

public static final String MANAGED_SERVER = "Managed Server";

private static final String PROFILE_SUFFIX = " (Profile)";

/**
* @deprecated as of 4.10. Use your own logger or {@link #getLog()} method.
*/
Expand Down Expand Up @@ -954,4 +956,13 @@ public static ComplexRequest create(String requestName) {
public static Log getLog() {
return LOG;
}

public static String resourceTypeNameByRemovingProfileSuffix(String resourceTypeName) {
if (resourceTypeName.length() > PROFILE_SUFFIX.length() && resourceTypeName
.substring(resourceTypeName.length() - PROFILE_SUFFIX.length(), resourceTypeName.length())
.equals(PROFILE_SUFFIX)) {
resourceTypeName = resourceTypeName.substring(0, resourceTypeName.length() - PROFILE_SUFFIX.length());
}
return resourceTypeName;
}
}
Expand Up @@ -60,6 +60,7 @@ public class ConnectorDiscoveryGroupValidatorComponent extends BaseComponent<Res
public void updateResourceConfiguration(ConfigurationUpdateReport report) {
ResourceType resourceType = context.getResourceType();
String resourceTypeName = resourceType.getName();
resourceTypeName = BaseComponent.resourceTypeNameByRemovingProfileSuffix(resourceTypeName);

ConfigurationUpdateHelper configurationUpdateHelper;
if (resourceTypeName.equals("Connection Factory") || resourceTypeName.equals("Pooled Connection Factory")) {
Expand Down
Expand Up @@ -21,6 +21,8 @@
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;

/**
Expand All @@ -42,6 +44,16 @@ public void updateResourceConfiguration(ConfigurationUpdateReport report) {

//defer the rest of the validation for connector and discovery group name to
//the base class
super.updateResourceConfiguration(report);
// Except for JMS Queue and JMS Topic, those don't have connector or discovery group name.
ResourceType resourceType = context.getResourceType();
String resourceTypeName = resourceType.getName();
resourceTypeName = BaseComponent.resourceTypeNameByRemovingProfileSuffix(resourceTypeName);
if (!resourceTypeName.equals("JMS Queue") && !resourceTypeName.equals("JMS Topic")) {
super.updateResourceConfiguration(report);
} else {
ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef, getASConnection(), address);
delegate.updateResourceConfiguration(report);
}
}
}
Expand Up @@ -7135,11 +7135,11 @@
</plugin-configuration>

<resource-configuration>
<c:simple-property name="durable" required="false" type="boolean" readOnly="false" defaultValue="true" description="Whether the queue is durable or not. The default value is true."/>
<c:simple-property name="durable" required="false" type="boolean" readOnly="true" defaultValue="true" description="Whether the queue is durable or not. The default value is true."/>
<c:list-property name="entries" required="true" description="The jndi names the queue will be bound to." >
<c:simple-property name="entry" type="string" description="A single JNDI entry"/>
</c:list-property>
<c:simple-property name="selector" required="false" type="string" readOnly="false" description="The queue selector."/>
<c:simple-property name="selector" required="false" type="string" readOnly="true" description="The queue selector."/>
</resource-configuration>
</service>

Expand Down Expand Up @@ -13006,11 +13006,11 @@
<metric property="queue-address" dataType="trait" description="The queue address defines what address is used for routing messages."/>

<resource-configuration>
<c:simple-property name="durable" required="false" type="boolean" readOnly="false" defaultValue="true" description="Whether the queue is durable or not. The default value is true."/>
<c:simple-property name="durable" required="false" type="boolean" readOnly="true" defaultValue="true" description="Whether the queue is durable or not. The default value is true."/>
<c:list-property name="entries" required="true" description="The jndi names the queue will be bound to.">
<c:simple-property name="entry" type="string" description="A single JNDI entry"/>
</c:list-property>
<c:simple-property name="selector" required="false" type="string" readOnly="false" description="The queue selector."/>
<c:simple-property name="selector" required="false" type="string" readOnly="true" description="The queue selector."/>
</resource-configuration>
</service>

Expand Down

0 comments on commit c60333b

Please sign in to comment.