View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2006 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  package ch.elca.el4j.core.context;
18  
19  import org.springframework.context.ApplicationContext;
20  
21  /**
22   * This class describes the configuration of a ModuleApplicationContext. It can
23   * be used to specify how a ModuleApplicationContext should be configured
24   * without actually creating the application context.
25   *
26   * @svnLink $Revision: 4204 $;$Date: 2010-11-02 11:44:37 +0100 (Di, 02. Nov 2010) $;$Author: swisswheel $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/core/src/main/java/ch/elca/el4j/core/context/ModuleApplicationContextConfiguration.java $
27   *
28   * @author Alex Mathey (AMA)
29   * @author Martin Zeltner (MZE)
30   */
31  public class ModuleApplicationContextConfiguration {
32  	/**
33  	 * @see #setInclusiveConfigLocations(String[])
34  	 */
35  	private String[] m_inclusiveConfigLocations = new String[0];
36  
37  	/**
38  	 * @see #setExclusiveConfigLocations(String[])
39  	 */
40  	private String[] m_exclusiveConfigLocations = new String[0];
41  
42  	/**
43  	 * @see #isAllowBeanDefinitionOverriding()
44  	 */
45  	private boolean m_allowBeanDefinitionOverriding = false;
46  	
47  	/**
48  	 * @see #isMergeWithOuterResources()
49  	 */
50  	private boolean m_mergeWithOuterResources = true;
51  	
52  	/**
53  	 * @see #isMostSpecificResourceLast()
54  	 */
55  	private boolean m_mostSpecificResourceLast = false;
56  	
57  	/**
58  	 * @see #isMostSpecificBeanDefinitionCounts()
59  	 */
60  	private boolean m_mostSpecificBeanDefinitionCounts = true;
61  
62  	/**
63  	 * @see #setParent(ApplicationContext)
64  	 */
65  	private ApplicationContext m_parent = null;
66  	
67  	/**
68  	 * @see #setModuleApplicationContextCreationListener(ModuleApplicationContextCreationListener)
69  	 */
70  	private ModuleApplicationContextCreationListener m_moduleApplicationContextCreationListener;
71  
72  	/**
73  	 * @return Returns the allowBeanDefinitionOverriding.
74  	 */
75  	public final boolean isAllowBeanDefinitionOverriding() {
76  		return m_allowBeanDefinitionOverriding;
77  	}
78  
79  	/**
80  	 * Indicates if bean definition overriding is enabled.
81  	 * The default is set to <code>false</code>.
82  	 *
83  	 * @param allowBeanDefinitionOverriding
84  	 *            Is the allowBeanDefinitionOverriding to set.
85  	 */
86  	public final void setAllowBeanDefinitionOverriding(
87  		boolean allowBeanDefinitionOverriding) {
88  		m_allowBeanDefinitionOverriding = allowBeanDefinitionOverriding;
89  	}
90  
91  	/**
92  	 * @return Returns the exclusiveConfigLocations.
93  	 */
94  	public final String[] getExclusiveConfigLocations() {
95  		return m_exclusiveConfigLocations;
96  	}
97  
98  	/**
99  	 * Exclusive config locations.
100 	 * The default is an empty string array.
101 	 *
102 	 * @param exclusiveConfigLocations
103 	 *            Is the exclusiveConfigLocations to set.
104 	 */
105 	public final void setExclusiveConfigLocations(
106 		String[] exclusiveConfigLocations) {
107 		m_exclusiveConfigLocations = exclusiveConfigLocations;
108 	}
109 
110 	/**
111 	 * @return Returns the inclusiveConfigLocations.
112 	 */
113 	public final String[] getInclusiveConfigLocations() {
114 		return m_inclusiveConfigLocations;
115 	}
116 
117 	/**
118 	 * Inclusive config locations.
119 	 * The default is an empty string array.
120 	 *
121 	 * @param inclusiveConfigLocations
122 	 *            Is the inclusiveConfigLocations to set.
123 	 */
124 	public final void setInclusiveConfigLocations(
125 		String[] inclusiveConfigLocations) {
126 		m_inclusiveConfigLocations = inclusiveConfigLocations;
127 	}
128 
129 	/**
130 	 * @return Returns the mergeWithOuterResources.
131 	 */
132 	public final boolean isMergeWithOuterResources() {
133 		return m_mergeWithOuterResources;
134 	}
135 
136 	/**
137 	 * Indicates if unordered/unknown resources should be used.
138 	 * The default is set to <code>true</code>.
139 	 *
140 	 * @param mergeWithOuterResources
141 	 *            Is the mergeWithOuterResources to set.
142 	 */
143 	public final void setMergeWithOuterResources(
144 		boolean mergeWithOuterResources) {
145 		m_mergeWithOuterResources = mergeWithOuterResources;
146 	}
147 
148 	/**
149 	 * @return Returns the mostSpecificBeanDefinitionCounts.
150 	 */
151 	public final boolean isMostSpecificBeanDefinitionCounts() {
152 		return m_mostSpecificBeanDefinitionCounts;
153 	}
154 
155 	/**
156 	 * Indicates if the most specific bean definition counts.
157 	 * The default is set to <code>true</code>.
158 	 *
159 	 * @param mostSpecificBeanDefinitionCounts
160 	 *            Is the mostSpecificBeanDefinitionCounts to set.
161 	 */
162 	public final void setMostSpecificBeanDefinitionCounts(
163 		boolean mostSpecificBeanDefinitionCounts) {
164 		m_mostSpecificBeanDefinitionCounts = mostSpecificBeanDefinitionCounts;
165 	}
166 
167 	/**
168 	 * @return Returns the mostSpecificResourceLast.
169 	 */
170 	public final boolean isMostSpecificResourceLast() {
171 		return m_mostSpecificResourceLast;
172 	}
173 
174 	/**
175 	 * Indicates if the most specific resource should be the last resource
176 	 * in the fetched resource array. If its value is set to <code>true</code>
177 	 * and only one resource is requested the least specific resource will be
178 	 * returned. The default is set to <code>false</code>.
179 	 *
180 	 * @param mostSpecificResourceLast
181 	 *            Is the mostSpecificResourceLast to set.
182 	 */
183 	public final void setMostSpecificResourceLast(
184 		boolean mostSpecificResourceLast) {
185 		m_mostSpecificResourceLast = mostSpecificResourceLast;
186 	}
187 
188 	/**
189 	 * @return Returns the parent.
190 	 */
191 	public final ApplicationContext getParent() {
192 		return m_parent;
193 	}
194 
195 	/**
196 	 * The parent application context.
197 	 * The default is set to <code>null</code>.
198 	 *
199 	 * @param parent Is the parent to set.
200 	 */
201 	public final void setParent(ApplicationContext parent) {
202 		m_parent = parent;
203 	}
204 
205 	/**
206 	 * @return Returns the moduleApplicationContextCreationListener.
207 	 */
208 	public ModuleApplicationContextCreationListener getModuleApplicationContextCreationListener() {
209 		return m_moduleApplicationContextCreationListener;
210 	}
211 
212 	/**
213 	 * Is used to hock into the creation process of the module application context.
214 	 * 
215 	 * @param moduleApplicationContextCreationListener Is the moduleApplicationContextCreationListener to set.
216 	 */
217 	public void setModuleApplicationContextCreationListener(
218 		ModuleApplicationContextCreationListener moduleApplicationContextCreationListener) {
219 		m_moduleApplicationContextCreationListener = moduleApplicationContextCreationListener;
220 	}
221 }