Search in sources :

Example 1 with ServiceConfig

use of org.apache.ofbiz.service.config.model.ServiceConfig in project ofbiz-framework by apache.

the class ServiceConfigUtil method getServiceConfig.

/**
 * Returns the <code>ServiceConfig</code> instance.
 * @throws GenericConfigException
 */
public static ServiceConfig getServiceConfig() throws GenericConfigException {
    ServiceConfig instance = serviceConfigCache.get("instance");
    if (instance == null) {
        Element serviceConfigElement = getXmlDocument().getDocumentElement();
        instance = ServiceConfig.create(serviceConfigElement);
        serviceConfigCache.putIfAbsent("instance", instance);
        instance = serviceConfigCache.get("instance");
        for (ServiceConfigListener listener : configListeners) {
            try {
                listener.onServiceConfigChange(instance);
            } catch (Exception e) {
                Debug.logError(e, "Exception thrown while notifying listener " + listener + ": ", module);
            }
        }
    }
    return instance;
}
Also used : ServiceConfig(org.apache.ofbiz.service.config.model.ServiceConfig) Element(org.w3c.dom.Element) GenericConfigException(org.apache.ofbiz.base.config.GenericConfigException)

Aggregations

GenericConfigException (org.apache.ofbiz.base.config.GenericConfigException)1 ServiceConfig (org.apache.ofbiz.service.config.model.ServiceConfig)1 Element (org.w3c.dom.Element)1