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