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.kim.config;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  import org.kuali.rice.core.config.ModuleConfigurer;
22  import org.kuali.rice.core.config.event.RiceConfigEvent;
23  import org.kuali.rice.core.config.event.RiceConfigEventListener;
24  
25  /**
26   * This class handles the Spring based KIM configuration that is part of the Rice Configurer that must 
27   * exist in all Rice based systems and clients. 
28   * 
29   * @author Kuali Rice Team (rice.collab@kuali.org)
30   */
31  public class KIMConfigurer extends ModuleConfigurer {
32  	private static final String KIM_INTERFACE_SPRING_BEANS_PATH = "classpath:org/kuali/rice/kim/config/KIMInterfaceSpringBeans.xml";
33  	private static final String KIM_IMPL_SPRING_BEANS_PATH = "classpath:org/kuali/rice/kim/config/KIMImplementationSpringBeans.xml";
34  	private static final String KIM_KSB_SPRING_BEANS_PATH = "classpath:org/kuali/rice/kim/config/KIMServiceBusSpringBeans.xml";
35  	private static final String KIM_KSB_SOAP_DEFAULT_SPRING_BEANS_PATH = "classpath:org/kuali/rice/kim/config/KIMServiceBusSOAPDefaultSpringBeans.xml";
36  	private static final String KIM_UI_SPRING_BEANS_PATH = "classpath:org/kuali/rice/kim/config/KIMUserInterfaceSpringBeans.xml";
37  	
38  	private List<RiceConfigEventListener> configEventListeners = new ArrayList<RiceConfigEventListener>();
39  
40  	/**
41  	 * 
42  	 */
43  	public KIMConfigurer() {
44  		super();
45  		setModuleName( "KIM" );
46  		setHasWebInterface( true );
47  		VALID_RUN_MODES.remove( THIN_RUN_MODE );
48  	}
49  
50  	@Override
51  	public String getSpringFileLocations() {
52  		StringBuffer springFileLocations = new StringBuffer( KIM_INTERFACE_SPRING_BEANS_PATH );
53  		if ( getRunMode().equals( LOCAL_RUN_MODE ) || getRunMode().equals( EMBEDDED_RUN_MODE ) ) {
54  			springFileLocations.append(',').append(KIM_IMPL_SPRING_BEANS_PATH);
55  		}
56  		if ( exposeServicesOnBus ) {
57  			if (setSOAPServicesAsDefault) {
58  				springFileLocations.append(',').append(KIM_KSB_SOAP_DEFAULT_SPRING_BEANS_PATH);
59  			} else {
60  				springFileLocations.append(',').append(KIM_KSB_SPRING_BEANS_PATH);
61  			}
62  		}
63  		if ( includeUserInterfaceComponents ) {
64  			springFileLocations.append(',').append(KIM_UI_SPRING_BEANS_PATH);
65  		}
66  		return springFileLocations.toString();
67  	}
68  	
69  	public void registerConfigEventListener(RiceConfigEventListener listener) {
70  		configEventListeners.add(listener);
71  	}
72  	
73  	/**
74  	 * This overridden method ...
75  	 * 
76  	 * @see org.kuali.rice.core.config.ModuleConfigurer#onEvent(org.kuali.rice.core.config.event.RiceConfigEvent)
77  	 */
78  	@Override
79  	public void onEvent(RiceConfigEvent event) throws Exception {
80  		super.onEvent(event);
81  		for (RiceConfigEventListener listener : configEventListeners) {
82  			listener.onEvent(event);
83  		}
84  	}
85  
86  }