Home » geronimo-2.2-source-release » org.apache.geronimo.axis2.pojo » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one
    3    * or more contributor license agreements.  See the NOTICE file
    4    * distributed with this work for additional information
    5    * regarding copyright ownership.  The ASF licenses this file
    6    * to you under the Apache License, Version 2.0 (the
    7    * "License"); you may not use this file except in compliance
    8    * with the License.  You may obtain a copy of the License at
    9    * 
   10    *      http://www.apache.org/licenses/LICENSE-2.0
   11    *      
   12    * Unless required by applicable law or agreed to in writing,
   13    * software distributed under the License is distributed on an
   14    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   15    * KIND, either express or implied.  See the License for the
   16    * specific language governing permissions and limitations
   17    * under the License.
   18    */
   19   package org.apache.geronimo.axis2.pojo;
   20   
   21   import org.apache.axis2.context.ServiceContext;
   22   import org.apache.axis2.jaxws.context.WebServiceContextImpl;
   23   import org.apache.axis2.jaxws.context.factory.MessageContextFactory;
   24   import org.apache.axis2.jaxws.core.MessageContext;
   25   import org.apache.axis2.jaxws.handler.SoapMessageContext;
   26   import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleException;
   27   import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager;
   28   
   29   public class POJOEndpointLifecycleManager implements EndpointLifecycleManager {
   30           
   31       /* 
   32        * This method is called on each web service call.
   33        */
   34       public Object createServiceInstance(MessageContext context, Class serviceClass) throws EndpointLifecycleException {
   35           org.apache.axis2.context.MessageContext msgContext = context.getAxisMessageContext();
   36           
   37           ServiceContext serviceContext = msgContext.getServiceContext();                
   38           Object instance = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
   39           
   40           SoapMessageContext soapMessageContext =
   41               MessageContextFactory.createSoapMessageContext(context);
   42           WebServiceContextImpl wsContext = new WebServiceContextImpl();
   43           wsContext.setSoapMessageContext(soapMessageContext);
   44           
   45           // associate JAX-WS MessageContext with the thread
   46           POJOWebServiceContext.set(wsContext);
   47           
   48           return instance;
   49       }
   50       
   51       public void invokePostConstruct() throws EndpointLifecycleException { 
   52       }
   53   
   54       public void invokePreDestroy() throws EndpointLifecycleException {
   55       }
   56      
   57   }

Home » geronimo-2.2-source-release » org.apache.geronimo.axis2.pojo » [javadoc | source]