001// Copyright 2007, 2010, 2011 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.tapestry5.ioc.internal; 016 017import org.apache.tapestry5.ioc.AnnotationProvider; 018import org.apache.tapestry5.ioc.ObjectLocator; 019import org.apache.tapestry5.ioc.Registry; 020 021import java.lang.annotation.Annotation; 022 023/** 024 * A wrapper around {@link InternalRegistry} that exists to expand symbols in a service id before 025 * invoking {@link ObjectLocator#getService(String, Class)}. 026 */ 027public class RegistryWrapper implements Registry 028{ 029 private final InternalRegistry registry; 030 031 public RegistryWrapper(final InternalRegistry registry) 032 { 033 this.registry = registry; 034 } 035 036 public void cleanupThread() 037 { 038 registry.cleanupThread(); 039 } 040 041 public void shutdown() 042 { 043 registry.shutdown(); 044 } 045 046 public <T> T getObject(Class<T> objectType, AnnotationProvider annotationProvider) 047 { 048 return registry.getObject(objectType, annotationProvider); 049 } 050 051 public <T> T getService(String serviceId, Class<T> serviceInterface) 052 { 053 String expandedServiceId = registry.expandSymbols(serviceId); 054 055 return registry.getService(expandedServiceId, serviceInterface); 056 } 057 058 public <T> T getService(Class<T> serviceInterface) 059 { 060 return registry.getService(serviceInterface); 061 } 062 063 public <T> T getService(Class<T> serviceInterface, Class<? extends Annotation>... markerTypes) 064 { 065 return registry.getService(serviceInterface, markerTypes); 066 } 067 068 public <T> T autobuild(Class<T> clazz) 069 { 070 return registry.autobuild(clazz); 071 } 072 073 public <T> T autobuild(String description, Class<T> clazz) 074 { 075 return registry.autobuild(description, clazz); 076 } 077 078 public void performRegistryStartup() 079 { 080 registry.performRegistryStartup(); 081 } 082 083 public <T> T proxy(Class<T> interfaceClass, Class<? extends T> implementationClass) 084 { 085 return registry.proxy(interfaceClass, implementationClass); 086 } 087 088}