KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > internal > ServiceModel


1 // Copyright 2004, 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.hivemind.internal;
16
17 /**
18  * A service model is associated with a {@link org.apache.hivemind.internal.ServicePoint} to supply
19  * rules for the lifecycle of the service. This concerns when the service is first created and
20  * whether it is pooled, etc. Each service extension point will have a unique instance of
21  * ServiceModel.
22  *
23  * @author Howard Lewis Ship
24  */

25 public interface ServiceModel
26 {
27     public static final String JavaDoc PRIMITIVE = "primitive";
28     public static final String JavaDoc SINGLETON = "singleton";
29     public static final String JavaDoc THREADED = "threaded";
30     public static final String JavaDoc POOLED = "pooled";
31     
32     
33     /**
34      * Invoked by the service extension point to obtain the service implementation. The model may
35      * return the actual service implementation or some form of proxy.
36      * <p>
37      * This method is only invoked <em>once</em>; the returned value is used from that point on
38      * (in all threads, by all callers). Most models return a proxy that takes care of realizing the
39      * service (actually creating the service, configuring it, and wrapping it with interceptors)
40      * only when needed.
41      */

42
43     public Object JavaDoc getService();
44
45     /**
46      * Forces the core service implementation (and any interceptors) to be fully instantiated
47      * immediately, rather than waiting for the first service method invocation. This is used when a
48      * service needs to be "eagerly loaded" rather than "lazy loaded".
49      */

50     public void instantiateService();
51 }
Popular Tags