KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.apache.hivemind.definition.ServicePointDefinition;
18
19 /**
20  * Sub-interface of {@link org.apache.hivemind.internal.ExtensionPoint} that defines a service
21  * extension point. A service may have a single factory contribution, and any number of interceptor
22  * contributions.
23  *
24  * @author Howard Lewis Ship
25  */

26 public interface ServicePoint extends ExtensionPoint
27 {
28     /**
29      * Returns the type of the service, the interface the service implements. This may be a
30      * synthetic interface when the interface for the service point is, in fact, a class.
31      * It equals the class returned by {@link #getDeclaredInterface()} if the declared interface
32      * is a real interface and not a class.
33      */

34     public Class JavaDoc getServiceInterface();
35
36     /**
37      * Returns the interface for the service as specified in the descriptor; starting with release
38      * 1.1 it is possible to define a service in terms of a class (as the interface).
39      * In that case the POJO class is returned here.
40      *
41      * @since 1.1
42      */

43     public Class JavaDoc getDeclaredInterface();
44
45     /**
46      * Returns the fully qualified class name of the service interface. This is useful so that
47      * loading the actual service interface class can be deferred as late as possible. This is the
48      * value, as specified in the descriptor (except that simple names in the descriptor are
49      * prefixed with the module's package name). Starting in release 1.1, this may be the name of a
50      * ordinary class, not an interface.
51      *
52      * @since 1.1
53      */

54
55     public String JavaDoc getServiceInterfaceClassName();
56
57     /**
58      * Obtains the full service implementation for this service extension point, an object that
59      * implements the service interface. Because of the different service models, and because of the
60      * possibility of interceptors, the exact class and object returned can't be specified (and may
61      * vary at different times), but that is not relevant to client code, which is assured that it
62      * can invoke the service methods defined by the service interface.
63      *
64      * @param interfaceClass
65      * the class that the service will be cast to; a check is made that the service is
66      * assignable to the indicated interface. It does not have to, necessarily, match the
67      * service interface (it could be a super-interface, for example).
68      * @return the outermost interceptor for the service, or the core implementation if there are no
69      * interceptors.
70      * @throws org.apache.hivemind.ApplicationRuntimeException
71      * if there is any problem creating the service.
72      */

73     public Object JavaDoc getService(Class JavaDoc interfaceClass);
74
75     /**
76      * Forces the service to be fully instantiated immediately, rather than lazily.
77      */

78
79     public void forceServiceInstantiation();
80     
81     public ServicePointDefinition getServicePointDefinition();
82
83 }
Popular Tags