You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2015/03/19 18:45:24 UTC

cxf git commit: Fix the jaxws:server and simple:server problems in blueprint

Repository: cxf
Updated Branches:
  refs/heads/master 237ace40e -> 4eec754b1


Fix the jaxws:server and simple:server problems in blueprint


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4eec754b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4eec754b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4eec754b

Branch: refs/heads/master
Commit: 4eec754b1bbd46e0142412cd37dbaf189c47f905
Parents: 237ace4
Author: Daniel Kulp <dk...@apache.org>
Authored: Thu Mar 19 13:44:51 2015 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Thu Mar 19 13:44:51 2015 -0400

----------------------------------------------------------------------
 .../blueprint/JAXWSBPNamespaceHandler.java      | 41 +++++++++++++++++++-
 .../ServerFactoryBeanDefinitionParser.java      | 40 ++++++++++++++++++-
 2 files changed, 79 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4eec754b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/blueprint/JAXWSBPNamespaceHandler.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/blueprint/JAXWSBPNamespaceHandler.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/blueprint/JAXWSBPNamespaceHandler.java
index 4d3b58d..cf6112e 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/blueprint/JAXWSBPNamespaceHandler.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/blueprint/JAXWSBPNamespaceHandler.java
@@ -27,10 +27,13 @@ import org.w3c.dom.Node;
 
 import org.apache.aries.blueprint.NamespaceHandler;
 import org.apache.aries.blueprint.ParserContext;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.frontend.blueprint.ClientProxyFactoryBeanDefinitionParser;
 import org.apache.cxf.frontend.blueprint.ServerFactoryBeanDefinitionParser;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 import org.osgi.service.blueprint.reflect.ComponentMetadata;
 import org.osgi.service.blueprint.reflect.Metadata;
@@ -54,7 +57,7 @@ public class JAXWSBPNamespaceHandler implements NamespaceHandler {
         if ("endpoint".equals(s)) {
             return new EndpointDefinitionParser().parse(element, context);
         } else if ("server".equals(s)) {
-            return new ServerFactoryBeanDefinitionParser(JaxWsServerFactoryBean.class)
+            return new ServerFactoryBeanDefinitionParser(BPJaxWsServerFactoryBean.class)
                 .parse(element, context);
         } else if ("client".equals(s)) {
             return new ClientProxyFactoryBeanDefinitionParser(JaxWsProxyFactoryBean.class)
@@ -80,4 +83,40 @@ public class JAXWSBPNamespaceHandler implements NamespaceHandler {
         this.blueprintContainer = blueprintContainer;
     }
     
+    
+    
+    @NoJSR250Annotations
+    public static class BPJaxWsServerFactoryBean extends JaxWsServerFactoryBean {
+
+        private Server server;
+
+        public BPJaxWsServerFactoryBean() {
+            super();
+        }
+        public BPJaxWsServerFactoryBean(JaxWsServiceFactoryBean fact) {
+            super(fact);
+        }
+        public Server getServer() {
+            return server;
+        }
+        
+        public void init() {
+            create();
+        }
+        @Override
+        public Server create() {
+            if (server == null) {
+                server = super.create();
+            }
+            return server;
+        }
+        public void destroy() {
+            if (server != null) {
+                server.destroy();
+                server = null;
+            }
+        }
+    }
+    
+    
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/4eec754b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/blueprint/ServerFactoryBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/blueprint/ServerFactoryBeanDefinitionParser.java b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/blueprint/ServerFactoryBeanDefinitionParser.java
index 4426262..3ff9364 100644
--- a/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/blueprint/ServerFactoryBeanDefinitionParser.java
+++ b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/blueprint/ServerFactoryBeanDefinitionParser.java
@@ -24,9 +24,12 @@ import org.w3c.dom.Element;
 
 import org.apache.aries.blueprint.ParserContext;
 import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.blueprint.SimpleBPBeanDefinitionParser;
+import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean;
 import org.osgi.service.blueprint.reflect.Metadata;
 
 
@@ -35,7 +38,7 @@ public class ServerFactoryBeanDefinitionParser extends SimpleBPBeanDefinitionPar
     
 
     public ServerFactoryBeanDefinitionParser() {
-        this(ServerFactoryBean.class);
+        this(BPServerFactoryBean.class);
     }
     public ServerFactoryBeanDefinitionParser(Class<?> cls) {
         super(cls);
@@ -97,4 +100,39 @@ public class ServerFactoryBeanDefinitionParser extends SimpleBPBeanDefinitionPar
     protected boolean hasBusProperty() {
         return true;
     }
+    
+    
+    @NoJSR250Annotations
+    public static class BPServerFactoryBean extends ServerFactoryBean {
+
+        private Server server;
+
+        public BPServerFactoryBean() {
+            super();
+        }
+        public BPServerFactoryBean(ReflectionServiceFactoryBean fact) {
+            super(fact);
+        }
+        public Server getServer() {
+            return server;
+        }
+        
+        public void init() {
+            create();
+        }
+        @Override
+        public Server create() {
+            if (server == null) {
+                server = super.create();
+            }
+            return server;
+        }
+        public void destroy() {
+            if (server != null) {
+                server.destroy();
+                server = null;
+            }
+        }
+    }
+    
 }