* load the widgetserver.properties and local.widget.properties file
* and put it into this context as an attribute 'properties' available to all resources
*/
File localPropsFile = new File(System.getProperty("user.dir") + File.separator + "local.widgetserver.properties");
PropertiesConfiguration localConfiguration = new PropertiesConfiguration(localPropsFile);
CompositeConfiguration configuration = new CompositeConfiguration();
configuration.addConfiguration(localConfiguration);
configuration.addConfiguration(new PropertiesConfiguration("widgetserver.properties"));
context.setAttribute("properties", (Configuration) configuration);
// load these up now so we don't have to do it on every request(i.e. filter) in the future
usePreferenceInstanceQueues = configuration.getBoolean(WidgetRuntimeHelper.USE_PREFERENCE_INSTANCE_QUEUES);
useSharedDataInstanceQueues = configuration.getBoolean(WidgetRuntimeHelper.USE_SHAREDDATA_INSTANCE_QUEUES);
/*
* Merge in system properties overrides
*/
Iterator<Object> systemKeysIter = System.getProperties().keySet().iterator();
while (systemKeysIter.hasNext()) {
String key = systemKeysIter.next().toString();
if (configuration.containsKey(key) || key.startsWith("widget.")) {
String setting = configuration.getString(key);
String override = System.getProperty(key);
if ((override != null) && (override.length() > 0) && !override.equals(setting)) {
configuration.setProperty(key, override);
if (setting != null) {
_logger.info("Overridden server configuration property: " + key + "=" +override);
}
}
}
}
/*
* Initialize persistence manager factory now, not on first request
*/
PersistenceManagerFactory.initialize(configuration);
/*
* Initialise the locale handler
*/
LocaleHandler.getInstance().initialize(configuration);
final Locale locale = new Locale(configuration.getString("widget.default.locale"));
final Messages localizedMessages = LocaleHandler.getInstance().getResourceBundle(locale);
/*
* load the opensocial.properties file and put it into this context
* as an attribute 'opensocial' available to all resources
*/
File localOpenSocialPropsFile = new File(System.getProperty("user.dir") + File.separator + "local.opensocial.properties");
PropertiesConfiguration localOpenSocialConfiguration = new PropertiesConfiguration(localOpenSocialPropsFile);
CompositeConfiguration opensocialConfiguration = new CompositeConfiguration();
opensocialConfiguration.addConfiguration(localOpenSocialConfiguration);
opensocialConfiguration.addConfiguration(new PropertiesConfiguration("opensocial.properties"));
context.setAttribute("opensocial", (Configuration) opensocialConfiguration);
/*
* Load installed features
*/