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 2010/10/15 23:43:06 UTC

svn commit: r1023121 - in /cxf/trunk: api/src/main/java/org/apache/cxf/annotations/ rt/core/src/main/java/org/apache/cxf/bus/spring/ rt/core/src/main/java/org/apache/cxf/service/factory/ rt/core/src/main/java/org/apache/cxf/service/invoker/ rt/transpor...

Author: dkulp
Date: Fri Oct 15 21:43:05 2010
New Revision: 1023121

URL: http://svn.apache.org/viewvc?rev=1023121&view=rev
Log:
Add a FactoryType annotation to control how the service object is
constructed

Added:
    cxf/trunk/api/src/main/java/org/apache/cxf/annotations/FactoryType.java   (with props)
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/PerRequestAnnotationGreeterImpl.java   (with props)
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionAnnotationGreeterImpl.java   (with props)
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SpringAnnotationGreeterImpl.java   (with props)
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/StatefulGreeterImpl.java   (with props)
Removed:
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/resources/SessionServer_Windows.xml
Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SpringBeanFactory.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPSession.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionServer.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/resources/SessionServer.xml

Added: cxf/trunk/api/src/main/java/org/apache/cxf/annotations/FactoryType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/annotations/FactoryType.java?rev=1023121&view=auto
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/annotations/FactoryType.java (added)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/annotations/FactoryType.java Fri Oct 15 21:43:05 2010
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+/**
+ * Defines the factory used for the service.
+ * 
+ * Either use the factoryClass attribute to define your own 
+ * factory or use one of the "value" convenience enums.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.TYPE })
+public @interface FactoryType {
+
+    Type value() default Type.Singleton;
+    
+    String[] args() default { };
+    
+    /**
+     * The class for the factory.  It MUST have a constructor that takes
+     * two arguments:
+     *    1) The Class for the service
+     *    2) String[] of the args from above 
+     */
+    Class<?> factoryClass() default DEFAULT.class;
+    
+    enum Type {
+        Singleton,
+        Session,
+        Pooled, //args[0] is the size of the pool
+        PerRequest,
+        Spring, //args[0] is the Spring bean name
+    };
+    
+    static final class DEFAULT { }
+}
+

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/annotations/FactoryType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/annotations/FactoryType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java?rev=1023121&r1=1023120&r2=1023121&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java Fri Oct 15 21:43:05 2010
@@ -61,6 +61,7 @@ public class BusExtensionPostProcessor i
     private Bus getBus() {
         if (bus == null) {
             bus = (Bus)context.getBean(Bus.DEFAULT_BUS_ID);
+            bus.setExtension(context, ApplicationContext.class);
             bus.setExtension(new SpringBeanLocator(context), ConfiguredBeanLocator.class);
         }
         return bus;

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java?rev=1023121&r1=1023120&r2=1023121&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java Fri Oct 15 21:43:05 2010
@@ -27,6 +27,7 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.annotations.DataBinding;
 import org.apache.cxf.annotations.EndpointProperties;
 import org.apache.cxf.annotations.EndpointProperty;
+import org.apache.cxf.annotations.FactoryType;
 import org.apache.cxf.annotations.FastInfoset;
 import org.apache.cxf.annotations.GZIP;
 import org.apache.cxf.annotations.Logging;
@@ -46,6 +47,14 @@ import org.apache.cxf.interceptor.FIStax
 import org.apache.cxf.interceptor.InterceptorProvider;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.resource.ResourceManager;
+import org.apache.cxf.service.invoker.Factory;
+import org.apache.cxf.service.invoker.FactoryInvoker;
+import org.apache.cxf.service.invoker.Invoker;
+import org.apache.cxf.service.invoker.PerRequestFactory;
+import org.apache.cxf.service.invoker.PooledFactory;
+import org.apache.cxf.service.invoker.SessionFactory;
+import org.apache.cxf.service.invoker.SingletonFactory;
+import org.apache.cxf.service.invoker.SpringBeanFactory;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.FaultInfo;
@@ -128,6 +137,7 @@ public class AnnotationsFactoryBeanListe
                 addEndpointProperties(server.getEndpoint(), bus, props.value());
             }
             addBindingOperationDocs(server);
+            setScope(factory, server, cls);
             break;
         }
         case INTERFACE_OPERATION_BOUND: {
@@ -148,6 +158,44 @@ public class AnnotationsFactoryBeanListe
         }
     }
 
