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