KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > annotations > TypedRegistry


1 // Copyright 2007 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.annotations;
16
17 import org.apache.hivemind.service.Autowiring;
18
19 /**
20  * Specialized interface for the {@link org.apache.hivemind.Registry} access from annotated modules.
21  * Implements typed access to services and configurations by use of Generics.
22  *
23  * @author Achim Huegen
24  */

25 public interface TypedRegistry
26 {
27     /**
28      * Returns a service from the registry.
29      *
30      * @see org.apache.hivemind.Registry#getService(String, Class)
31      */

32     public <T> T getService(String JavaDoc serviceId, Class JavaDoc<T> serviceInterface);
33
34     /**
35      * Finds a service that implements the provided interface.
36      * Exactly one such service may exist or an exception is thrown.
37      *
38      * @see org.apache.hivemind.Registry#getService(Class)
39      */

40     public <T> T getService(Class JavaDoc<T> serviceInterface);
41     
42     /**
43      * Returns the specified configuration from the registry.
44      *
45      * @see org.apache.hivemind.Registry#getConfiguration(String)
46      */

47     public <T> T getConfiguration(String JavaDoc configurationId, Class JavaDoc<T> configurationType);
48     
49     /**
50      * Finds a configuration by its type.
51      * Exactly one such configuration may exist or an exception is thrown.
52      *
53      * @see org.apache.hivemind.Registry#getConfiguration(String)
54      */

55     public <T> T getConfiguration(Class JavaDoc<T> configurationType);
56     
57
58     /**
59      * Returns a reference to the {@link Autowiring} service.
60      */

61     public Autowiring getAutowiring();
62     
63     /**
64      * @see org.apache.hivemind.Registry#shutdown()
65      */

66     public void shutdown();
67 }
68
Popular Tags