[jboss-cvs] JBossAS SVN: r79146 - in branches/JBPAPP_4_2_0_GA_CP/connector/src: resources/jms-rar/META-INF and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 6 08:19:36 EDT 2008
Author: jesper.pedersen
Date: 2008-10-06 08:19:36 -0400 (Mon, 06 Oct 2008)
New Revision: 79146
Modified:
branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivation.java
branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivationSpec.java
branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsServerSessionPool.java
branches/JBPAPP_4_2_0_GA_CP/connector/src/resources/jms-rar/META-INF/ra.xml
Log:
[JBPAPP-1255] Allow the JMS RAR to determine the destinationType at runtime
Modified: branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivation.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivation.java 2008-10-06 11:50:00 UTC (rev 79145)
+++ branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivation.java 2008-10-06 12:19:36 UTC (rev 79146)
@@ -57,6 +57,7 @@
* A generic jms Activation.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
* @version $Revision$
*/
public class JmsActivation implements ExceptionListener
@@ -88,6 +89,9 @@
/** The destination */
protected Destination destination;
+ /** The destination type */
+ protected boolean isTopic = false;
+
/** The connection */
protected Connection connection;
@@ -191,6 +195,14 @@
}
/**
+ * @return the destination type
+ */
+ public boolean isTopic()
+ {
+ return isTopic;
+ }
+
+ /**
* @return the provider adapter
*/
public JMSProviderAdapter getProviderAdapter()
@@ -398,15 +410,39 @@
*/
protected void setupDestination(Context ctx) throws Exception
{
- Class destinationType;
- if (spec.isTopic())
- destinationType = Topic.class;
+ String destinationName = spec.getDestination();
+
+ String destinationTypeString = spec.getDestinationType();
+ if (destinationTypeString != null && !destinationTypeString.trim().equals(""))
+ {
+ log.debug("Destination type defined as " + destinationTypeString);
+
+ Class<?> destinationType;
+ if (Topic.class.getName().equals(destinationTypeString))
+ {
+ destinationType = Topic.class;
+ isTopic = true;
+ }
+ else
+ {
+ destinationType = Queue.class;
+ }
+
+ log.debug("Retrieving destination " + destinationName + " of type " + destinationType.getName());
+ destination = (Destination) Util.lookup(ctx, destinationName, destinationType);
+ }
else
- destinationType = Queue.class;
+ {
+ log.debug("Destination type not defined");
+ log.debug("Retrieving destination " + destinationName + " of type " + Destination.class.getName());
- String destinationName = spec.getDestination();
- log.debug("Retrieving destination " + destinationName + " of type " + destinationType.getName());
- destination = (Destination) Util.lookup(ctx, destinationName, destinationType);
+ destination = (Destination) Util.lookup(ctx, destinationName, Destination.class);
+ if (destination instanceof Topic)
+ {
+ isTopic = true;
+ }
+ }
+
log.debug("Got destination " + destination + " from " + destinationName);
}
@@ -431,7 +467,7 @@
String user = spec.getUser();
String pass = spec.getPassword();
String clientID = spec.getClientId();
- if (spec.isTopic())
+ if (isTopic())
connection = setupTopicConnection(ctx, user, pass, clientID);
else
connection = setupQueueConnection(ctx, user, pass, clientID);
Modified: branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivationSpec.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivationSpec.java 2008-10-06 11:50:00 UTC (rev 79145)
+++ branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivationSpec.java 2008-10-06 12:19:36 UTC (rev 79146)
@@ -21,9 +21,7 @@
*/
package org.jboss.resource.adapter.jms.inflow;
-import javax.jms.Queue;
import javax.jms.Session;
-import javax.jms.Topic;
import javax.resource.ResourceException;
import javax.resource.spi.ActivationSpec;
import javax.resource.spi.InvalidPropertyException;
@@ -36,6 +34,7 @@
* A generic jms ActivationSpec.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
* @version $Revision$
*/
public class JmsActivationSpec implements ActivationSpec
@@ -50,7 +49,7 @@
private String destination;
/** The destination type */
- private boolean isTopic = false;
+ private String destinationType;
/** The message selector */
private String messageSelector;
@@ -233,10 +232,7 @@
*/
public String getDestinationType()
{
- if (isTopic)
- return Topic.class.getName();
- else
- return Queue.class.getName();
+ return destinationType;
}
/**
@@ -244,21 +240,10 @@
*/
public void setDestinationType(String destinationType)
{
- if (Topic.class.getName().equals(destinationType))
- this.isTopic = true;
- else
- this.isTopic = false;
+ this.destinationType = destinationType;
}
/**
- * @return whether this is for a topic.
- */
- public boolean isTopic()
- {
- return isTopic;
- }
-
- /**
* @return the messageSelector.
*/
public String getMessageSelector()
@@ -653,7 +638,7 @@
buffer.append(Strings.defaultToString(this)).append('(');
buffer.append("ra=").append(ra);
buffer.append(" destination=").append(destination);
- buffer.append(" isTopic=").append(isTopic);
+ buffer.append(" destinationType=").append(destinationType);
if (messageSelector != null)
buffer.append(" selector=").append(messageSelector);
buffer.append(" tx=").append(sessionTransacted);
Modified: branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsServerSessionPool.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsServerSessionPool.java 2008-10-06 11:50:00 UTC (rev 79145)
+++ branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsServerSessionPool.java 2008-10-06 12:19:36 UTC (rev 79146)
@@ -274,7 +274,7 @@
JmsActivationSpec spec = activation.getActivationSpec();
String selector = spec.getMessageSelector();
int maxMessages = spec.getMaxMessagesInt();
- if (spec.isTopic())
+ if (activation.isTopic())
{
Topic topic = (Topic) activation.getDestination();
String subscriptionName = spec.getSubscriptionName();
Modified: branches/JBPAPP_4_2_0_GA_CP/connector/src/resources/jms-rar/META-INF/ra.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/connector/src/resources/jms-rar/META-INF/ra.xml 2008-10-06 11:50:00 UTC (rev 79145)
+++ branches/JBPAPP_4_2_0_GA_CP/connector/src/resources/jms-rar/META-INF/ra.xml 2008-10-06 12:19:36 UTC (rev 79146)
@@ -103,9 +103,6 @@
<required-config-property>
<config-property-name>destination</config-property-name>
</required-config-property>
- <required-config-property>
- <config-property-name>destinationType</config-property-name>
- </required-config-property>
</activationspec>
</messagelistener>
</messageadapter>
More information about the jboss-cvs-commits
mailing list