Author: richard.opalka(a)jboss.com
Date: 2010-07-09 07:54:11 -0400 (Fri, 09 Jul 2010)
New Revision: 12620
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/SecurityActions.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/JMSEndpointDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/JMSEndpointRegistryDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/jms/
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/jms/JMSDescriptorProcessorImpl.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/jms/JMSEndpointsFactory.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDJmsAddressBean.java
Modified:
stack/cxf/trunk/modules/server/pom.xml
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml
stack/cxf/trunk/pom.xml
Log:
[JBWS-3086] merging CXF JMS prototype upstream
Modified: stack/cxf/trunk/modules/server/pom.xml
===================================================================
--- stack/cxf/trunk/modules/server/pom.xml 2010-07-09 11:39:54 UTC (rev 12619)
+++ stack/cxf/trunk/modules/server/pom.xml 2010-07-09 11:54:11 UTC (rev 12620)
@@ -249,6 +249,10 @@
<artifactId>jboss-saaj-api_1.3_spec</artifactId>
</dependency>
<dependency>
+ <groupId>org.jboss.spec.javax.jms</groupId>
+ <artifactId>jboss-jms-api_1.1_spec</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jboss.jaxr</groupId>
<artifactId>juddi-service</artifactId>
<type>sar</type>
Copied:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/SecurityActions.java
(from rev 12284,
stack/cxf/branches/jms-integration/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/SecurityActions.java)
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/SecurityActions.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/SecurityActions.java 2010-07-09
11:54:11 UTC (rev 12620)
@@ -0,0 +1,82 @@
+/*
+ * 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.stack.cxf.deployment;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 17-Feb-2010
+ *
+ */
+class SecurityActions
+{
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param classLoader the classloader
+ */
+ static void setContextClassLoader(final ClassLoader classLoader)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+ else
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+
+}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2010-07-09
11:39:54 UTC (rev 12619)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2010-07-09
11:54:11 UTC (rev 12620)
@@ -117,4 +117,4 @@
holder.close();
}
}
-}
+}
\ No newline at end of file
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java 2010-07-09
11:39:54 UTC (rev 12619)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java 2010-07-09
11:54:11 UTC (rev 12620)
@@ -168,7 +168,6 @@
URL cxfURL = dd.createFileURL();
log.info("JBossWS-CXF configuration generated: " + cxfURL);
-
return cxfURL;
}
Copied:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/JMSEndpointDeploymentAspect.java
(from rev 12284,
stack/cxf/branches/jms-integration/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/JMSEndpointDeploymentAspect.java)
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/JMSEndpointDeploymentAspect.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/JMSEndpointDeploymentAspect.java 2010-07-09
11:54:11 UTC (rev 12620)
@@ -0,0 +1,124 @@
+/*
+ * 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.stack.cxf.deployment.aspect;
+
+import java.net.URL;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.endpoint.ServerRegistry;
+import org.apache.cxf.transport.jms.JMSConfiguration;
+import org.apache.cxf.transport.jms.JMSDestination;
+import org.jboss.wsf.common.integration.JMSDeploymentAspect;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData;
+import org.jboss.wsf.stack.cxf.configuration.BusHolder;
+import org.springframework.jms.connection.SingleConnectionFactory;
+
+/**
+ * To start the jms endpoints
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class JMSEndpointDeploymentAspect extends JMSDeploymentAspect
+{
+ private BusHolder busHolder = null;
+
+ @Override
+ public void start(Deployment dep)
+ {
+ //TODO:handler JAXBIntro
+ if (dep.getAttachment(JMSEndpointsMetaData.class) != null)
+ {
+ JMSEndpointsMetaData jmsEndpoints =
dep.getAttachment(JMSEndpointsMetaData.class);
+ URL url = jmsEndpoints.getDescriptorURL();
+
+ ClassLoader origClassLoader = SecurityActions.getContextClassLoader();
+ try
+ {
+ SecurityActions.setContextClassLoader(dep.getRuntimeClassLoader());
+ SpringBusFactory bf = new SpringBusFactory();
+ Bus bus = bf.createBus(url);
+ dep.addAttachment(Bus.class, bus);
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to deploy jms endpoints deployment " + url);
+ throw new RuntimeException(e);
+ }
+
+ finally
+ {
+ BusFactory.setDefaultBus(null);
+ SecurityActions.setContextClassLoader(origClassLoader);
+ }
+ }
+ }
+
+ @Override
+ public void stop(Deployment dep)
+ {
+ log.debug("Undeploying jms endpoints in " + dep.getSimpleName());
+ if (busHolder != null && busHolder.getBus() != null)
+ {
+ //CXF uses WrappedConnectionFactory to create "jmsListener".
DefaultMessageListenerContainer.shutdown() can not colse all the jms connections.
+ //We need to explicitly call detroy() to close connection. This should be fixed
in CXF side.
+ SingleConnectionFactory connectionFactory = null;
+ Server jmsServer = null;
+ ServerRegistry serRegistry =
busHolder.getBus().getExtension(ServerRegistry.class);
+ for (Server server : serRegistry.getServers())
+ {
+ if (server.getDestination() != null && server.getDestination()
instanceof JMSDestination)
+ {
+ JMSDestination jmsDestination = (JMSDestination) server.getDestination();
+ JMSConfiguration jmsConfig = jmsDestination.getJmsConfig();
+ if (jmsConfig.getWrappedConnectionFactory() != null
+ && jmsConfig.getWrappedConnectionFactory() instanceof
SingleConnectionFactory)
+ {
+ connectionFactory = (SingleConnectionFactory) jmsConfig
+ .getWrappedConnectionFactory();
+ jmsServer = server;
+ }
+
+ }
+
+ }
+
+ if (jmsServer != null)
+ {
+ jmsServer.stop();
+ }
+
+ if (connectionFactory != null)
+ {
+ connectionFactory.destroy();
+ }
+ //TODO:Remove above code after fix CXF-2788
+ //close LifecycleListener if exists
+ busHolder.getBus().shutdown(false);
+ busHolder.close();
+ }
+ }
+}
+
Copied:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/JMSEndpointRegistryDeploymentAspect.java
(from rev 12284,
stack/cxf/branches/jms-integration/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/JMSEndpointRegistryDeploymentAspect.java)
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/JMSEndpointRegistryDeploymentAspect.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/JMSEndpointRegistryDeploymentAspect.java 2010-07-09
11:54:11 UTC (rev 12620)
@@ -0,0 +1,118 @@
+/*
+ * 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.stack.cxf.deployment.aspect;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.endpoint.ServerRegistry;
+import org.apache.cxf.frontend.MethodDispatcher;
+import org.apache.cxf.frontend.SimpleMethodDispatcher;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.jms.JMSConfiguration;
+import org.apache.cxf.transport.jms.JMSDestination;
+import org.jboss.wsf.common.integration.JMSDeploymentAspect;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.JMSEndpoint;
+import org.jboss.wsf.spi.management.EndpointRegistry;
+import org.jboss.wsf.spi.management.EndpointRegistryFactory;
+
+/**
+ * The DeploymentAspect to register the jms endpoints
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class JMSEndpointRegistryDeploymentAspect extends JMSDeploymentAspect
+{
+ private EndpointRegistry registry = null;
+ @Override
+ public void start(Deployment dep)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ if (registry == null)
+ registry =
spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
+ Bus bus = dep.getAttachment(Bus.class);
+ Map<String, JMSConfiguration> jmsConfigMap =
createEndpointJmsConfigMap(bus);
+ for (Endpoint endpoint : dep.getService().getEndpoints())
+ {
+ JMSEndpoint jmsEndpoint = (JMSEndpoint)endpoint;
+ String endpointImplClass = jmsEndpoint.getTargetBeanName();
+ JMSConfiguration jmsConfig = jmsConfigMap.get(endpointImplClass);
+ if (jmsConfig != null)
+ {
+ jmsEndpoint.setTargetDestination(jmsConfig.getTargetDestination());
+ jmsEndpoint.setReplyDestination(jmsConfig.getReplyDestination());
+ }
+
+ registry.register(jmsEndpoint);
+ }
+ }
+
+ public void stop(Deployment dep)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ if (registry == null)
+ registry =
spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ registry.unregister(ep);
+ }
+ }
+
+ private Map<String, JMSConfiguration> createEndpointJmsConfigMap(Bus bus)
+ {
+ Map<String, JMSConfiguration> endpointJmsConfigMap = new
java.util.HashMap<String, JMSConfiguration>();
+ ServerRegistry serverRegsitry = bus.getExtension(ServerRegistry.class);
+ for (Server server : serverRegsitry.getServers())
+ {
+ Destination destination = server.getDestination();
+ if (destination instanceof JMSDestination)
+ {
+ JMSConfiguration jmsConfiguration =
((JMSDestination)destination).getJmsConfig();
+ String implClassName = getEndpointClassName(server);
+ if (implClassName != null)
+ {
+ endpointJmsConfigMap.put(implClassName, jmsConfiguration);
+ }
+ }
+ }
+ return endpointJmsConfigMap;
+ }
+
+ private String getEndpointClassName(Server server)
+ {
+ MethodDispatcher methodDispatcher = (SimpleMethodDispatcher)
server.getEndpoint().getService().get(
+ MethodDispatcher.class.getName());
+ if (methodDispatcher != null && methodDispatcher instanceof
SimpleMethodDispatcher)
+ {
+ Method method =
((SimpleMethodDispatcher)methodDispatcher).getPrimaryMethod(server.getEndpoint().getEndpointInfo().getInterface()
+ .getOperations().iterator().next());
+ return method != null ? method.getDeclaringClass().getName() : null;
+ }
+ return null;
+ }
+}
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/jms/JMSDescriptorProcessorImpl.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/jms/JMSDescriptorProcessorImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/jms/JMSDescriptorProcessorImpl.java 2010-07-09
11:54:11 UTC (rev 12620)
@@ -0,0 +1,86 @@
+/*
+ * 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.stack.cxf.deployment.jms;
+
+import java.net.URL;
+
+import org.jboss.wsf.spi.metadata.jms.JMSDescriptorProcessor;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+/**
+ * JMS descriptor processor implementation.
+ *
+ * @author <a href="ropalka(a)redhat.com">Richard Opalka</a>
+ */
+public final class JMSDescriptorProcessorImpl implements JMSDescriptorProcessor
+{
+ private String descriptorName;
+ private boolean isValidating;
+
+ /* (non-Javadoc)
+ * @see org.jboss.wsf.spi.metadata.DescriptorProcessor#getDescriptorName()
+ */
+ @Override
+ public String getDescriptorName()
+ {
+ return this.descriptorName;
+ }
+
+ /**
+ * Invoked via MC.
+ * @param descriptorName
+ */
+ public void setDescriptorName(final String descriptorName)
+ {
+ this.descriptorName = descriptorName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.wsf.spi.metadata.DescriptorProcessor#getFactory(java.net.URL)
+ */
+ @Override
+ public ObjectModelFactory getFactory(final URL url)
+ {
+ if (url == null)
+ throw new IllegalArgumentException("URL cannot be null");
+
+ return new JMSEndpointsFactory(url);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.wsf.spi.metadata.DescriptorProcessor#isValidating()
+ */
+ @Override
+ public boolean isValidating()
+ {
+ return this.isValidating;
+ }
+
+ /**
+ * Invoked via MC.
+ * @param isValidating
+ */
+ public void setValidating(final boolean isValidating)
+ {
+ this.isValidating = isValidating;
+ }
+}
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/jms/JMSEndpointsFactory.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/jms/JMSEndpointsFactory.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/jms/JMSEndpointsFactory.java 2010-07-09
11:54:11 UTC (rev 12620)
@@ -0,0 +1,99 @@
+/*
+ * 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.stack.cxf.deployment.jms;
+
+import java.net.URL;
+
+import org.jboss.wsf.spi.metadata.jms.JMSEndpointMetaData;
+import org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * JMS Endpoints OjbectModelFactory
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class JMSEndpointsFactory implements ObjectModelFactory
+{
+ private URL descriptorURL;
+
+ public JMSEndpointsFactory(URL descriptorURL)
+ {
+ this.descriptorURL = descriptorURL;
+ }
+
+ /**
+ * This method is called on the factory by the object model builder when the parsing
starts.
+ *
+ * @return the root of the object model.
+ */
+ public Object newRoot(Object root, UnmarshallingContext navigator, String
namespaceURI, String localName,
+ Attributes attrs)
+ {
+ return new JMSEndpointsMetaData(descriptorURL);
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String
name)
+ {
+ return root;
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(JMSEndpointsMetaData endpoints, UnmarshallingContext navigator,
String namespaceURI,
+ String localName, Attributes attrs)
+ {
+ if ("endpoint".equals(localName) && isJMSEndpoint(attrs))
+ {
+ JMSEndpointMetaData endpoint = new JMSEndpointMetaData(endpoints);
+ endpoint.setName(attrs.getValue("name"));
+ endpoint.setImplementor(attrs.getValue("implementor"));
+ endpoint.setEndpointName(attrs.getValue("endpointName"));
+ endpoint.setWsdlLocation(attrs.getValue("wsdlLocation"));
+ return endpoint;
+ }
+ else
+ return null;
+ }
+
+ private boolean isJMSEndpoint(final Attributes attrs)
+ {
+ if (attrs == null)
+ return false;
+ if (attrs.getValue("transportId") == null)
+ return false;
+
+ return
attrs.getValue("transportId").equals("http://cxf.apache.or...;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(JMSEndpointsMetaData endpoints, JMSEndpointMetaData
endpointMetaData, UnmarshallingContext navigator, String namespaceURI,
+ String localName)
+ {
+ endpoints.addEndpointMetaData(endpointMetaData);
+ }
+}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java 2010-07-09
11:39:54 UTC (rev 12619)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java 2010-07-09
11:54:11 UTC (rev 12620)
@@ -45,6 +45,9 @@
private List<DDEndpoint> endpoints = new ArrayList<DDEndpoint>();
// Optional additional beans.
private List<DDBean> beans = new ArrayList<DDBean>();
+
+ private List<DDJmsAddressBean> addressBeans = new
ArrayList<DDJmsAddressBean>();
+
// The derived temp file
private File tmpFile;
@@ -57,6 +60,11 @@
{
endpoints.add(service);
}
+
+ public void addAddress(DDJmsAddressBean addressBean)
+ {
+ addressBeans.add(addressBean);
+ }
public List<DDBean> getBeans()
{
@@ -104,9 +112,12 @@
"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
"xmlns:beans='http://www.springframework.org/schema/beans'
" +
"xmlns:jaxws='http://cxf.apache.org/jaxws' " +
+ "xmlns:jms='http://cxf.apache.org/transports/jms' " +
"xmlns:soap='http://cxf.apache.org/bindings/soap' " +
"xsi:schemaLocation='http://www.springframework.org/schema/beans
" +
"http://www.springframework.org/schema/beans/spring-beans.xsd " +
+ "http://cxf.apache.org/transports/jms " +
+ "http://cxf.apache.org/schemas/configuration/jms.xsd " +
"http://cxf.apache.org/jaxws " +
"http://cxf.apache.org/schemas/jaxws.xsd'>");
@@ -118,6 +129,10 @@
{
bean.writeTo(writer);
}
+
+ for (DDJmsAddressBean bean : this.addressBeans) {
+ bean.writeTo(writer);
+ }
writer.write("</beans>");
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java 2010-07-09
11:39:54 UTC (rev 12619)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java 2010-07-09
11:54:11 UTC (rev 12620)
@@ -37,9 +37,13 @@
{
//fields mapped to jboss-cxf.xml
private String id;
+
private String address;
+
private String implementor;
+
private String invoker;
+
private boolean mtomEnabled;
private String wsdlLocation;
private QName portName;
@@ -50,7 +54,6 @@
private int counter = 0;
-
public QName getPortName()
{
return portName;
@@ -135,7 +138,7 @@
{
this.invoker = invoker;
}
-
+
public void setMtomEnabled(boolean mtomEnabled)
{
this.mtomEnabled = mtomEnabled;
@@ -159,7 +162,7 @@
writer.write(" wsdlLocation='" + this.wsdlLocation +
"'");
}
writer.write(">");
-
+
if (this.mtomEnabled)
{
writer.write("<jaxws:binding>");
@@ -171,7 +174,7 @@
{
writer.write("<jaxws:invoker><bean class='" +
this.invoker + "'/></jaxws:invoker>");
}
-
+
writer.write("</jaxws:endpoint>");
}
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDJmsAddressBean.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDJmsAddressBean.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDJmsAddressBean.java 2010-07-09
11:54:11 UTC (rev 12620)
@@ -0,0 +1,85 @@
+/*
+ * 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.stack.cxf.metadata.services;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.Properties;
+
+/**
+ * DDJmsAddressBean.
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class DDJmsAddressBean
+{
+ private String portName;
+ private Properties properties;
+ private boolean isRequest = true;
+
+ public DDJmsAddressBean(String portName, boolean isRequest, Properties properties)
+ {
+ this.portName = portName;
+ this.isRequest = isRequest;
+ this.properties = properties;
+ }
+
+ public void writeTo(Writer writer) throws IOException
+ {
+ if (isRequest)
+ {
+ writer.write("<jms:destination name='" + portName +
".jms-destination'>");
+ }
+ else
+ {
+ writer.write("<jms:conduit name='" + portName +
".jms-conduit'>");
+ }
+ writer.write("<jms:address");
+ for (String name : properties.stringPropertyNames())
+ {
+ writer.write(" " + name + "='" +
properties.getProperty(name) + "'");
+ }
+ writer.write("/>");
+ if (isRequest)
+ {
+ writer.write("</jms:destination>");
+ }
+ else
+ {
+ writer.write("</jms:conduit>");
+ }
+ }
+
+ public String toString()
+ {
+ StringWriter strWriter = new StringWriter();
+ strWriter.write("JMSAddressing");
+ strWriter.write("\n portName=" + portName);
+ strWriter.write("\n isRequest=" + isRequest);
+ strWriter.write("\n");
+ properties.list(new java.io.PrintWriter(strWriter));
+ return strWriter.toString();
+ }
+
+
+}
Modified: stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml
===================================================================
---
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml 2010-07-09
11:39:54 UTC (rev 12619)
+++
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml 2010-07-09
11:54:11 UTC (rev 12620)
@@ -15,6 +15,11 @@
</list>
</property>
</bean>
+
+ <bean name="CXFJMSDescriptorProcessor"
class="org.jboss.wsf.stack.cxf.deployment.jms.JMSDescriptorProcessorImpl">
+ <property name="validating">false</property>
+ <property name="descriptorName">jbossws-cxf.xml</property>
+ </bean>
<!-- Installed Record Processors-->
<bean name="WSMemoryBufferRecorder"
class="org.jboss.wsf.framework.management.recording.MemoryBufferRecorder">
@@ -81,5 +86,16 @@
<property
name="requires">ResourceResolver,StackDescriptor</property>
<property name="forJaxRpc">false</property>
</bean>
+
+ <!---JMSEndpoints Deployment Aspect-->
+ <bean name="JMSEndpointDeploymentAspect"
class="org.jboss.wsf.stack.cxf.deployment.aspect.JMSEndpointDeploymentAspect">
+ <property name="provides">BusHolder</property>
+ <property name="forJaxRpc">false</property>
+ </bean>
+
+ <bean name="JMSEndpointRegistryDeploymentAspect"
class="org.jboss.wsf.stack.cxf.deployment.aspect.JMSEndpointRegistryDeploymentAspect">
+ <property name="requires">BusHolder</property>
+ <property name="forJaxRpc">false</property>
+ </bean>
-</deployment>
+</deployment>
\ No newline at end of file
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2010-07-09 11:39:54 UTC (rev 12619)
+++ stack/cxf/trunk/pom.xml 2010-07-09 11:54:11 UTC (rev 12620)
@@ -81,6 +81,7 @@
<log4j.version>1.2.14</log4j.version>
<mail.version>1.4.2</mail.version>
<saaj.api.version>1.0.0.Beta1</saaj.api.version>
+ <jms.api.version>1.0.0.Beta1</jms.api.version>
<velocity.version>1.5</velocity.version>
<xerces.version>2.9.1</xerces.version>
<xmlsec.version>1.4.3</xmlsec.version>
@@ -1159,6 +1160,11 @@
<artifactId>jboss-logging-spi</artifactId>
<version>${jboss.logging.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.jms</groupId>
+ <artifactId>jboss-jms-api_1.1_spec</artifactId>
+ <version>${jms.api.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>