View Javadoc

1   /*
2    * Copyright 2007-2008 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.service;
17  
18  import java.util.Map;
19  
20  import org.apache.cxf.Bus;
21  import org.apache.cxf.bus.CXFBusImpl;
22  import org.apache.cxf.endpoint.ServerRegistry;
23  import org.kuali.rice.ksb.messaging.MessageHelper;
24  import org.kuali.rice.ksb.messaging.threadpool.KSBScheduledPool;
25  import org.kuali.rice.ksb.messaging.threadpool.KSBThreadPool;
26  
27  
28  public class KSBContextServiceLocator {
29  
30  	private Map services;
31  	
32      public static final String THREAD_POOL_SERVICE = "enThreadPool";
33      public static final String SCHEDULED_THREAD_POOL_SERVICE = "enScheduledThreadPool";    
34  
35      public Object getService(String name) {
36          return services.get(name);
37      }
38  
39      /**
40  	 * @return the services
41  	 */
42  	public Map getServices() {
43  		return this.services;
44  	}
45  
46  	/**
47  	 * @param services the services to set
48  	 */
49  	public void setServices(Map services) {
50  		this.services = services;
51  	}
52  
53      public MessageHelper getMessageHelper() {
54          return (MessageHelper) getService("enMessageHelper");
55      }
56  
57      public KSBThreadPool getThreadPool() {
58          return (KSBThreadPool) getService(THREAD_POOL_SERVICE);
59      }
60  
61      public KSBScheduledPool getScheduledPool() {
62          return (KSBScheduledPool) getService(SCHEDULED_THREAD_POOL_SERVICE);
63      }
64  
65      public Bus getCXFBus(){
66      	return (CXFBusImpl) getService("cxf");
67      }
68      
69      public ServerRegistry getCXFServerRegistry(){
70      	return (ServerRegistry)getService("org.apache.cxf.endpoint.ServerRegistry");
71      }
72  
73  
74  }