001 /*
002 * Copyright 2001-2004 The Apache Software Foundation.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package javax.xml.rpc.server;
017
018 import javax.xml.rpc.ServiceException;
019
020 /**
021 * The <code>javax.xml.rpc.server.ServiceLifecycle</code> defines a lifecycle interface for a
022 * JAX-RPC service endpoint. If the service endpoint class implements the
023 * <code>ServiceLifeycle</code> interface, the servlet container based JAX-RPC runtime system
024 * is required to manage the lifecycle of the corresponding service endpoint objects.
025 *
026 * @version 1.0
027 */
028 public interface ServiceLifecycle {
029
030 /**
031 * Used for initialization of a service endpoint. After a service
032 * endpoint instance (an instance of a service endpoint class) is
033 * instantiated, the JAX-RPC runtime system invokes the
034 * <code>init</code> method. The service endpoint class uses the
035 * <code>init</code> method to initialize its configuration
036 * and setup access to any external resources. The context parameter
037 * in the <code>init</code> method enables the endpoint instance to
038 * access the endpoint context provided by the underlying JAX-RPC
039 * runtime system.
040 * <p>
041 * The init method implementation should typecast the context
042 * parameter to an appropriate Java type. For service endpoints
043 * deployed on a servlet container based JAX-RPC runtime system,
044 * the <code>context</code> parameter is of the Java type
045 * <code>javax.xml.rpc.server.ServletEndpointContext</code>. The
046 * <code>ServletEndpointContext</code> provides an endpoint context
047 * maintained by the underlying servlet container based JAX-RPC
048 * runtime system
049 * <p>
050 * @param context Endpoint context for a JAX-RPC service endpoint
051 * @throws ServiceException If any error in initialization of the service endpoint; or if any
052 * illegal context has been provided in the init method
053 */
054 public abstract void init(Object context) throws ServiceException;
055
056 /**
057 * JAX-RPC runtime system ends the lifecycle of a service endpoint instance by
058 * invoking the destroy method. The service endpoint releases its resources in
059 * the implementation of the destroy method.
060 */
061 public abstract void destroy();
062 }