001 // Copyright 2004, 2005 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 015 package org.apache.hivemind.impl; 016 017 import java.util.List; 018 import java.util.Locale; 019 import java.util.Map; 020 021 import org.apache.hivemind.Location; 022 import org.apache.hivemind.Messages; 023 import org.apache.hivemind.Registry; 024 import org.apache.hivemind.internal.Module; 025 import org.apache.hivemind.internal.RegistryInfrastructure; 026 027 /** 028 * Implementation of {@link org.apache.hivemind.Registry} that delegates to an instance of 029 * {@link org.apache.hivemind.internal.RegistryInfrastructure}. 030 * 031 * @since 1.1 032 */ 033 public class RegistryImpl implements Registry 034 { 035 private RegistryInfrastructure _infrastructure; 036 037 public RegistryImpl(RegistryInfrastructure infrastructure) 038 { 039 _infrastructure = infrastructure; 040 } 041 042 public boolean containsConfiguration(String configurationId) 043 { 044 return _infrastructure.containsConfiguration(configurationId, null); 045 } 046 047 public boolean containsService(Class serviceInterface) 048 { 049 return _infrastructure.containsService(serviceInterface, null); 050 } 051 052 public boolean containsService(String serviceId, Class serviceInterface) 053 { 054 return _infrastructure.containsService(serviceId, serviceInterface, null); 055 } 056 057 public List getConfiguration(String configurationId) 058 { 059 return _infrastructure.getConfiguration(configurationId, null); 060 } 061 062 public boolean isConfigurationMappable(String configurationId) 063 { 064 return _infrastructure.isConfigurationMappable(configurationId, null); 065 } 066 067 public Map getConfigurationAsMap(String configurationId) 068 { 069 return _infrastructure.getConfigurationAsMap(configurationId, null); 070 } 071 072 public String expandSymbols(String input, Location location) 073 { 074 return _infrastructure.expandSymbols(input, location); 075 } 076 077 public Object getService(String serviceId, Class serviceInterface) 078 { 079 return _infrastructure.getService(serviceId, serviceInterface, null); 080 } 081 082 public Object getService(Class serviceInterface) 083 { 084 return _infrastructure.getService(serviceInterface, null); 085 } 086 087 public Locale getLocale() 088 { 089 return _infrastructure.getLocale(); 090 } 091 092 public void shutdown() 093 { 094 _infrastructure.shutdown(); 095 } 096 097 public void cleanupThread() 098 { 099 _infrastructure.cleanupThread(); 100 } 101 102 public String valueForSymbol(String name) 103 { 104 return _infrastructure.valueForSymbol(name); 105 } 106 107 /** @since 1.1 */ 108 public void setupThread() 109 { 110 _infrastructure.setupThread(); 111 } 112 113 /** 114 * @since 1.1 115 */ 116 public List getServiceIds(Class serviceInterface) 117 { 118 return _infrastructure.getServiceIds(serviceInterface); 119 } 120 121 /** 122 * @since 1.1 123 */ 124 public Messages getModuleMessages(String moduleId) 125 { 126 final Module module = _infrastructure.getModule(moduleId); 127 return module == null ? null : module.getMessages(); 128 } 129 }