+    private void setScope(AbstractServiceFactoryBean factory, Server server, Class<?> cls) {
+        FactoryType scope = cls.getAnnotation(FactoryType.class);
+        if (scope != null) {
+            Invoker i = server.getEndpoint().getService().getInvoker();
+            if (i instanceof FactoryInvoker) {
+                Factory f;
+                if (scope.factoryClass() == FactoryType.DEFAULT.class) {
+                    switch (scope.value()) {
+                    case Session:
+                        f = new SessionFactory(cls);
+                        break;
+                    case PerRequest:
+                        f = new PerRequestFactory(cls);
+                        break;
+                    case Pooled:
+                        f = new PooledFactory(cls, Integer.parseInt(scope.args()[0]));
+                        break;
+                    case Spring:
+                        f = new SpringBeanFactory(scope.args()[0]);
+                        break;
+                    default:
+                        f = new SingletonFactory(cls);
+                        break;
+                    }
+                } else {
+                    try {
+                        f = (Factory)scope.factoryClass().getConstructor(Class.class, String[].class)
+                            .newInstance(cls, scope.args());
+                    } catch (Throwable t) {
+                        throw new ServiceConstructionException(t);
+                    }
+                }
+                ((FactoryInvoker)i).setFactory(f);
+            }
+            
+        }
+    }
+
     private void addEndpointProperties(Endpoint ep, Bus bus, EndpointProperty ... annotations) {
         for (EndpointProperty prop : annotations) {
             if (prop == null) {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java?rev=1023121&r1=1023120&r2=1023121&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java Fri Oct 15 21:43:05 2010
@@ -33,7 +33,7 @@ import org.apache.cxf.message.Exchange;
 public class FactoryInvoker extends AbstractInvoker {
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(FactoryInvoker.class);
 
-    private final Factory factory;
+    private Factory factory;
 
     /**
      * Create a FactoryInvoker object.
@@ -43,6 +43,11 @@ public class FactoryInvoker extends Abst
     public FactoryInvoker(Factory factory) {
         this.factory = factory;
     }
+    public FactoryInvoker() {
+    }
+    public void setFactory(Factory f) {
+        this.factory = f;
+    }
 
     public Object getServiceObject(Exchange ex) {
         try {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java?rev=1023121&r1=1023120&r2=1023121&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java Fri Oct 15 21:43:05 2010
@@ -42,10 +42,10 @@ public class SessionFactory implements F
         Service serv = e.get(Service.class);
         Object o = null;
         synchronized (serv) {
-            o = e.getSession().get(serv.getName());
+            o = e.getSession().get(serv.getName().toString());
             if (o == null) {
                 o = factory.create(e);
-                e.getSession().put(serv.getName(), o);
+                e.getSession().put(serv.getName().toString(), o);
             }
         }
         return o;

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SpringBeanFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SpringBeanFactory.java?rev=1023121&r1=1023120&r2=1023121&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SpringBeanFactory.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/SpringBeanFactory.java Fri Oct 15 21:43:05 2010
@@ -43,6 +43,9 @@ public class SpringBeanFactory implement
     
     /** {@inheritDoc}*/
     public Object create(Exchange e) throws Throwable {
+        if (ctx == null) {
+            ctx = e.getBus().getExtension(ApplicationContext.class);
+        }
         return ctx.getBean(beanName);
     }
 

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPSession.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPSession.java?rev=1023121&r1=1023120&r2=1023121&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPSession.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPSession.java Fri Oct 15 21:43:05 2010
@@ -39,11 +39,11 @@ public class HTTPSession implements Sess
     }
 
     public Object get(Object key) {
-        return getSession().getAttribute((String)key);
+        return getSession().getAttribute(key.toString());
     }
 
     public void put(Object key, Object value) {
-        getSession().setAttribute((String)key, value);
+        getSession().setAttribute(key.toString(), value);
     }
 
     public HttpSession getSession() {

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java?rev=1023121&r1=1023120&r2=1023121&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java (original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java Fri Oct 15 21:43:05 2010
@@ -175,4 +175,69 @@ public class ClientServerSessionTest ext
         
     }
     
+    @Test    
+    public void testInvocationWithSessionFactory() throws Exception {
+        doSessionsTest("http://localhost:" + PORT + "/Stateful1");
+    }
+    @Test    
+    public void testInvocationWithSessionAnnotation() throws Exception {
+        doSessionsTest("http://localhost:" + PORT + "/Stateful2");
+    }
+    @Test    
+    public void testInvocationWithPerRequestAnnotation() throws Exception {
+        GreeterService service = new GreeterService();
+        assertNotNull(service);
+
+        Greeter greeter = service.getGreeterPort();
+        BindingProvider bp = (BindingProvider)greeter;
+        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
+                                   "http://localhost:" + PORT + "/PerRequest");
+        bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+        String result = greeter.greetMe("World");
+        assertEquals("Hello World", result);
+        assertEquals("Bonjour default", greeter.sayHi());
+    }
+    @Test    
+    public void testInvocationWithSpringBeanAnnotation() throws Exception {
+        GreeterService service = new GreeterService();
+        assertNotNull(service);
+
+        Greeter greeter = service.getGreeterPort();
+        BindingProvider bp = (BindingProvider)greeter;
+        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
+                                   "http://localhost:" + PORT + "/SpringBean");
+        bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+        String result = greeter.greetMe("World");
+        assertEquals("Hello World", result);
+        assertEquals("Bonjour World", greeter.sayHi());
+    }
+    
+    private void doSessionsTest(String url) {
+        GreeterService service = new GreeterService();
+        assertNotNull(service);
+
+        Greeter greeter = service.getGreeterPort();
+        Greeter greeter2 = service.getGreeterPort();
+        
+        BindingProvider bp = (BindingProvider)greeter;
+
+        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
+        bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+
+        bp = (BindingProvider)greeter2;
+
+        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
+        bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+
+        String result = greeter.greetMe("World");
+        assertEquals("Hello World", result);
+        assertEquals("Bonjour World", greeter.sayHi());
+        
+        result = greeter2.greetMe("Universe");
+        assertEquals("Hello Universe", result);
+        assertEquals("Bonjour Universe", greeter2.sayHi());
+        
+        //make sure session 1 was maintained
+        assertEquals("Bonjour World", greeter.sayHi());
+    }
 }

Added: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/PerRequestAnnotationGreeterImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/PerRequestAnnotationGreeterImpl.java?rev=1023121&view=auto
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/PerRequestAnnotationGreeterImpl.java (added)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/PerRequestAnnotationGreeterImpl.java Fri Oct 15 21:43:05 2010
@@ -0,0 +1,98 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.http;
+
+import java.util.concurrent.Future;
+
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+
+import org.apache.cxf.annotations.FactoryType;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.types.GreetMeResponse;
+import org.apache.cxf.greeter_control.types.PingMeResponse;
+import org.apache.cxf.greeter_control.types.SayHiResponse;
+
+@WebService(serviceName = "GreeterService",
+            portName = "GreeterPort",
+            endpointInterface = "org.apache.cxf.greeter_control.Greeter", 
+            targetNamespace = "http://cxf.apache.org/greeter_control")
+@FactoryType(FactoryType.Type.PerRequest)
+public class PerRequestAnnotationGreeterImpl implements Greeter {
+    String name = "default";
+    
+    // greetMe will use session to return last called name
+    public String greetMe(String me) {
+        name = me;
+        return "Hello " + me;
+    }
+    
+
+    public String sayHi() {
+        return "Bonjour " + name;
+    }
+    
+    public void pingMe() {
+    }
+
+
+    public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<GreetMeResponse> greetMeAsync(String requestType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public void greetMeOneWay(String requestType) {
+        // TODO Auto-generated method stub
+        
+    }
+
+
+    public Future<?> pingMeAsync(AsyncHandler<PingMeResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<PingMeResponse> pingMeAsync() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<SayHiResponse> sayHiAsync() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/PerRequestAnnotationGreeterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/PerRequestAnnotationGreeterImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionAnnotationGreeterImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionAnnotationGreeterImpl.java?rev=1023121&view=auto
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionAnnotationGreeterImpl.java (added)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionAnnotationGreeterImpl.java Fri Oct 15 21:43:05 2010
@@ -0,0 +1,101 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.http;
+
+import java.util.concurrent.Future;
+
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+
+import org.apache.cxf.annotations.FactoryType;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.types.GreetMeResponse;
+import org.apache.cxf.greeter_control.types.PingMeResponse;
+import org.apache.cxf.greeter_control.types.SayHiResponse;
+
+@WebService(serviceName = "GreeterService",
+            portName = "GreeterPort",
+            endpointInterface = "org.apache.cxf.greeter_control.Greeter", 
+            targetNamespace = "http://cxf.apache.org/greeter_control")
+@FactoryType(FactoryType.Type.Session)
+public class SessionAnnotationGreeterImpl implements Greeter {
+    String name;
+    
+    public SessionAnnotationGreeterImpl() {
+    }
+    
+    // greetMe will use session to return last called name
+    public String greetMe(String me) {
+        name = me;
+        return "Hello " + me;
+    }
+    
+
+    public String sayHi() {
+        return "Bonjour " + name;
+    }
+    
+    public void pingMe() {
+    }
+
+
+    public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<GreetMeResponse> greetMeAsync(String requestType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public void greetMeOneWay(String requestType) {
+        // TODO Auto-generated method stub
+        
+    }
+
+
+    public Future<?> pingMeAsync(AsyncHandler<PingMeResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<PingMeResponse> pingMeAsync() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<SayHiResponse> sayHiAsync() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionAnnotationGreeterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionAnnotationGreeterImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionServer.java?rev=1023121&r1=1023120&r2=1023121&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionServer.java (original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SessionServer.java Fri Oct 15 21:43:05 2010
@@ -21,8 +21,6 @@ package org.apache.cxf.systest.http;
 
 import java.net.URL;
 
-import javax.xml.ws.Endpoint;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
@@ -32,21 +30,12 @@ public class SessionServer extends Abstr
 
     @Override
     protected void run() {
-        Object implementor;
-        String address;
         String configurationFile = "resources/SessionServer.xml";
-        if (System.getProperty("os.name").startsWith("Windows")) {
-            configurationFile = "resources/SessionServer_Windows.xml";
-        }
         URL configure =
             SessionServer.class.getResource(configurationFile);
         System.out.println("the configure is " + configure);
         Bus bus = new SpringBusFactory().createBus(configure, true);
         SpringBusFactory.setDefaultBus(bus);
-        implementor = new GreeterSessionImpl();
-        address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";
-        Endpoint.publish(address, implementor);
-        
     }
     
     public static void main(String[] args) {

Added: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SpringAnnotationGreeterImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SpringAnnotationGreeterImpl.java?rev=1023121&view=auto
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SpringAnnotationGreeterImpl.java (added)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SpringAnnotationGreeterImpl.java Fri Oct 15 21:43:05 2010
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.http;
+
+import java.util.concurrent.Future;
+
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+
+import org.apache.cxf.annotations.FactoryType;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.types.GreetMeResponse;
+import org.apache.cxf.greeter_control.types.PingMeResponse;
+import org.apache.cxf.greeter_control.types.SayHiResponse;
+
+@WebService(serviceName = "GreeterService",
+            portName = "GreeterPort",
+            endpointInterface = "org.apache.cxf.greeter_control.Greeter", 
+            targetNamespace = "http://cxf.apache.org/greeter_control")
+@FactoryType(value = FactoryType.Type.Spring, args = { "SpringBean" })
+public class SpringAnnotationGreeterImpl implements Greeter {
+    String name;
+    
+    
+    // greetMe will use session to return last called name
+    public String greetMe(String me) {
+        name = me;
+        return "Hello " + me;
+    }
+    
+
+    public String sayHi() {
+        return "Bonjour " + name;
+    }
+    
+    public void pingMe() {
+    }
+
+
+    public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<GreetMeResponse> greetMeAsync(String requestType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public void greetMeOneWay(String requestType) {
+        // TODO Auto-generated method stub
+        
+    }
+
+
+    public Future<?> pingMeAsync(AsyncHandler<PingMeResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<PingMeResponse> pingMeAsync() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<SayHiResponse> sayHiAsync() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SpringAnnotationGreeterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/SpringAnnotationGreeterImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/StatefulGreeterImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/StatefulGreeterImpl.java?rev=1023121&view=auto
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/StatefulGreeterImpl.java (added)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/StatefulGreeterImpl.java Fri Oct 15 21:43:05 2010
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.http;
+
+import java.util.concurrent.Future;
+
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.types.GreetMeResponse;
+import org.apache.cxf.greeter_control.types.PingMeResponse;
+import org.apache.cxf.greeter_control.types.SayHiResponse;
+
+@WebService(serviceName = "GreeterService",
+            portName = "GreeterPort",
+            endpointInterface = "org.apache.cxf.greeter_control.Greeter", 
+            targetNamespace = "http://cxf.apache.org/greeter_control")
+public class StatefulGreeterImpl implements Greeter {
+    String name;
+    
+    // greetMe will use session to return last called name
+    public String greetMe(String me) {
+        name = me;
+        return "Hello " + me;
+    }
+    
+
+    public String sayHi() {
+        return "Bonjour " + name;
+    }
+    
+    public void pingMe() {
+    }
+
+
+    public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<GreetMeResponse> greetMeAsync(String requestType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public void greetMeOneWay(String requestType) {
+        // TODO Auto-generated method stub
+        
+    }
+
+
+    public Future<?> pingMeAsync(AsyncHandler<PingMeResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<PingMeResponse> pingMeAsync() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Response<SayHiResponse> sayHiAsync() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/StatefulGreeterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/StatefulGreeterImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/resources/SessionServer.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/resources/SessionServer.xml?rev=1023121&r1=1023120&r2=1023121&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/resources/SessionServer.xml (original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/resources/SessionServer.xml Fri Oct 15 21:43:05 2010
@@ -22,7 +22,7 @@
   xmlns:sec="http://cxf.apache.org/configuration/security"
   xmlns:http="http://cxf.apache.org/transports/http/configuration"
   xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
-  xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
+  xmlns:jaxws="http://cxf.apache.org/jaxws"
   xsi:schemaLocation="
   		   http://cxf.apache.org/configuration/security
   		      http://cxf.apache.org/schemas/configuration/security.xsd
@@ -30,6 +30,8 @@
               http://cxf.apache.org/schemas/configuration/http-conf.xsd
            http://cxf.apache.org/transports/http-jetty/configuration
               http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+           http://cxf.apache.org/jaxws     
+              http://cxf.apache.org/schemas/jaxws.xsd
            http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans.xsd">
   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
@@ -37,6 +39,37 @@
   <httpj:engine-factory bus="cxf">
 	 <httpj:engine port="${testutil.ports.SessionServer}">
 	     <httpj:sessionSupport>true</httpj:sessionSupport>	    
+         <httpj:reuseAddress>false</httpj:reuseAddress>
 	  </httpj:engine>
-   </httpj:engine-factory>  
+   </httpj:engine-factory>
+   
+   <jaxws:endpoint 
+       address="http://localhost:${testutil.ports.SessionServer}/SoapContext/GreeterPort"
+       implementor="org.apache.cxf.systest.http.GreeterSessionImpl"/> 
+        
+        
+   <jaxws:endpoint address="http://localhost:${testutil.ports.SessionServer}/Stateful1"
+       implementorClass="org.apache.cxf.systest.http.StatefulGreeterImpl">
+       <jaxws:invoker>
+           <bean class="org.apache.cxf.jaxws.JAXWSMethodInvoker">
+                <constructor-arg>
+                    <bean class="org.apache.cxf.service.invoker.SessionFactory">
+                        <constructor-arg value="org.apache.cxf.systest.http.StatefulGreeterImpl"/>
+                    </bean>
+                </constructor-arg>
+           </bean>
+       </jaxws:invoker>
+   </jaxws:endpoint>
+       
+   <jaxws:endpoint address="http://localhost:${testutil.ports.SessionServer}/Stateful2"
+       implementorClass="org.apache.cxf.systest.http.SessionAnnotationGreeterImpl"/>
+       
+   <jaxws:endpoint address="http://localhost:${testutil.ports.SessionServer}/PerRequest"
+       implementorClass="org.apache.cxf.systest.http.PerRequestAnnotationGreeterImpl"/>
+
+   <bean id="SpringBean" class="org.apache.cxf.systest.http.SpringAnnotationGreeterImpl"/>
+
+   <jaxws:endpoint address="http://localhost:${testutil.ports.SessionServer}/SpringBean"
+       implementorClass="org.apache.cxf.systest.http.SpringAnnotationGreeterImpl"/>
+         
 </beans>
\ No newline at end of file