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