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