1 /* 2 * JBoss, Home of Professional Open Source. 3 * Copyright 2006, Red Hat Middleware LLC, and individual contributors 4 * as indicated by the @author tags. See the copyright.txt file in the 5 * distribution for a full listing of individual contributors. 6 * 7 * This is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU Lesser General Public License as 9 * published by the Free Software Foundation; either version 2.1 of 10 * the License, or (at your option) any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this software; if not, write to the Free 19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 21 */ 22 package javax.xml.rpc.server; 23 24 import javax.xml.rpc.ServiceException; 25 26 /** This interface defines a lifecycle interface for a JAX-RPC service endpoint. 27 * If the service endpoint class implements the ServiceLifeycle interface, the 28 * servlet container based JAX-RPC runtime system is required to manage the 29 * lifecycle of the corresponding service endpoint objects. 30 * 31 * @author Scott.Stark@jboss.org 32 * @author Rahul Sharma (javadoc) 33 */ 34 public interface ServiceLifecycle 35 { 36 /** 37 * Used for initialization of a service endpoint. After a service endpoint instance (an instance of a service endpoint class) 38 * is instantiated, the JAX-RPC runtime system invokes the init method. 39 * The service endpoint class uses the init method to initialize its configuration and setup access to any external resources. 40 * The context parameter in the init method enables the endpoint instance to access the endpoint context provided by 41 * the underlying JAX-RPC runtime system. 42 * 43 * The init method implementation should typecast the context parameter to an appropriate Java type. 44 * For service endpoints deployed on a servlet container based JAX-RPC runtime system, the context parameter is 45 * of the Java type javax.xml.rpc.server.ServletEndpointContext. The ServletEndpointContext provides an endpoint 46 * context maintained by the underlying servlet container based JAX-RPC runtime system 47 * 48 * @param context Endpoint context for a JAX-RPC service endpoint 49 * @throws ServiceException If any error in initialization of the service endpoint; or if any illegal context has been provided in the init method 50 */ 51 public void init(Object context) throws ServiceException; 52 53 /** 54 * JAX-RPC runtime system ends the lifecycle of a service endpoint instance by invoking the destroy method. 55 * The service endpoint releases its resourcesin the implementation of the destroy method. 56 */ 57 public void destroy(); 58 }