001    /**
002     * Copyright 2005-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.ksb.messaging.resourceloader;
017    
018    import javax.xml.namespace.QName;
019    
020    import org.kuali.rice.core.api.reflect.ObjectDefinition;
021    import org.kuali.rice.core.api.resourceloader.ResourceLoader;
022    import org.kuali.rice.core.framework.resourceloader.BaseResourceLoader;
023    import org.kuali.rice.ksb.api.bus.ServiceBus;
024    
025    /**
026     * A simple {@link ResourceLoader} implementation which delegates {@link #getService(QName)}
027     * calls to the {@link ServiceBus}. 
028     * 
029     * @author Kuali Rice Team (rice.collab@kuali.org)
030     *
031     */
032    public class ServiceBusResourceLoader extends BaseResourceLoader {
033    
034            private final ServiceBus serviceBus;
035            
036            public ServiceBusResourceLoader(QName resourceLoaderName, ServiceBus serviceBus) {
037                    super(resourceLoaderName);
038                    this.serviceBus = serviceBus;
039            }
040            
041            @Override
042            public Object getObject(ObjectDefinition definition) {
043                    // object remoting has been removed!
044                    return null;
045            }
046    
047            /**
048             * This overridden method ...
049             * 
050             * @see org.kuali.rice.core.api.resourceloader.ServiceLocator#getService(javax.xml.namespace.QName)
051             */
052            @Override
053            public Object getService(QName serviceName) {
054                    return serviceBus.getService(serviceName);
055            }
056    
057    }