01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.axis2.service;
20:
21: import org.apache.axis2.context.ServiceContext;
22: import org.apache.axis2.AxisFault;
23:
24: /**
25: * The Lifecycle interface should be implemented by your back-end service
26: * class if you wish to be notified of creation and cleanup by the Axis2
27: * framework.
28: */
29: public interface Lifecycle {
30:
31: /**
32: * init() is called when a new instance of the implementing class has been created.
33: * This occurs in sync with session/ServiceContext creation. This method gives classes
34: * a chance to do any setup work (grab resources, establish connections, etc) before
35: * they are invoked by a service request.
36: *
37: * @param context the active ServiceContext
38: * @throws AxisFault if something goes wrong. Throwing a fault here will result in either
39: * failed deployment (for application-scoped services) or failed requests.
40: */
41: void init(ServiceContext context) throws AxisFault;
42:
43: /**
44: * destroy() is called when Axis2 decides that it is finished with a particular instance
45: * of the back-end service class. It allows classes to clean up resources.
46: * @param context the active ServiceContext
47: */
48: void destroy(ServiceContext context);
49: }
|