Author: alessio.soldano(a)jboss.com
Date: 2010-05-20 16:25:53 -0400 (Thu, 20 May 2010)
New Revision: 12294
Added:
framework/branches/jbossws-framework-3.1.2/src/main/java/org/jboss/wsf/framework/management/DefaultJMSEndpointResolver.java
Modified:
framework/branches/jbossws-framework-3.1.2/pom.xml
framework/branches/jbossws-framework-3.1.2/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java
Log:
[JBPAPP-4359]
Modified: framework/branches/jbossws-framework-3.1.2/pom.xml
===================================================================
--- framework/branches/jbossws-framework-3.1.2/pom.xml 2010-05-20 20:24:18 UTC (rev
12293)
+++ framework/branches/jbossws-framework-3.1.2/pom.xml 2010-05-20 20:25:53 UTC (rev
12294)
@@ -28,6 +28,7 @@
<jbossws.spi.version>1.1.2-SNAPSHOT</jbossws.spi.version>
<jboss.common.version>1.2.1.GA</jboss.common.version>
<jbossxb.version>1.0.0.SP1</jbossxb.version>
+ <jms.api.version>1.1</jms.api.version>
</properties>
<!-- Dependencies -->
@@ -97,6 +98,12 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ <version>${jms.api.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.jboss</groupId>
<artifactId>jbossxb</artifactId>
<version>${jbossxb.version}</version>
Modified:
framework/branches/jbossws-framework-3.1.2/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java
===================================================================
---
framework/branches/jbossws-framework-3.1.2/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java 2010-05-20
20:24:18 UTC (rev 12293)
+++
framework/branches/jbossws-framework-3.1.2/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java 2010-05-20
20:25:53 UTC (rev 12294)
@@ -30,6 +30,7 @@
import org.jboss.wsf.framework.invocation.DefaultResourceInjectorFactory;
import org.jboss.wsf.framework.management.ServerConfigFactoryImpl;
import org.jboss.wsf.framework.management.DefaultEndpointMetricsFactory;
+import org.jboss.wsf.framework.management.DefaultJMSEndpointResolver;
import org.jboss.wsf.framework.serviceref.DefaultServiceRefHandlerFactory;
import org.jboss.wsf.framework.serviceref.DefaultServiceRefMetaDataParserFactory;
import org.jboss.wsf.spi.SPIProvider;
@@ -47,6 +48,7 @@
import org.jboss.wsf.spi.management.EndpointMetricsFactory;
import org.jboss.wsf.spi.management.EndpointRegistryFactory;
import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.jboss.wsf.spi.management.JMSEndpointResolver;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.ServiceRefMetaDataParserFactory;
import org.jboss.wsf.spi.serviceref.ServiceRefBinderFactory;
import org.jboss.wsf.spi.serviceref.ServiceRefHandlerFactory;
@@ -112,6 +114,10 @@
{
returnType = (T)loadService(spiType, ServerConfigFactoryImpl.class.getName());
}
+ else if (JMSEndpointResolver.class.equals(spiType))
+ {
+ returnType = (T)loadService(spiType,
DefaultJMSEndpointResolver.class.getName());
+ }
// SPI provided by either container or stack integration
Copied:
framework/branches/jbossws-framework-3.1.2/src/main/java/org/jboss/wsf/framework/management/DefaultJMSEndpointResolver.java
(from rev 11816,
framework/trunk/src/main/java/org/jboss/wsf/framework/management/DefaultJMSEndpointResolver.java)
===================================================================
---
framework/branches/jbossws-framework-3.1.2/src/main/java/org/jboss/wsf/framework/management/DefaultJMSEndpointResolver.java
(rev 0)
+++
framework/branches/jbossws-framework-3.1.2/src/main/java/org/jboss/wsf/framework/management/DefaultJMSEndpointResolver.java 2010-05-20
20:25:53 UTC (rev 12294)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.framework.management;
+
+import java.util.Iterator;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.Topic;
+
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.management.JMSEndpointResolver;
+
+/**
+ * Default resolver for JMS endpoints
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Mar-2010
+ *
+ */
+public class DefaultJMSEndpointResolver implements JMSEndpointResolver
+{
+ private String fromName;
+
+ public void setDestination(Destination destination)
+ {
+ if (destination instanceof Queue)
+ setFromName(destination, true);
+ else if (destination instanceof Topic)
+ setFromName(destination, false);
+ }
+
+ protected void setFromName(Destination destination, boolean queue)
+ {
+ try
+ {
+ fromName = queue ? "queue/" + ((Queue)destination).getQueueName() :
"topic/" + ((Topic)destination).getTopicName();
+ }
+ catch (JMSException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Endpoint query(Iterator<Endpoint> endpoints)
+ {
+ Endpoint endpoint = null;
+ while (endpoints.hasNext())
+ {
+ Endpoint aux = endpoints.next();
+ String jmsProp = aux.getName().getKeyProperty("jms");
+ if (jmsProp != null && jmsProp.equals(fromName))
+ {
+ endpoint = aux;
+ break;
+ }
+ }
+ return endpoint;
+ }
+}