geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r719668 - in /geronimo/server/trunk/plugins/axis2: geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/ geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/
Date Fri, 21 Nov 2008 18:28:50 GMT
Author: gawor
Date: Fri Nov 21 10:28:50 2008
New Revision: 719668

URL: http://svn.apache.org/viewvc?rev=719668&view=rev
Log:
set proper EndpointLifecycleManager for ejb web services (GERONIMO-4416)

Added:
    geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
  (with props)
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
  (with props)
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
  (with props)
Removed:
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOEndpointLifecycleManagerFactory.java
Modified:
    geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java

Added: geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java?rev=719668&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
(added)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
Fri Nov 21 10:28:50 2008
@@ -0,0 +1,40 @@
+/*
+ * 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.geronimo.axis2.ejb;
+
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleException;
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager;
+
+public class EJBEndpointLifecycleManager implements EndpointLifecycleManager {
+        
+    /* 
+     * This method is called on each web service call.
+     */
+    public Object createServiceInstance(MessageContext context, Class serviceClass) throws
EndpointLifecycleException {        
+        return null;
+    }
+    
+    public void invokePostConstruct() throws EndpointLifecycleException { 
+    }
+
+    public void invokePreDestroy() throws EndpointLifecycleException {
+    }
+   
+}

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java?rev=719668&r1=719667&r2=719668&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
Fri Nov 21 10:28:50 2008
@@ -25,8 +25,10 @@
 import javax.xml.ws.WebServiceContext;
 import javax.xml.ws.WebServiceException;
 
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager;
 import org.apache.geronimo.axis2.Axis2WebServiceContainer;
 import org.apache.geronimo.axis2.AxisServiceGenerator;
+import org.apache.geronimo.axis2.GeronimoFactoryRegistry;
 import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor;
 import org.apache.geronimo.jaxws.JNDIResolver;
 import org.apache.geronimo.jaxws.PortInfo;
@@ -76,6 +78,9 @@
         } catch (Exception e) {
             throw new WebServiceException("Error configuring handlers", e);
         }
+        
+        this.factoryRegistry = new GeronimoFactoryRegistry();
+        this.factoryRegistry.put(EndpointLifecycleManager.class, new EJBEndpointLifecycleManager());
     }
     
     @Override

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?rev=719668&r1=719667&r2=719668&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
Fri Nov 21 10:28:50 2008
@@ -60,6 +60,7 @@
 import org.apache.axis2.jaxws.handler.lifecycle.factory.HandlerLifecycleManagerFactory;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.server.JAXWSMessageReceiver;
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.factory.EndpointLifecycleManagerFactory;
 import org.apache.axis2.transport.OutTransportInfo;
 import org.apache.axis2.transport.RequestResponseTransport;
 import org.apache.axis2.transport.http.HTTPConstants;
@@ -104,6 +105,7 @@
     protected JAXWSAnnotationProcessor annotationProcessor;
     protected Context context;
     protected String address;
+    protected GeronimoFactoryRegistry factoryRegistry;   
 
     public Axis2WebServiceContainer(PortInfo portInfo,
                                     String endpointClassName,
@@ -160,6 +162,9 @@
         FactoryRegistry.setFactory(HandlerLifecycleManagerFactory.class, 
                                    new GeronimoHandlerLifecycleManagerFactory());     
         
+        FactoryRegistry.setFactory(EndpointLifecycleManagerFactory.class, 
+                                   new GeronimoEndpointLifecycleManagerFactory()); 
+        
         configureAddressing();
         
         this.service.addParameter(new Parameter(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER,
classLoader));
@@ -186,13 +191,20 @@
     }
 
     public void invoke(Request request, Response response) throws Exception {
+        // set factory registry
+        GeronimoFactoryRegistry oldRegistry = GeronimoFactoryRegistry.getGeronimoFactoryRegistry();
+        GeronimoFactoryRegistry.setGeronimoFactoryRegistry(this.factoryRegistry);
+        // set saaj universe
         SAAJUniverse universe = new SAAJUniverse();
         universe.set(SAAJUniverse.AXIS2);
         try {
             doService(request, response);
         } finally {
+            // unset saaj universe 
             universe.unset();
-        }        
+            // unset factory registry
+            GeronimoFactoryRegistry.setGeronimoFactoryRegistry(oldRegistry);
+        }
     }
 
     protected void doService(final Request request, final Response response)

