|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
Module.java | - | - | - | - |
|
1 |
// Copyright 2004 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 java.util.List;
|
|
18 |
import java.util.Locale;
|
|
19 |
|
|
20 |
import org.apache.hivemind.ClassResolver;
|
|
21 |
import org.apache.hivemind.ErrorHandler;
|
|
22 |
import org.apache.hivemind.Locatable;
|
|
23 |
import org.apache.hivemind.Location;
|
|
24 |
import org.apache.hivemind.Messages;
|
|
25 |
import org.apache.hivemind.SymbolSource;
|
|
26 |
import org.apache.hivemind.schema.Translator;
|
|
27 |
|
|
28 |
/**
|
|
29 |
* The definition of a HiveMind Module. A Module is
|
|
30 |
* a container of service extension points and
|
|
31 |
* configuration extension points. It also acts as a "gateway" so that services
|
|
32 |
* and configurations in other modules may be accessed.
|
|
33 |
*
|
|
34 |
* <p>
|
|
35 |
* Why do we expose the Module rather than the {@link org.apache.hivemind.internal.RegistryInfrastructure}?
|
|
36 |
* It's more than just qualifying ids before passing them up to the RI.
|
|
37 |
* At some future point, a concept of visibility will be added to HiveMind. This will make many services
|
|
38 |
* and configurations private to the module which defines them and the necessary visibility filtering
|
|
39 |
* logic will be here.
|
|
40 |
*
|
|
41 |
* @author Howard Lewis Ship
|
|
42 |
*/
|
|
43 |
public interface Module extends Locatable, SymbolSource |
|
44 |
{ |
|
45 |
/**
|
|
46 |
* Returns the unique identifier for this module.
|
|
47 |
*/
|
|
48 |
public String getModuleId();
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Looks up
|
|
52 |
* the {@link ServicePoint} (throwing an exception if not found)
|
|
53 |
* and invokes {@link ServicePoint#getService(Class)}.
|
|
54 |
*
|
|
55 |
* @param serviceId an unqualified id for a service within this module, or a fully qualified id for a service in this or any other module
|
|
56 |
* @param serviceInterface type the result will be cast to
|
|
57 |
*/
|
|
58 |
public Object getService(String serviceId, Class serviceInterface);
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Finds a service that implements the provided interface. Exactly one such service may exist or an exception is thrown.
|
|
62 |
*
|
|
63 |
* @param serviceInterface used to locate the service
|
|
64 |
*/
|
|
65 |
public Object getService(Class serviceInterface);
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Returns the identified service extension point.
|
|
69 |
*
|
|
70 |
* @param serviceId an unqualified id for a service within this module, or a fully qualified id for a service in this or any other module
|
|
71 |
* @throws org.apache.hivemind.ApplicationRuntimeException if no such service extension point exists
|
|
72 |
*/
|
|
73 |
|
|
74 |
public ServicePoint getServicePoint(String serviceId);
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Returns the {@link java.util.List} of elements for the
|
|
78 |
* specified configuration point. The returned List
|
|
79 |
* is unmodifiable. It may be empty, but won't be null.
|
|
80 |
*
|
|
81 |
* <p>It is expressly the <em>caller's</em> job to sort the elements
|
|
82 |
* into an appropriate order (a copy will have to be made since
|
|
83 |
* the returned List is unmodifiable).
|
|
84 |
*
|
|
85 |
* @param configurationId an unqualified id for a configuration within this module, or a fully qualified id for a configuration in this or any other module
|
|
86 |
* @throws ApplicationRuntimeException if this module does not
|
|
87 |
* contain the specified configuration extension point.
|
|
88 |
*
|
|
89 |
*/
|
|
90 |
public List getConfiguration(String configurationId);
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Returns the resource resolver for this module. The resource resolver
|
|
94 |
* is used to locate classes by name (using the correct classloader).
|
|
95 |
*/
|
|
96 |
|
|
97 |
public ClassResolver getClassResolver();
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Returns an object that can provide and format localized messages for this
|
|
101 |
* module. The messages come from a properties file,
|
|
102 |
* <code>hivemodule.properties</code> (localized)
|
|
103 |
* stored with the HiveMind deployment descriptor in the META-INF folder.
|
|
104 |
*/
|
|
105 |
|
|
106 |
public Messages getMessages();
|
|
107 |
|
|
108 |
/**
|
|
109 |
* @see RegistryInfrastructure#getTranslator(String)
|
|
110 |
*/
|
|
111 |
public Translator getTranslator(String translator);
|
|
112 |
|
|
113 |
/**
|
|
114 |
* @see RegistryInfrastructure#getServiceModelFactory(String)
|
|
115 |
*/
|
|
116 |
public ServiceModelFactory getServiceModelFactory(String name);
|
|
117 |
|
|
118 |
/**
|
|
119 |
* @see org.apache.hivemind.Registry#getLocale()
|
|
120 |
*/
|
|
121 |
public Locale getLocale();
|
|
122 |
|
|
123 |
/**
|
|
124 |
* @see org.apache.hivemind.internal.RegistryInfrastructure#expandSymbols(String, Location)
|
|
125 |
*
|
|
126 |
*/
|
|
127 |
public String expandSymbols(String input, Location location);
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Returns the {@link org.apache.hivemind.ErrorHandler} for this Registry.
|
|
131 |
*/
|
|
132 |
|
|
133 |
public ErrorHandler getErrorHandler();
|
|
134 |
} |
|
135 |
|
|