[jbossws-commits] JBossWS SVN: r14191 - in stack/cxf/branches/cxf24/modules: server/src/main/java/org/jboss/wsf/stack/cxf/configuration and 1 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Sun Apr 24 20:10:24 EDT 2011


Author: alessio.soldano at jboss.com
Date: 2011-04-24 20:10:23 -0400 (Sun, 24 Apr 2011)
New Revision: 14191

Removed:
   stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerSpringConfigurer.java
Modified:
   stack/cxf/branches/cxf24/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSSpringConfigurer.java
   stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
   stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/parser/JaxwsEndpointDefinitionParser.java
Log:
fixing configurer integration w/ spring


Modified: stack/cxf/branches/cxf24/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSSpringConfigurer.java
===================================================================
--- stack/cxf/branches/cxf24/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSSpringConfigurer.java	2011-04-24 22:04:33 UTC (rev 14190)
+++ stack/cxf/branches/cxf24/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSSpringConfigurer.java	2011-04-25 00:10:23 UTC (rev 14191)
@@ -22,6 +22,11 @@
 package org.jboss.wsf.stack.cxf.client.configuration;
 
 import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.configuration.spring.ConfigurerImpl;
+import org.apache.cxf.extension.BusExtension;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
 
 /**
  * A CXF delegate configurer that sets JBossWS stuff / customizations / properties etc. in CXF configurable beans
@@ -30,7 +35,7 @@
  * @author alessio.soldano at jboss.com
  * @since 05-Oct-2009
  */
-public class JBossWSSpringConfigurer implements JBossWSConfigurer
+public class JBossWSSpringConfigurer implements JBossWSConfigurer, ApplicationContextAware, BusExtension
 {
    private BeanCustomizer customizer;
    private Configurer delegate;
@@ -54,6 +59,14 @@
       delegate.configureBean(name, beanInstance);
    }
    
+   public void addApplicationContext(ApplicationContext ctx)
+   {
+      if (delegate instanceof ConfigurerImpl)
+      {
+         ((ConfigurerImpl)delegate).addApplicationContext(ctx);
+      }
+   }
+   
    protected synchronized void customConfigure(Object beanInstance)
    {
       if (customizer != null)
@@ -71,4 +84,23 @@
    {
       this.customizer = customizer;
    }
+
+   @Override
+   public Class<?> getRegistrationType()
+   {
+      if (delegate instanceof BusExtension)
+      {
+         return ((BusExtension)delegate).getRegistrationType();
+      }
+      throw new RuntimeException("Delegate is not a BusExtension instance: " + delegate);
+   }
+
+   @Override
+   public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
+   {
+      if (delegate instanceof ApplicationContextAware)
+      {
+         ((ApplicationContextAware)delegate).setApplicationContext(applicationContext);
+      }
+   }
 }

Deleted: stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerSpringConfigurer.java
===================================================================
--- stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerSpringConfigurer.java	2011-04-24 22:04:33 UTC (rev 14190)
+++ stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerSpringConfigurer.java	2011-04-25 00:10:23 UTC (rev 14191)
@@ -1,46 +0,0 @@
-/*
- * 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.configuration;
-
-import org.apache.cxf.configuration.Configurer;
-import org.apache.cxf.configuration.spring.ConfigurerImpl;
-import org.jboss.wsf.stack.cxf.client.configuration.JBossWSSpringConfigurer;
-import org.springframework.context.ApplicationContext;
-
-/**
- * A JBossWS CXF Configurer (Spring based) to be used on server side
- * 
- * @author alessio.soldano at jboss.com
- * @author ema at redhat.com
- * @since 31-Mar-2010
- */
-public class JBossWSServerSpringConfigurer extends JBossWSSpringConfigurer
-{
-   public JBossWSServerSpringConfigurer(Configurer delegate, ApplicationContext ctx)
-   {
-      super(delegate);
-      if (delegate instanceof ConfigurerImpl)
-      {
-         ((ConfigurerImpl)delegate).setApplicationContext(ctx);
-      }
-   }
-}

Modified: stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
===================================================================
--- stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java	2011-04-24 22:04:33 UTC (rev 14190)
+++ stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java	2011-04-25 00:10:23 UTC (rev 14191)
@@ -42,6 +42,7 @@
 import org.jboss.wsf.spi.binding.BindingCustomization;
 import org.jboss.wsf.spi.deployment.Endpoint;
 import org.jboss.wsf.stack.cxf.client.configuration.JBossWSSpringBusFactory;
+import org.jboss.wsf.stack.cxf.client.configuration.JBossWSSpringConfigurer;
 import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
 import org.jboss.wsf.stack.cxf.spring.handler.NamespaceHandlerResolver;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
@@ -159,7 +160,9 @@
       customizer.setBindingCustomization(customization);
       customizer.setWsdlPublisher(wsdlPublisher);
       customizer.setDeploymentEndpoints(depEndpoints);
-      JBossWSServerSpringConfigurer serverConfigurer = new JBossWSServerSpringConfigurer(bus.getExtension(Configurer.class), ctx);
+      Configurer orig = bus.getExtension(Configurer.class);
+      JBossWSSpringConfigurer serverConfigurer = (orig instanceof JBossWSSpringConfigurer) ? (JBossWSSpringConfigurer)orig : new JBossWSSpringConfigurer(orig);
+      serverConfigurer.setApplicationContext(ctx);
       serverConfigurer.setCustomizer(customizer);
       return serverConfigurer;
    }

Modified: stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/parser/JaxwsEndpointDefinitionParser.java
===================================================================
--- stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/parser/JaxwsEndpointDefinitionParser.java	2011-04-24 22:04:33 UTC (rev 14190)
+++ stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/parser/JaxwsEndpointDefinitionParser.java	2011-04-25 00:10:23 UTC (rev 14191)
@@ -22,9 +22,10 @@
 package org.jboss.wsf.stack.cxf.spring.parser;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
+import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.jaxws.spring.EndpointDefinitionParser;
+import org.jboss.wsf.stack.cxf.client.configuration.JBossWSSpringConfigurer;
 import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
@@ -63,9 +64,13 @@
       {
          if (getBus() == null)
          {
-            Bus bus = BusFactory.getThreadDefaultBus();
-            BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(bus, ctx);
+            Bus bus = BusWiringBeanFactoryPostProcessor.addDefaultBus(ctx);
             setBus(bus);
+            Configurer configurer = bus.getExtension(Configurer.class);
+            if (configurer instanceof JBossWSSpringConfigurer)
+            {
+               ((JBossWSSpringConfigurer) configurer).addApplicationContext(ctx);
+            }
          }
       }
    }



More information about the jbossws-commits mailing list