|
|||||||||||||||||||
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 | |||||||||||||||
RegistryInfrastructure.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.ErrorHandler;
|
|
21 |
import org.apache.hivemind.Location;
|
|
22 |
import org.apache.hivemind.SymbolSource;
|
|
23 |
import org.apache.hivemind.schema.Translator;
|
|
24 |
|
|
25 |
/**
|
|
26 |
* Extension of {@link org.apache.hivemind.Registry} provided by some
|
|
27 |
* internals of HiveMind to fasciliate the creation of services and
|
|
28 |
* configurations.
|
|
29 |
*
|
|
30 |
* @author Howard Lewis Ship
|
|
31 |
*/
|
|
32 |
public interface RegistryInfrastructure extends SymbolSource |
|
33 |
{ |
|
34 |
/**
|
|
35 |
* Obtains a service from the registry. Typically, what's returned is a proxy,
|
|
36 |
* but that's irrelevant to the caller, which simply will invoke methods
|
|
37 |
* of the service interface.
|
|
38 |
*
|
|
39 |
* @param serviceId the fully qualified id of the service to obtain
|
|
40 |
* @param serviceInterface the class to which the service will be cast
|
|
41 |
* @return the service
|
|
42 |
* @throws ApplicationRuntimeException if the service does not exist, or if
|
|
43 |
* it can't be cast to the specified service interface
|
|
44 |
*/
|
|
45 |
|
|
46 |
public Object getService(String serviceId, Class serviceInterface);
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Finds a service that implements the provided interface. Exactly one such service may exist or an exception is thrown.
|
|
50 |
*
|
|
51 |
* @param serviceInterface used to locate the service
|
|
52 |
*/
|
|
53 |
public Object getService(Class serviceInterface);
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Returns the converted items contributed to the configuration point.
|
|
57 |
*
|
|
58 |
* @param configurationId the fully qualified id of the configuration
|
|
59 |
* @returns List of converted elements
|
|
60 |
* @throws org.apache.hivemind.ApplicationRuntimeException if no such configuration extension point exists
|
|
61 |
*/
|
|
62 |
|
|
63 |
public List getConfiguration(String configurationId);
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Returns the configuration point.
|
|
67 |
*
|
|
68 |
* @param configurationId the fully qualified id of the configuration
|
|
69 |
* @return ConfigurationPoint matching the configuration id
|
|
70 |
* @throws org.apache.hivemind.ApplicationRuntimeException if the configurationId does not exist
|
|
71 |
*/
|
|
72 |
|
|
73 |
public ConfigurationPoint getConfigurationPoint(String configurationId);
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Returns the identified service extension point.
|
|
77 |
*
|
|
78 |
* @param serviceId fully qualified id of the service point
|
|
79 |
* @throws org.apache.hivemind.ApplicationRuntimeException if no such service extension point exists
|
|
80 |
*/
|
|
81 |
|
|
82 |
public ServicePoint getServicePoint(String serviceId);
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Expands any substitution symbols in the input string, replacing
|
|
86 |
* each symbol with the symbols value (if known). If a symbol
|
|
87 |
* is unknown, then the symbol is passed
|
|
88 |
* through unchanged (complete with the <code>${</code> and <code>}</code>
|
|
89 |
* delimiters) and an error is logged.
|
|
90 |
*
|
|
91 |
* @param input input string to be converted, which may (or may not) contain
|
|
92 |
* any symbols.
|
|
93 |
* @param location the location from which the string was obtained, used if
|
|
94 |
* an error is logged.
|
|
95 |
*/
|
|
96 |
|
|
97 |
public String expandSymbols(String input, Location location);
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Returns a named service-model factory
|
|
101 |
*/
|
|
102 |
|
|
103 |
public ServiceModelFactory getServiceModelFactory(String name);
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Gets a {@link Translator} instance. The Translator may be a shared, cached
|
|
107 |
* instance (Translators should be stateless). Translators are identified by a constructor, which
|
|
108 |
* may be the name of a translator defined in the <code>hivemind.Translators</code>
|
|
109 |
* extension point (a single builtin translator, <code>class</code>,
|
|
110 |
* is hardcoded). Alternately, the name may consist of a translator name, a comma, and an
|
|
111 |
* initializer string for the service (example: <code>int,min=5</code>).
|
|
112 |
*
|
|
113 |
* @param constructor the name and optional initialization of a Translator
|
|
114 |
* @return a {@link Translator} instance
|
|
115 |
* @throws ApplicationRuntimeException if the translator can not be constructed (i.e., the name
|
|
116 |
* is not known)
|
|
117 |
*/
|
|
118 |
public Translator getTranslator(String translator);
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Returns the locale for which the registry was created.
|
|
122 |
*/
|
|
123 |
|
|
124 |
public Locale getLocale();
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Returns the {@link org.apache.hivemind.ErrorHandler} for this Registry.
|
|
128 |
*/
|
|
129 |
|
|
130 |
public ErrorHandler getErrorHander();
|
|
131 |
} |
|
132 |
|
|