Added: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java?rev=719668&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
(added)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
Fri Nov 21 10:28:50 2008
@@ -0,0 +1,36 @@
+/*
+ * 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.geronimo.axis2;
+
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleException;
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager;
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.factory.EndpointLifecycleManagerFactory;
+
+public class GeronimoEndpointLifecycleManagerFactory implements EndpointLifecycleManagerFactory
{
+
+    public EndpointLifecycleManager createEndpointLifecycleManager(Object endpointInstance)
+            throws EndpointLifecycleException {
+        throw new UnsupportedOperationException();
+    }
+
+    public EndpointLifecycleManager createEndpointLifecycleManager() {
+        return GeronimoFactoryRegistry.getGeronimoFactoryRegistry().get(EndpointLifecycleManager.class);
+    }
+    
+}

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java?rev=719668&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
(added)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
Fri Nov 21 10:28:50 2008
@@ -0,0 +1,49 @@
+/*
+ * 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.geronimo.axis2;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class GeronimoFactoryRegistry {
+
+    private static ThreadLocal<GeronimoFactoryRegistry> registry = 
+        new ThreadLocal<GeronimoFactoryRegistry>();
+
+    static void setGeronimoFactoryRegistry(GeronimoFactoryRegistry manager) {
+        registry.set(manager);
+    }
+
+    static GeronimoFactoryRegistry getGeronimoFactoryRegistry() {
+        return registry.get();
+    }   
+
+    
+    private Map<Class, Object> map = new HashMap<Class, Object>();
+
+    public <T> void put(Class<T> key, T value) {
+        map.put(key, value);
+    }
+    
+    public <T> T get(Class<T> key) {
+        return key.cast(map.get(key));
+    }
+    
+}

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java?rev=719668&r1=719667&r2=719668&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
Fri Nov 21 10:28:50 2008
@@ -31,12 +31,13 @@
 import org.apache.axis2.engine.Handler.InvocationResponse;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.server.dispatcher.factory.EndpointDispatcherFactory;
-import org.apache.axis2.jaxws.server.endpoint.lifecycle.factory.EndpointLifecycleManagerFactory;
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.HTTPTransportReceiver;
 import org.apache.axis2.transport.http.HTTPTransportUtils;
 import org.apache.axis2.transport.http.util.RESTUtil;
 import org.apache.geronimo.axis2.Axis2WebServiceContainer;
+import org.apache.geronimo.axis2.GeronimoFactoryRegistry;
 import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor;
 import org.apache.geronimo.jaxws.PortInfo;
 import org.apache.geronimo.jaxws.annotations.AnnotationHolder;
@@ -71,14 +72,11 @@
         super.init();
         
         /*
-         * This replaces EndpointLifecycleManagerFactory and EndpointDispatcherFactory
-         * for all web services. This is because we do our own endpoint instance management

-         * and injection. 
+         * This replaces EndpointDispatcherFactory for all web services. 
+         * This is because we do our own endpoint instance management and injection. 
          * This does not affect EJB web services as the EJB container does not use the FactoryRegistry
-         * to lookup the EndpointLifecycleManagerFactory or EndpointDispatcherFactory.
+         * to lookup the EndpointDispatcherFactory.
          */
-        FactoryRegistry.setFactory(EndpointLifecycleManagerFactory.class, 
-                                   new POJOEndpointLifecycleManagerFactory());
         FactoryRegistry.setFactory(EndpointDispatcherFactory.class, 
                                    new POJOEndpointDispatcherFactory());
                                       
@@ -109,6 +107,8 @@
             throw new WebServiceException("Error configuring handlers", e);
         }
         
+        this.factoryRegistry = new GeronimoFactoryRegistry();
+        this.factoryRegistry.put(EndpointLifecycleManager.class, new POJOEndpointLifecycleManager());
     }
     
     @Override



Mime
View raw message