01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: **/package org.araneaframework.framework;
16:
17: import java.io.Serializable;
18: import org.araneaframework.Service;
19:
20: /**
21: * A managed service context provides the means to have more control over
22: * child services. A good example is {@link org.araneaframework.framework.router.StandardThreadServiceRouterService}
23: * which handles requests from multiple threads(windows) in the same session by having
24: * different children for different windows and the current service id is determined via
25: * <code>getCurrentId()</code>.
26: * <br><br>
27: *
28: * @author "Toomas Römer" <toomas@webmedia.ee>
29: * @author Jevgeni Kabanov (ekabanov <i>at</i> araneaframework <i>dot</i> org)
30: */
31: public interface ManagedServiceContext extends Serializable {
32: /**
33: * Returns the id of the current service.
34: */
35: public Object getCurrentId();
36:
37: /**
38: * Adds a child service with the specified id.
39: */
40: public Service addService(Object id, Service service);
41:
42: /**
43: * Adds a child service with the specified id, and specifies that service may
44: * be killed by service manager after it has been inactive for specified time.
45: * When the service is killed or whether it is killed at all is up to the
46: * implementation.
47: */
48: public Service addService(Object id, Service service,
49: Long timeToLive);
50:
51: /**
52: * @return a child service with the specified id.
53: */
54: public Service getService(Object id);
55:
56: /**
57: * Closes the service under the key id.
58: */
59: public void close(Object id);
60: }
|