Author: alessio.soldano(a)jboss.com
Date: 2010-03-19 06:49:42 -0400 (Fri, 19 Mar 2010)
New Revision: 11816
Added:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/DefaultJMSEndpointResolver.java
Modified:
framework/trunk/pom.xml
framework/trunk/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java
Log:
[JBWS-2966] Providing default implementation of JMSEndpointResolver
Modified: framework/trunk/pom.xml
===================================================================
--- framework/trunk/pom.xml 2010-03-19 10:44:18 UTC (rev 11815)
+++ framework/trunk/pom.xml 2010-03-19 10:49:42 UTC (rev 11816)
@@ -30,6 +30,7 @@
<jaxws.api.version>2.2</jaxws.api.version>
<jboss.web.version>2.1.3.GA</jboss.web.version>
<jbossxb.version>2.0.1.GA</jbossxb.version>
+ <jms.api.version>1.1</jms.api.version>
</properties>
<!-- Dependencies -->
@@ -67,6 +68,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/trunk/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java 2010-03-19
10:44:18 UTC (rev 11815)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/DefaultSPIProvider.java 2010-03-19
10:49:42 UTC (rev 11816)
@@ -28,6 +28,7 @@
import org.jboss.wsf.framework.invocation.DefaultResourceInjectorFactory;
import org.jboss.wsf.framework.management.DefaultEndpointMetricsFactory;
import org.jboss.wsf.framework.management.DefaultEndpointRegistryFactory;
+import org.jboss.wsf.framework.management.DefaultJMSEndpointResolver;
import org.jboss.wsf.framework.security.DefaultSecurityAdapterFactory;
import org.jboss.wsf.framework.serviceref.DefaultServiceRefHandlerFactory;
import org.jboss.wsf.framework.serviceref.DefaultServiceRefMetaDataParserFactory;
@@ -41,6 +42,7 @@
import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
import org.jboss.wsf.spi.management.EndpointMetricsFactory;
import org.jboss.wsf.spi.management.EndpointRegistryFactory;
+import org.jboss.wsf.spi.management.JMSEndpointResolver;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.ServiceRefMetaDataParserFactory;
import org.jboss.wsf.spi.serviceref.ServiceRefHandlerFactory;
import org.jboss.wsf.spi.util.ServiceLoader;
@@ -100,6 +102,10 @@
{
returnType = loadService(spiType, DefaultEndpointRegistryFactory.class);
}
+ else if (JMSEndpointResolver.class.equals(spiType))
+ {
+ returnType = loadService(spiType, DefaultJMSEndpointResolver.class);
+ }
else
{
// SPI provided by either container or stack integration that has no default
implementation
Added:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/DefaultJMSEndpointResolver.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/management/DefaultJMSEndpointResolver.java
(rev 0)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/management/DefaultJMSEndpointResolver.java 2010-03-19
10:49:42 UTC (rev 11816)
@@ -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;
+ }
+}
Property changes on:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/DefaultJMSEndpointResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF