Java 类javax.xml.rpc.server.ServiceLifecycle 实例源码

项目:jbossws-common    文件:InvocationHandlerJAXRPC.java   
/**
 * Calls {@link javax.xml.rpc.server.ServiceLifecycle#init(Object)}
 * method on target bean if this bean implements 
 * {@link javax.xml.rpc.server.ServiceLifecycle} interface.
 *
 * @param invocation current invocation
 * @throws Exception if any error occurs
 */
@Override
public void onBeforeInvocation(final Invocation invocation) throws Exception
{
   final InvocationContext invocationContext = invocation.getInvocationContext();
   final Object targetBean = invocationContext.getTargetBean();
   final boolean isJaxrpcLifecycleBean = targetBean instanceof ServiceLifecycle;

   if (isJaxrpcLifecycleBean)
   {
      final ServletEndpointContext sepContext = invocationContext.getAttachment(ServletEndpointContext.class);
      ((ServiceLifecycle) targetBean).init(sepContext);
   }
}
项目:jbossws-common    文件:InvocationHandlerJAXRPC.java   
/**
 * Calls {@link javax.xml.rpc.server.ServiceLifecycle#destroy()}
 * method on target bean if this bean implements 
 * {@link javax.xml.rpc.server.ServiceLifecycle} interface.
 *
 * @param invocation current invocation
 * @throws Exception if any error occurs
 */
@Override
public void onAfterInvocation(final Invocation invocation) throws Exception
{
   final InvocationContext invocationContext = invocation.getInvocationContext();
   final Object targetBean = invocationContext.getTargetBean();
   final boolean isJaxrpcLifecycleBean = targetBean instanceof ServiceLifecycle;

   if (isJaxrpcLifecycleBean)
   {
      ((ServiceLifecycle) targetBean).destroy();
   }
}
项目:tomee    文件:WsServlet.java   
public void init(ServletConfig config) throws ServletException {
    this.config = config;

    // this is only used by JaxRPC pojo services
    pojo = createPojoInstance();
    if (pojo instanceof ServiceLifecycle) {
        try {
            ((ServiceLifecycle) pojo).init(new InstanceContext(config.getServletContext()));
        } catch (ServiceException e) {
            throw new ServletException("Unable to initialize ServiceEndpoint", e);
        }
    }
    getService();
}
项目:tomee    文件:WsServlet.java   
public void destroy() {
    if (pojo instanceof ServiceLifecycle) {
        ((ServiceLifecycle) pojo).destroy();
    }
}