View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package javax.xml.rpc.server;
17  
18  import javax.xml.rpc.ServiceException;
19  
20  /**
21   * The <code>javax.xml.rpc.server.ServiceLifecycle</code> defines a lifecycle interface for a
22   * JAX-RPC service endpoint. If the service endpoint class implements the
23   * <code>ServiceLifeycle</code>  interface, the servlet container based JAX-RPC runtime system
24   * is required to manage the lifecycle of the corresponding service endpoint objects.
25   *
26   * @version 1.0
27   */
28  public interface ServiceLifecycle {
29  
30      /**
31       * Used for initialization of a service endpoint. After a service
32       * endpoint instance (an instance of a service endpoint class) is
33       * instantiated, the JAX-RPC runtime system invokes the
34       * <code>init</code> method. The service endpoint class uses the
35       * <code>init</code> method to initialize its configuration
36       * and setup access to any external resources. The context parameter
37       * in the <code>init</code> method enables the endpoint instance to
38       * access the endpoint context provided by the underlying JAX-RPC
39       * runtime system.
40       * <p>
41       * The init method implementation should typecast the context
42       * parameter to an appropriate Java type. For service endpoints
43       * deployed on a servlet container based JAX-RPC runtime system,
44       * the <code>context</code> parameter is of the Java type
45       * <code>javax.xml.rpc.server.ServletEndpointContext</code>. The
46       * <code>ServletEndpointContext</code> provides an endpoint context
47       * maintained by the underlying servlet container based JAX-RPC
48       * runtime system
49       * <p>
50       * @param context Endpoint context for a JAX-RPC service endpoint
51       * @throws ServiceException  If any error in initialization of the service endpoint; or if any
52       * illegal context has been provided in the init method
53       */
54      public abstract void init(Object context) throws ServiceException;
55  
56      /**
57       * JAX-RPC runtime system ends the lifecycle of a service endpoint instance by
58       * invoking the destroy method. The service endpoint releases its resources in
59       * the implementation of the destroy method.
60       */
61      public abstract void destroy();
62  }