geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r545929 - in /geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2: ejb/ pojo/
Date Sun, 10 Jun 2007 20:19:48 GMT
Author: gawor
Date: Sun Jun 10 13:19:47 2007
New Revision: 545929

URL: http://svn.apache.org/viewvc?view=rev&rev=545929
Log:
handler injection for ejb-based ws

Modified:
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBInterceptor.java
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBMessageReceiver.java
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBInterceptor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBInterceptor.java?view=diff&rev=545929&r1=545928&r2=545929
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBInterceptor.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBInterceptor.java
Sun Jun 10 13:19:47 2007
@@ -42,14 +42,18 @@
     private static final Log LOG = LogFactory.getLog(EJBInterceptor.class);
 
     private MessageContext requestMsgCtx;
+    private EJBWebServiceContainer container;
 
-    public EJBInterceptor(MessageContext requestCtx) {
+    public EJBInterceptor(EJBWebServiceContainer container, MessageContext requestCtx) {
+        this.container = container;
         this.requestMsgCtx = requestCtx;
     }
 
     @AroundInvoke
     public Object intercept(javax.interceptor.InvocationContext invContext) throws Exception
{
                 
+        this.container.injectHandlers();
+        
         AxisOperation operation = this.requestMsgCtx.getAxisMessageContext().getAxisOperation();
         String mep = operation.getMessageExchangePattern();
         

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBMessageReceiver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBMessageReceiver.java?view=diff&rev=545929&r1=545928&r2=545929
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBMessageReceiver.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBMessageReceiver.java
Sun Jun 10 13:19:47 2007
@@ -45,8 +45,10 @@
     
     private DeploymentInfo deploymentInfo;
     private Class serviceImplClass;
+    private EJBWebServiceContainer container;
 
-    public EJBMessageReceiver(Class serviceImplClass, DeploymentInfo deploymentInfo) {
+    public EJBMessageReceiver(EJBWebServiceContainer container, Class serviceImplClass, DeploymentInfo
deploymentInfo) {
+        this.container = container;
         this.serviceImplClass = serviceImplClass;
         this.deploymentInfo = deploymentInfo;
     }
@@ -70,7 +72,7 @@
             LOG.debug("Invoking '" + method.getName() + "' method.");
         }
         
-        EJBInterceptor interceptor = new EJBInterceptor(requestMsgCtx);
+        EJBInterceptor interceptor = new EJBInterceptor(this.container, requestMsgCtx);
 
         ProtectedMessageContext jaxwsContext = new ProtectedMessageContext(requestMsgCtx);
         

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java?view=diff&rev=545929&r1=545928&r2=545929
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
Sun Jun 10 13:19:47 2007
@@ -20,10 +20,16 @@
 import java.net.URL;
 
 import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
 
 import org.apache.axis2.util.JavaUtils;
 import org.apache.geronimo.axis2.Axis2WebServiceContainer;
 import org.apache.geronimo.axis2.AxisServiceGenerator;
+import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor;
+import org.apache.geronimo.jaxws.JNDIResolver;
 import org.apache.geronimo.jaxws.PortInfo;
 import org.apache.openejb.DeploymentInfo;
 
@@ -46,9 +52,23 @@
     }
     
     @Override
+    public void init() throws Exception { 
+        super.init();
+        
+        // configure handlers
+        try {
+            configureHandlers();
+        } catch (Exception e) {
+            throw new WebServiceException("Error configuring handlers", e);
+        }
+    }
+    
+    @Override
     protected AxisServiceGenerator createServiceGenerator() {
         AxisServiceGenerator serviceGenerator = super.createServiceGenerator();
-        serviceGenerator.setMessageReceiver(new EJBMessageReceiver(this.endpointClass, this.deploymnetInfo));
+        EJBMessageReceiver messageReceiver = 
+            new EJBMessageReceiver(this, this.endpointClass, this.deploymnetInfo);
+        serviceGenerator.setMessageReceiver(messageReceiver);
         return serviceGenerator;
     }
     
@@ -83,5 +103,31 @@
             //when setContextRoot is called.
             configurationContext.setContextRoot(contextRoot);  
         } 
+    }
+    
+    public synchronized void injectHandlers() {
+        if (this.annotationProcessor != null) {
+            // assume injection was already done
+            return;
+        }
+        
+        WebServiceContext wsContext = null;
+        try {
+            InitialContext ctx = new InitialContext();
+            wsContext = (WebServiceContext) ctx.lookup("java:comp/WebServiceContext");
+        } catch (NamingException e) {
+            throw new WebServiceException("Failed to lookup WebServiceContext", e);
+        }
+        
+        this.annotationProcessor = new JAXWSAnnotationProcessor(new JNDIResolver(), wsContext);
+        super.injectHandlers();
+    }
+    
+    @Override
+    public void destroy() {
+        // call handler preDestroy
+        destroyHandlers();
+        
+        super.destroy();
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java?view=diff&rev=545929&r1=545928&r2=545929
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java
Sun Jun 10 13:19:47 2007
@@ -85,7 +85,7 @@
     public void doStart() throws Exception {
     }
 
-    public void doStop() throws Exception {        
+    public void doStop() throws Exception {
         if (this.soapHandler != null) {
             this.soapHandler.removeWebService(this.location);
         } 

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java?view=diff&rev=545929&r1=545928&r2=545929
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
Sun Jun 10 13:19:47 2007
@@ -60,13 +60,13 @@
     }
     
     @Override
-    public void init() throws Exception {
+    public void init() throws Exception { 
+        super.init();
+        
         // XXX: This is a global operation
         FactoryRegistry.setFactory(EndpointLifecycleManagerFactory.class, 
                                    new POJOEndpointLifecycleManagerFactory());
-        
-        super.init();
-        
+               
         this.endpointInstance = this.endpointClass.newInstance();
         
         this.configurationContext.setServicePath(this.portInfo.getLocation());



Mime
View raw message