|
|||||||||||||||||||
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 | |||||||||||||||
ModuleImpl.java | 100% | 96% | 94.1% | 95.5% |
|
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.impl;
|
|
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.Location;
|
|
23 |
import org.apache.hivemind.Messages;
|
|
24 |
import org.apache.hivemind.internal.Module;
|
|
25 |
import org.apache.hivemind.internal.RegistryInfrastructure;
|
|
26 |
import org.apache.hivemind.internal.ServiceModelFactory;
|
|
27 |
import org.apache.hivemind.internal.ServicePoint;
|
|
28 |
import org.apache.hivemind.schema.Translator;
|
|
29 |
import org.apache.hivemind.util.IdUtils;
|
|
30 |
import org.apache.hivemind.util.ToStringBuilder;
|
|
31 |
|
|
32 |
/**
|
|
33 |
* Implementation of {@link org.apache.hivemind.internal.Module}.
|
|
34 |
*
|
|
35 |
* @author Howard Lewis Ship
|
|
36 |
*/
|
|
37 |
public final class ModuleImpl extends BaseLocatable implements Module |
|
38 |
{ |
|
39 |
private String _moduleId;
|
|
40 |
private RegistryInfrastructure _registry;
|
|
41 |
private ClassResolver _resolver;
|
|
42 |
private Messages _messages;
|
|
43 |
|
|
44 | 294 |
public List getConfiguration(String extensionPointId)
|
45 |
{ |
|
46 | 294 |
String qualifiedId = IdUtils.qualify(_moduleId, extensionPointId); |
47 |
|
|
48 | 294 |
return _registry.getConfiguration(qualifiedId);
|
49 |
} |
|
50 |
|
|
51 | 49 |
public String getModuleId()
|
52 |
{ |
|
53 | 49 |
return _moduleId;
|
54 |
} |
|
55 |
|
|
56 | 1963 |
public Object getService(String serviceId, Class serviceInterface)
|
57 |
{ |
|
58 | 1963 |
String qualifiedId = IdUtils.qualify(_moduleId, serviceId); |
59 |
|
|
60 | 1963 |
return _registry.getService(qualifiedId, serviceInterface);
|
61 |
} |
|
62 |
|
|
63 | 126 |
public Object getService(Class serviceInterface)
|
64 |
{ |
|
65 | 126 |
return _registry.getService(serviceInterface);
|
66 |
} |
|
67 |
|
|
68 | 194 |
public void setModuleId(String string) |
69 |
{ |
|
70 | 194 |
_moduleId = string; |
71 |
} |
|
72 |
|
|
73 | 195 |
public void setRegistry(RegistryInfrastructure registry) |
74 |
{ |
|
75 | 195 |
_registry = registry; |
76 |
} |
|
77 |
|
|
78 | 194 |
public void setClassResolver(ClassResolver resolver) |
79 |
{ |
|
80 | 194 |
_resolver = resolver; |
81 |
} |
|
82 |
|
|
83 | 9419 |
public ClassResolver getClassResolver()
|
84 |
{ |
|
85 | 9419 |
return _resolver;
|
86 |
} |
|
87 |
|
|
88 | 45 |
public synchronized Messages getMessages() |
89 |
{ |
|
90 | 45 |
if (_messages == null) |
91 | 8 |
_messages = new MessagesImpl(getLocation().getResource(), _registry.getLocale());
|
92 |
|
|
93 | 45 |
return _messages;
|
94 |
} |
|
95 |
|
|
96 | 4914 |
public String expandSymbols(String input, Location location)
|
97 |
{ |
|
98 | 4914 |
return _registry.expandSymbols(input, location);
|
99 |
} |
|
100 |
|
|
101 | 1 |
public String toString()
|
102 |
{ |
|
103 | 1 |
ToStringBuilder builder = new ToStringBuilder(this); |
104 |
|
|
105 | 1 |
builder.append("moduleId", _moduleId);
|
106 | 1 |
builder.append("classResolver", _resolver);
|
107 |
|
|
108 | 1 |
return builder.toString();
|
109 |
} |
|
110 |
|
|
111 | 388 |
public ServicePoint getServicePoint(String serviceId)
|
112 |
{ |
|
113 | 388 |
String qualifiedId = IdUtils.qualify(_moduleId, serviceId); |
114 |
|
|
115 | 388 |
return _registry.getServicePoint(qualifiedId);
|
116 |
} |
|
117 |
|
|
118 | 981 |
public ServiceModelFactory getServiceModelFactory(String name)
|
119 |
{ |
|
120 | 981 |
return _registry.getServiceModelFactory(name);
|
121 |
} |
|
122 |
|
|
123 | 5375 |
public Translator getTranslator(String translator)
|
124 |
{ |
|
125 | 5375 |
return _registry.getTranslator(translator);
|
126 |
} |
|
127 |
|
|
128 | 3 |
public Locale getLocale()
|
129 |
{ |
|
130 | 3 |
return _registry.getLocale();
|
131 |
} |
|
132 |
|
|
133 | 936 |
public ErrorHandler getErrorHandler()
|
134 |
{ |
|
135 | 936 |
return _registry.getErrorHander();
|
136 |
} |
|
137 |
|
|
138 | 0 |
public String valueForSymbol(String symbol)
|
139 |
{ |
|
140 | 0 |
return _registry.valueForSymbol(symbol);
|
141 |
} |
|
142 |
|
|
143 |
} |
|
144 |
|
|