1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.config; |
17 | |
|
18 | |
import java.io.IOException; |
19 | |
import java.util.HashMap; |
20 | |
import java.util.Map; |
21 | |
import java.util.Properties; |
22 | |
|
23 | |
import org.apache.commons.lang.StringUtils; |
24 | |
import org.apache.log4j.Logger; |
25 | |
import org.kuali.rice.core.util.RiceUtilities; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | 0 | public abstract class AbstractBaseConfig implements Config { |
35 | |
|
36 | 0 | private static final Logger LOG = Logger.getLogger(AbstractBaseConfig.class); |
37 | |
|
38 | |
public abstract Object getObject(String key); |
39 | |
|
40 | |
public abstract Map<String, Object> getObjects(); |
41 | |
|
42 | |
public abstract Properties getProperties(); |
43 | |
|
44 | |
public abstract String getProperty(String key); |
45 | |
|
46 | |
public abstract void overrideProperty(String name, String value); |
47 | |
|
48 | |
public abstract void parseConfig() throws IOException; |
49 | |
|
50 | |
public Map<String, String> getPropertiesWithPrefix(String prefix, boolean stripPrefix) { |
51 | 0 | Map<String, String> props = new HashMap<String, String>(); |
52 | 0 | for (Map.Entry<Object, Object> entry : getProperties().entrySet()) { |
53 | 0 | String key = (String) entry.getKey(); |
54 | 0 | if (StringUtils.isNotBlank(key) && key.trim().startsWith(prefix)) { |
55 | 0 | props.put(stripPrefix ? key.substring(prefix.length()) : key, (String) entry.getValue()); |
56 | |
} |
57 | 0 | } |
58 | 0 | return props; |
59 | |
} |
60 | |
|
61 | |
public String getAlternateOJBFile() { |
62 | 0 | return getProperty(Config.ALT_OJB_FILE); |
63 | |
} |
64 | |
|
65 | |
public String getAlternateSpringFile() { |
66 | 0 | return getProperty(Config.ALT_SPRING_FILE); |
67 | |
} |
68 | |
|
69 | |
public String getBaseWebServiceURL() { |
70 | 0 | return getProperty(Config.BASE_WEB_SERVICE_URL_WORKFLOW_CLIENT_FILE); |
71 | |
} |
72 | |
|
73 | |
public String getBaseWebServiceWsdlPath() { |
74 | 0 | return getProperty(Config.BASE_WEB_SERVICE_WSDL_PATH); |
75 | |
} |
76 | |
|
77 | |
public Boolean getBatchMode() { |
78 | 0 | return new Boolean(getProperty(Config.BATCH_MODE)); |
79 | |
} |
80 | |
|
81 | |
public boolean getBooleanProperty(String key, boolean defaultValue) { |
82 | 0 | return RiceUtilities.getBooleanValueForString(getProperty(key), defaultValue); |
83 | |
} |
84 | |
|
85 | |
public String getClientProtocol() { |
86 | 0 | return getProperty(Config.CLIENT_PROTOCOL); |
87 | |
} |
88 | |
|
89 | |
public String getClientWSDLFullPathAndFileName() { |
90 | 0 | return getProperty(Config.WSDL_LOCATION_WORKFLOW_CLIENT_FILE); |
91 | |
} |
92 | |
|
93 | |
public String getDailyEmailFirstDeliveryDate() { |
94 | 0 | return getProperty(Config.FIRST_DAILY_EMAIL_DELIVERY_DATE); |
95 | |
} |
96 | |
|
97 | |
public String getDefaultKewNoteClass() { |
98 | 0 | return getProperty(Config.DEFAULT_KEW_NOTE_CLASS); |
99 | |
} |
100 | |
|
101 | |
public String getDefaultNoteClass() { |
102 | 0 | return getProperty(Config.DEFAULT_NOTE_CLASS); |
103 | |
} |
104 | |
|
105 | |
public Boolean getDevMode() { |
106 | 0 | return Boolean.valueOf(getProperty(Config.DEV_MODE)); |
107 | |
} |
108 | |
|
109 | |
public String getDocumentLockTimeout() { |
110 | 0 | return getProperty(Config.DOCUMENT_LOCK_TIMEOUT); |
111 | |
} |
112 | |
|
113 | |
public String getEDLConfigLocation() { |
114 | 0 | return getProperty(Config.EDL_CONFIG_LOCATION); |
115 | |
} |
116 | |
|
117 | |
public String getEmailConfigurationPath() { |
118 | 0 | return getProperty(Config.EMAIL_SECURITY_PATH); |
119 | |
} |
120 | |
|
121 | |
public Boolean getEmailReminderLifecycleEnabled() { |
122 | 0 | return Boolean.valueOf(getProperty(Config.ENABLE_EMAIL_REMINDER_LIFECYCLE)); |
123 | |
} |
124 | |
|
125 | |
public String getEmbeddedPluginLocation() { |
126 | 0 | return getProperty(Config.EMBEDDED_PLUGIN_LOCATIAON); |
127 | |
} |
128 | |
|
129 | |
public String getEndPointUrl() { |
130 | |
|
131 | 0 | return getProperty(Config.SERVICE_SERVLET_URL); |
132 | |
} |
133 | |
|
134 | |
public String getEnvironment() { |
135 | 0 | return getProperty(Config.ENVIRONMENT); |
136 | |
} |
137 | |
|
138 | |
public String getKENBaseURL() { |
139 | 0 | return getProperty(Config.KEN_URL); |
140 | |
} |
141 | |
|
142 | |
public String getKEWBaseURL() { |
143 | 0 | return getProperty(Config.KEW_URL); |
144 | |
} |
145 | |
|
146 | |
public String getKIMBaseURL() { |
147 | 0 | return getProperty(Config.KIM_URL); |
148 | |
} |
149 | |
|
150 | |
public String getKRBaseURL() { |
151 | 0 | return getProperty(Config.KR_URL); |
152 | |
} |
153 | |
|
154 | |
public String getKeystoreAlias() { |
155 | 0 | return getProperty(Config.KEYSTORE_ALIAS); |
156 | |
} |
157 | |
|
158 | |
public String getKeystoreFile() { |
159 | 0 | return getProperty(Config.KEYSTORE_FILE); |
160 | |
} |
161 | |
|
162 | |
public String getKeystorePassword() { |
163 | 0 | return getProperty(Config.KEYSTORE_PASSWORD); |
164 | |
} |
165 | |
|
166 | |
public String getLog4jFileLocation() { |
167 | 0 | return getProperty(Config.LOG4J_SETTINGS_PATH); |
168 | |
} |
169 | |
|
170 | |
public String getLog4jReloadInterval() { |
171 | 0 | return getProperty(Config.LOG4J_SETTINGS_RELOADINTERVAL_MINS); |
172 | |
} |
173 | |
|
174 | |
public Boolean getOutBoxDefaultPreferenceOn() { |
175 | 0 | return Boolean.valueOf(getProperty(Config.OUT_BOX_DEFAULT_PREFERENCE_ON)); |
176 | |
} |
177 | |
|
178 | |
public Boolean getOutBoxOn() { |
179 | 0 | return Boolean.valueOf(getProperty(Config.OUT_BOX_MODE)); |
180 | |
} |
181 | |
|
182 | |
public String getPortalShowSampleApp() { |
183 | 0 | return getProperty(Config.PORTAL_SHOW_SAMPLE_APP); |
184 | |
} |
185 | |
|
186 | |
public Integer getRefreshRate() { |
187 | |
|
188 | |
|
189 | |
Integer refreshRate; |
190 | |
try { |
191 | 0 | refreshRate = new Integer(ConfigContext.getCurrentContextConfig().getProperty(Config.REFRESH_RATE)); |
192 | 0 | } catch (NumberFormatException nfe) { |
193 | 0 | LOG.error("Couldn't parse property " + Config.REFRESH_RATE + " to set bus refresh rate. Defaulting to 30 seconds."); |
194 | 0 | ConfigContext.getCurrentContextConfig().putProperty(Config.REFRESH_RATE, "30"); |
195 | 0 | return 30; |
196 | 0 | } |
197 | 0 | return refreshRate; |
198 | |
} |
199 | |
|
200 | |
public String getServiceNamespace() { |
201 | 0 | return getProperty(Config.SERVICE_NAMESPACE); |
202 | |
} |
203 | |
|
204 | |
public Boolean getStoreAndForward() { |
205 | 0 | return Boolean.valueOf(getProperty(Config.STORE_AND_FORWARD)); |
206 | |
} |
207 | |
|
208 | |
public String getTransactionTimeout() { |
209 | 0 | return getProperty(Config.TRANSACTION_TIMEOUT); |
210 | |
} |
211 | |
|
212 | |
public String getWebServicesConnectRetry() { |
213 | 0 | return getProperty(Config.WEB_SERVICE_CONNECT_RETRY); |
214 | |
} |
215 | |
|
216 | |
public String getWeeklyEmailFirstDeliveryDate() { |
217 | 0 | return getProperty(Config.FIRST_WEEKLY_EMAIL_DELIVERY_DATE); |
218 | |
} |
219 | |
|
220 | |
public Boolean getXmlPipelineLifeCycleEnabled() { |
221 | 0 | return Boolean.valueOf(getProperty(Config.ENABLE_XML_PIPELINE_LIFECYCLE)); |
222 | |
} |
223 | |
|
224 | |
} |