[jboss-cvs] JBossAS SVN: r101202 - in branches/Branch_Hornet_Temporary_2/hornetq-int/src: main/java/org/jboss/as/integration/hornetq/jopr/util and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Feb 20 05:28:09 EST 2010
Author: ataylor
Date: 2010-02-20 05:28:09 -0500 (Sat, 20 Feb 2010)
New Revision: 101202
Modified:
branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/HornetQComponent.java
branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/util/Invoker.java
branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/util/JMXInvoker.java
branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/META-INF/rhq-plugin.xml
Log:
fixed connection factory config
Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/HornetQComponent.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/HornetQComponent.java 2010-02-20 09:49:58 UTC (rev 101201)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/HornetQComponent.java 2010-02-20 10:28:09 UTC (rev 101202)
@@ -14,16 +14,23 @@
import org.jboss.as.integration.hornetq.jopr.util.*;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.measurement.*;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
import org.rhq.core.pluginapi.operation.OperationFacet;
import org.rhq.core.pluginapi.operation.OperationResult;
+import org.rhq.core.util.exception.ThrowableUtil;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -33,7 +40,7 @@
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
* Created Feb 2, 2010
*/
-public class HornetQComponent extends MBeanComponent implements ResourceComponent, MeasurementFacet, OperationFacet
+public class HornetQComponent extends MBeanComponent implements ResourceComponent, MeasurementFacet, OperationFacet, ConfigurationFacet
{
private String objectName;
@@ -130,37 +137,53 @@
return invoker;
}
- /*private static OperationDefinition getOperationDefinition(final String operationName, final ResourceContext resourceContext)
+ public Configuration loadResourceConfiguration() throws Exception
{
- ResourceType resourceType = resourceContext.getResourceType();
- OperationDefinition operationDefinition = getOperationDefinition(resourceType, operationName);
- if (operationDefinition == null)
- throw new IllegalStateException("Operation named '" + operationName
- + "' is not defined for Resource type '" + resourceType.getName() + "' in the '"
- + resourceType.getPlugin() + "' plugin's descriptor.");
- return operationDefinition;
+ Configuration config = new Configuration();
+ ConfigurationDefinition configDef = resourceContext.getResourceType().getResourceConfigurationDefinition();
+ List<PropertyDefinition> propertyDefinitionList = configDef.getPropertiesInGroup("HornetQCustomProperties");
+ for (PropertyDefinition definition : propertyDefinitionList)
+ {
+ String name = definition.getName();
+ Object o = invoker.getAttribute(objectName, name);
+ PropertySimple simple = new PropertySimple(name, o);
+ config.put(simple);
+ }
+ return config;
}
- public static Configuration getDefaultPluginConfiguration(final ResourceType resourceType)
+ public void updateResourceConfiguration(final ConfigurationUpdateReport configurationUpdateReport)
{
- ConfigurationDefinition pluginConfigurationDefinition = resourceType.getPluginConfigurationDefinition();
- if (pluginConfigurationDefinition != null)
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.INPROGRESS);
+ Map<String,PropertySimple> propertySimpleMap = configurationUpdateReport.getConfiguration().getSimpleProperties();
+ for (String name : propertySimpleMap.keySet())
{
- ConfigurationTemplate template = pluginConfigurationDefinition.getDefaultTemplate();
- if (template != null)
- return template.getConfiguration().deepCopy();
+ try
+ {
+ PropertySimple ps = propertySimpleMap.get(name);
+ Object o = invoker.getAttribute(objectName, name);
+ if(o == null && ps.getStringValue() != null)
+ {
+ invoker.setAttribute(objectName, name, ps);
+ }
+ else if(o != null && ps.getStringValue() == null)
+ {
+ invoker.setAttribute(objectName, name, ps);
+ }
+ else if((o != null && ps.getStringValue() != null) && !o.equals(ps.getStringValue()))
+ {
+ invoker.setAttribute(objectName, name, ps);
+ }
+ }
+ catch (Exception e)
+ {
+ configurationUpdateReport.setErrorMessage(e.getMessage());
+ e.printStackTrace();
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.FAILURE);
+ return;
+ }
}
- return new Configuration(); // there is no default plugin config defined - return an empty one
+ configurationUpdateReport.setStatus(ConfigurationUpdateStatus.SUCCESS);
}
- public static OperationDefinition getOperationDefinition(final ResourceType resourceType, final String operationName)
- {
- Set<OperationDefinition> operationDefinitions = resourceType.getOperationDefinitions();
- for (OperationDefinition operationDefinition : operationDefinitions)
- {
- if (operationDefinition.getName().equals(operationName))
- return operationDefinition;
- }
- return null;
- }*/
}
Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/util/Invoker.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/util/Invoker.java 2010-02-20 09:49:58 UTC (rev 101201)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/util/Invoker.java 2010-02-20 10:28:09 UTC (rev 101202)
@@ -19,4 +19,6 @@
public Object getAttribute(final String objectName, final String attr) throws BeanNotAvailableException;
List<EmsBean> query(String name);
+
+ void setAttribute(String objectName, String name, PropertySimple stringValue) throws Exception;
}
Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/util/JMXInvoker.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/util/JMXInvoker.java 2010-02-20 09:49:58 UTC (rev 101201)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/jopr/util/JMXInvoker.java 2010-02-20 10:28:09 UTC (rev 101202)
@@ -60,11 +60,39 @@
return attribute.getValue();
}
- public List<EmsBean> query(String name)
+ public List<EmsBean> query(final String name)
{
return connection.queryBeans(name);
}
+ public void setAttribute(final String objectName, final String attr, final PropertySimple value) throws Exception
+ {
+ EmsBean bean = connection.getBean(objectName);
+ if(bean == null)
+ {
+ throw new BeanNotAvailableException(objectName);
+ }
+ EmsAttribute attribute = bean.getAttribute(attr);
+ String type = attribute.getType();
+ if(type.equals("java.lang.String"))
+ {
+ attribute.setValue(value.getStringValue());
+ }
+ else if(type.equals("java.lang.Long") || type.equals("long"))
+ {
+ attribute.setValue(value.getLongValue());
+ }
+ else if(type.equals("java.lang.Integer") || type.equals("int"))
+ {
+ attribute.setValue(value.getIntegerValue());
+ }
+ else if(type.equals("java.lang.Double") || type.equals("double"))
+ {
+ attribute.setValue(value.getDoubleValue());
+ }
+
+ }
+
private static void populateParams(final Collection<PropertySimple> props, final Object[] params, final Class[] signature)
{
int pos = 0;
@@ -113,6 +141,16 @@
params[pos] = prop.getIntegerValue();
signature[pos] = int.class;
}
+ else if(val[0].equals("Double"))
+ {
+ params[pos] = prop.getDoubleValue ();
+ signature[pos] = java.lang.Integer.class;
+ }
+ else if(val[0].equals("double"))
+ {
+ params[pos] = prop.getDoubleValue ();
+ signature[pos] = int.class;
+ }
}
pos++;
}
Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/META-INF/rhq-plugin.xml 2010-02-20 09:49:58 UTC (rev 101201)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/META-INF/rhq-plugin.xml 2010-02-20 10:28:09 UTC (rev 101202)
@@ -127,10 +127,20 @@
<parameters>
<c:simple-property required="true" name="name" displayName="connection factory name name"/>
<c:simple-property required="true" name="liveTransportClassName" displayName="the transport class"/>
- <c:simple-property required="true" name="liveTransportParams" displayName="comma-separated list of key=value for the transport parameters"/>
+ <c:simple-property required="false" name="liveTransportParams" displayName="comma-separated list of key=value for the transport parameters"/>
+ <c:simple-property required="false" name="backupTransportClassNames" displayName="the backup transport class"/>
+ <c:simple-property required="false" name="backupTransportParams" displayName="comma-separated list of key=value for the transport parameters"/>
<c:simple-property required="true" name="jndiBindings" displayName="comma-separated list of JNDI bindings"/>
</parameters>
</operation>
+ <operation name="createConnectionFactory2,operation=createConnectionFactory" displayName="Create a JMS ConnectionFactory that uses discovery" description="Create a JMS ConnectionFactory that uses discovery.">
+ <parameters>
+ <c:simple-property required="true" name="name" displayName="connection factory name name"/>
+ <c:simple-property required="true" name="discoveryAddress" displayName="the discovery address of the server to connect to"/>
+ <c:simple-property required="true" name="discoveryPort" displayName="the discovery port of the server to connect to"/>
+ <c:simple-property required="true" name="jndiBindings" displayName="comma-separated list of JNDI bindings"/>
+ </parameters>
+ </operation>
<operation name="listRemoteAddresses,result=String[]" displayName="List Remote Addresses" description="List all remote addresses connected to HornetQ.">
<results>
<c:list-property name="result">
@@ -354,18 +364,16 @@
displayName="Messages Added"
description="number of messages added to this queue since it was created"
dataType="measurement" displayType="summary"/>
- <metric property="ExpiryAddress"
- displayName="Expiry Address"
- description="expiry address associated to this queue"
- dataType="trait" displayType="summary"/>
- <metric property="DeadLetterAddress"
- displayName="Dead Letter Address"
- description="the dead-letter address associated to this queue"
- dataType="trait" displayType="summary"/>
<metric property="Paused"
displayName="paused"
description="Is the queue currently paused"
dataType="trait" displayType="summary"/>
+ <resource-configuration>
+ <c:group name="HornetQCustomProperties" displayName="Advanced">
+ <c:simple-property name="ExpiryAddress" displayName="Expiry Address"/>
+ <c:simple-property name="DeadLetterAddress" displayName="Dead Letter Address"/>
+ </c:group>
+ </resource-configuration>
</service>
<service name="Topics"
discovery="HornetQDiscoveryComponent"
@@ -492,86 +500,47 @@
displayName="Bindings"
description="the connection factory bindings"
dataType="trait" displayType="summary"/>
- <metric property="ClientID"
- displayName="Client ID"
- description="The client ID of this connection factory"
+ <metric property="StaticConnectors"
+ displayName="Static Connectors"
+ description="the connection factory connectors"
dataType="trait" displayType="summary"/>
- <metric property="ClientFailureCheckPeriod"
- displayName="Client Failure Check Period"
- description="how often to check for client failures"
- dataType="trait" displayType="summary"/>
- <metric property="CallTimeout"
- displayName="Call Timeout"
- description="CallTimeout"
- dataType="trait" displayType="summary"/>
- <metric property="DupsOKBatchSize"
- displayName="Dups OK Batch Size"
- description="Returns the batch size (in bytes) between acknowledgements when using DUPS_OK_ACKNOWLEDGE mode"
- dataType="trait" displayType="summary"/>
- <metric property="ConsumerMaxRate"
- displayName="Consumer Max Rate"
- description="the maximum rate of message consumption for consumers created through this factory"
- dataType="trait" displayType="summary"/>
- <metric property="ConsumerWindowSize"
- displayName="Consumer Window Size"
- description="the window size for flow control of the consumers created through this factory"
- dataType="trait" displayType="summary"/>
- <metric property="ProducerMaxRate"
- displayName="Producer Max Rate"
- description="the maximum rate of message production for producers created through this factory"
- dataType="trait" displayType="summary"/>
- <metric property="ConfirmationWindowSize"
- displayName="Confirmation Window Size"
- description="the size for the confirmation window of clients using this factory"
- dataType="trait" displayType="summary"/>
- <metric property="BlockOnAcknowledge"
- displayName="Block On Acknowledge"
- description="whether consumers created through this factory will block while sending message acknowledgements or do it asynchronously"
- dataType="trait" displayType="summary"/>
- <metric property="BlockOnDurableSend"
- displayName="Block On Durable Send"
- description="whether producers created through this factory will block while sending durable messages or do it asynchronously."
- dataType="trait" displayType="summary"/>
- <metric property="BlockOnNonDurableSend"
- displayName="Block On Non Durable Send"
- description="whether producers created through this factory will block while sending non-durable messages or do it asynchronously."
- dataType="trait" displayType="summary"/>
- <metric property="PreAcknowledge"
- displayName="Pre Acknowledge"
- description="whether messages will pre-acknowledged on the server before they are sent to the consumers or not"
- dataType="trait" displayType="summary"/>
- <metric property="ConnectionTTL"
- displayName="Connection TTL"
- description="TTL determines how long the server will keep a connection alive in the absence of any data arriving from the client."
- dataType="trait" displayType="summary"/>
- <metric property="TransactionBatchSize"
- displayName="Transaction Batch Size"
- description="the acknowledgements batch size"
- dataType="trait" displayType="summary"/>
- <metric property="MinLargeMessageSize"
- displayName="Min Large Message Size"
- description="the large message size threshold"
- dataType="trait" displayType="summary"/>
- <metric property="AutoGroup"
- displayName="Auto Group"
- description="whether producers created through this factory will automatically assign a group ID to the messages they sent"
- dataType="trait" displayType="summary"/>
- <metric property="RetryInterval"
- displayName="Retry Interval"
- description="the time to retry connections created by this factory after failure"
- dataType="trait" displayType="summary"/>
- <metric property="RetryIntervalMultiplier"
- displayName="Retry Interval Multiplier"
- description="the multiplier to apply to successive retry intervals"
- dataType="trait" displayType="summary"/>
- <metric property="ReconnectAttempts"
- displayName="Reconnect Attempts"
- description="the maximum number of attempts to retry connection in case of failure"
- dataType="trait" displayType="summary"/>
- <metric property="FailoverOnServerShutdown"
- displayName="Failover On Server Shutdown"
- description="whether connections created by this factory must failover in case the server they are connected to has normally shut down."
- dataType="trait" displayType="summary"/>
+ <resource-configuration>
+ <c:group name="HornetQCustomProperties" displayName="Advanced">
+ <c:simple-property name="DiscoveryAddress" required="false" displayName="Discovery Address"/>
+ <c:simple-property name="DiscoveryPort" type="integer" displayName="Discovery Port"/>
+ <c:simple-property name="DiscoveryRefreshTimeout" type="long" displayName="Discovery Refresh Timeout"/>
+ <c:simple-property name="DiscoveryInitialWaitTimeout" type="long" displayName="Discovery Initial Wait Timeout"/>
+ <c:simple-property name="ClientID" required="false" displayName="Client ID"/>
+ <c:simple-property name="DupsOKBatchSize" type="integer" displayName="Dups OK Batch Size"/>
+ <c:simple-property name="TransactionBatchSize" type="integer" displayName="Transaction Batch Size"/>
+ <c:simple-property name="ClientFailureCheckPeriod" type="long" displayName="Client Failure Check Period"/>
+ <c:simple-property name="ConnectionTTL" type="long" displayName="Connection TTL"/>
+ <c:simple-property name="CallTimeout" type="long" displayName="Call Timeout"/>
+ <c:simple-property name="ConsumerWindowSize" type="integer" displayName="Consumer Window Size"/>
+ <c:simple-property name="ConsumerMaxRate" type="integer" displayName="Consumer Max Rate"/>
+ <c:simple-property name="ConfirmationWindowSize" type="integer" displayName="Confirmation Window Size"/>
+ <c:simple-property name="ProducerMaxRate" type="integer" displayName="Producer Max Rate"/>
+ <c:simple-property name="ProducerWindowSize" type="integer" displayName="Producer Window Size"/>
+ <c:simple-property name="CacheLargeMessagesClient" type="boolean" displayName="Cache Large Messages Client"/>
+ <c:simple-property name="MinLargeMessageSize" type="integer" displayName="Min Large Message Size"/>
+ <c:simple-property name="BlockOnNonDurableSend" type="boolean" displayName="Block On Non Durable Send"/>
+ <c:simple-property name="BlockOnAcknowledge" type="boolean" displayName="Block On Acknowledge"/>
+ <c:simple-property name="BlockOnDurableSend" type="boolean" displayName="Block On Durable Send"/>
+ <c:simple-property name="AutoGroup" type="boolean" displayName="Auto Group"/>
+ <c:simple-property name="PreAcknowledge" type="boolean" displayName="Pre Acknowledge"/>
+ <c:simple-property name="MaxRetryInterval" type="long" displayName="Max Retry Interval"/>
+ <c:simple-property name="RetryIntervalMultiplier" type="double" displayName="Retry Interval Multiplier"/>
+ <c:simple-property name="ReconnectAttempts" type="integer" displayName="Reconnect Attempts"/>
+ <c:simple-property name="FailoverOnServerShutdown" type="boolean" displayName="Failover On Server Shutdown"/>
+ <c:simple-property name="ScheduledThreadPoolMaxSize" type="integer" displayName="Scheduled Thread Pool Max Size"/>
+ <c:simple-property name="ThreadPoolMaxSize" type="integer" displayName="Thread Pool Max Size"/>
+ <c:simple-property name="GroupID" required="false" displayName="Group ID"/>
+ <c:simple-property name="InitialMessagePacketSize" type="integer" displayName="Initial Message Packet Size"/>
+ <c:simple-property name="UseGlobalPools" type="boolean" displayName="Use Global Pools"/>
+ <c:simple-property name="RetryInterval" type="long" displayName="Retry Interval"/>
+ <c:simple-property name="ConnectionLoadBalancingPolicyClassName" displayName="Connection Load Balancing Policy Class Name"/>
+ </c:group>
+ </resource-configuration>
</service>
<service name="HornetQ Server Manager"
discovery="HornetQDiscoveryComponent"
@@ -1393,15 +1362,13 @@
displayName="Messages Added"
description="the number of messages added to this queue since it was created"
dataType="measurement" displayType="summary"/>
- <metric property="ExpiryAddress"
- displayName="Expiry Address"
- description="the expiry address associated to this queue"
- dataType="trait" displayType="summary"/>
- <metric property="DeadLetterAddress"
- displayName="Dead Letter Address"
- description="the dead-letter address associated to this queue"
- dataType="trait" displayType="summary"/>
- </service>
+ <resource-configuration>
+ <c:group name="HornetQCustomProperties" displayName="Advanced">
+ <c:simple-property name="ExpiryAddress" displayName="Expiry Address"/>
+ <c:simple-property name="DeadLetterAddress" displayName="Dead Letter Address"/>
+ </c:group>
+ </resource-configuration>
+ </service>
</service>
</server>
More information about the jboss-cvs-commits
mailing list