01: // Copyright 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // 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.tapestry.ioc.internal;
16:
17: import org.apache.tapestry.ioc.AnnotationProvider;
18: import org.apache.tapestry.ioc.Registry;
19: import org.apache.tapestry.ioc.ObjectLocator;
20:
21: /**
22: * A wrapper around {@link InternalRegistry} that exists to expand symbols in a service id before
23: * invoking {@link ObjectLocator#getService(Class)}.
24: */
25: public class RegistryWrapper implements Registry {
26: private final InternalRegistry _registry;
27:
28: public RegistryWrapper(final InternalRegistry registry) {
29: _registry = registry;
30: }
31:
32: public void cleanupThread() {
33: _registry.cleanupThread();
34: }
35:
36: public void shutdown() {
37: _registry.shutdown();
38: }
39:
40: public <T> T getObject(Class<T> objectType,
41: AnnotationProvider annotationProvider) {
42: return _registry.getObject(objectType, null);
43: }
44:
45: public <T> T getService(String serviceId, Class<T> serviceInterface) {
46: String expandedServiceId = _registry.expandSymbols(serviceId);
47:
48: return _registry
49: .getService(expandedServiceId, serviceInterface);
50: }
51:
52: public <T> T getService(Class<T> serviceInterface) {
53: return _registry.getService(serviceInterface);
54: }
55:
56: public <T> T autobuild(Class<T> clazz) {
57: return _registry.autobuild(clazz);
58: }
59:
60: public void eagerLoadServices() {
61: _registry.eagerLoadServices();
62: }
63:
64: }
|