View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.ksb.messaging.resourceloader;
17  
18  import javax.xml.namespace.QName;
19  
20  import org.kuali.rice.core.api.reflect.ObjectDefinition;
21  import org.kuali.rice.core.api.resourceloader.ResourceLoader;
22  import org.kuali.rice.core.framework.resourceloader.BaseResourceLoader;
23  import org.kuali.rice.ksb.api.bus.ServiceBus;
24  
25  /**
26   * A simple {@link ResourceLoader} implementation which delegates {@link #getService(QName)}
27   * calls to the {@link ServiceBus}. 
28   * 
29   * @author Kuali Rice Team (rice.collab@kuali.org)
30   *
31   */
32  public class ServiceBusResourceLoader extends BaseResourceLoader {
33  
34  	private final ServiceBus serviceBus;
35  	
36  	public ServiceBusResourceLoader(QName resourceLoaderName, ServiceBus serviceBus) {
37  		super(resourceLoaderName);
38  		this.serviceBus = serviceBus;
39  	}
40  	
41  	@Override
42  	public Object getObject(ObjectDefinition definition) {
43  		// object remoting has been removed!
44  		return null;
45  	}
46  
47  	/**
48  	 * This overridden method ...
49  	 * 
50  	 * @see org.kuali.rice.core.api.resourceloader.ServiceLocator#getService(javax.xml.namespace.QName)
51  	 */
52  	@Override
53  	public Object getService(QName serviceName) {
54  		return serviceBus.getService(serviceName);
55  	}
56  
57  }