Author: gawor
Date: Fri Nov 21 11:15:36 2008
New Revision: 719675
URL: http://svn.apache.org/viewvc?rev=719675&view=rev
Log:
set proper EndpointLifecycleManager for ejb web services (GERONIMO-4416)
Added:
geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
(with props)
geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
(with props)
geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
(with props)
Removed:
geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOEndpointLifecycleManagerFactory.java
Modified:
geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
Added: geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java?rev=719675&view=auto
==============================================================================
--- geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
(added)
+++ geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
Fri Nov 21 11:15:36 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/branches/2.1/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBEndpointLifecycleManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java?rev=719675&r1=719674&r2=719675&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
(original)
+++ geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
Fri Nov 21 11:15:36 2008
@@ -25,9 +25,10 @@
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceException;
-import org.apache.axis2.util.JavaUtils;
+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;
@@ -77,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/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?rev=719675&r1=719674&r2=719675&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
(original)
+++ geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
Fri Nov 21 11:15:36 2008
@@ -55,6 +55,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;
@@ -98,6 +99,7 @@
protected Binding binding;
protected JAXWSAnnotationProcessor annotationProcessor;
protected Context context;
+ protected GeronimoFactoryRegistry factoryRegistry;
public Axis2WebServiceContainer(PortInfo portInfo,
String endpointClassName,
@@ -150,7 +152,10 @@
* HandlerResolver.
*/
FactoryRegistry.setFactory(HandlerLifecycleManagerFactory.class,
- new GeronimoHandlerLifecycleManagerFactory());
+ new GeronimoHandlerLifecycleManagerFactory());
+
+ FactoryRegistry.setFactory(EndpointLifecycleManagerFactory.class,
+ new GeronimoEndpointLifecycleManagerFactory());
}
protected AxisServiceGenerator createServiceGenerator() {
@@ -162,13 +167,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/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java?rev=719675&view=auto
==============================================================================
--- geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
(added)
+++ geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
Fri Nov 21 11:15:36 2008
@@ -0,0 +1,38 @@
+/*
+ * 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 extends EndpointLifecycleManagerFactory
{
+
+ @Override
+ public EndpointLifecycleManager createEndpointLifecycleManager(Object endpointInstance)
+ throws EndpointLifecycleException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public EndpointLifecycleManager createEndpointLifecycleManager() {
+ return GeronimoFactoryRegistry.getGeronimoFactoryRegistry().get(EndpointLifecycleManager.class);
+ }
+
+}
Propchange: geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoEndpointLifecycleManagerFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java?rev=719675&view=auto
==============================================================================
--- geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
(added)
+++ geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
Fri Nov 21 11:15:36 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/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/GeronimoFactoryRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java?rev=719675&r1=719674&r2=719675&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
(original)
+++ geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
Fri Nov 21 11:15:36 2008
@@ -30,7 +30,7 @@
import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.Handler.InvocationResponse;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
-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;
@@ -38,6 +38,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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;
@@ -69,13 +70,6 @@
public void init() throws Exception {
super.init();
- /*
- * This replaces EndpointLifecycleManagerFactory for all web services.
- * This should be ok as we do our own endpoint instance management and injection.
- */
- FactoryRegistry.setFactory(EndpointLifecycleManagerFactory.class,
- new POJOEndpointLifecycleManagerFactory());
-
String servicePath = trimContext(getServicePath(this.contextRoot));
this.configurationContext.setServicePath(servicePath);
//need to setContextRoot after servicePath as cachedServicePath is only built
@@ -103,6 +97,8 @@
throw new WebServiceException("Error configuring handlers", e);
}
+ this.factoryRegistry = new GeronimoFactoryRegistry();
+ this.factoryRegistry.put(EndpointLifecycleManager.class, new POJOEndpointLifecycleManager());
}
@Override
|