use of org.apache.ofbiz.service.config.model.ServiceEcas in project ofbiz-framework by apache.
the class ServiceEcaUtil method readConfig.
public static void readConfig() {
// Only proceed if the cache hasn't already been populated, caller should be using reloadConfig() in that situation
if (UtilValidate.isNotEmpty(ecaCache)) {
return;
}
List<Future<List<ServiceEcaRule>>> futures = new LinkedList<Future<List<ServiceEcaRule>>>();
List<ServiceEcas> serviceEcasList = null;
try {
serviceEcasList = ServiceConfigUtil.getServiceEngine().getServiceEcas();
} catch (GenericConfigException e) {
// FIXME: Refactor API so exceptions can be thrown and caught.
Debug.logError(e, module);
throw new RuntimeException(e.getMessage());
}
for (ServiceEcas serviceEcas : serviceEcasList) {
ResourceHandler handler = new MainResourceHandler(ServiceConfigUtil.getServiceEngineXmlFileName(), serviceEcas.getLoader(), serviceEcas.getLocation());
futures.add(ExecutionPool.GLOBAL_FORK_JOIN.submit(createEcaLoaderCallable(handler)));
}
// get all of the component resource eca stuff, ie specified in each ofbiz-component.xml file
for (ComponentConfig.ServiceResourceInfo componentResourceInfo : ComponentConfig.getAllServiceResourceInfos("eca")) {
futures.add(ExecutionPool.GLOBAL_FORK_JOIN.submit(createEcaLoaderCallable(componentResourceInfo.createResourceHandler())));
}
for (List<ServiceEcaRule> handlerRules : ExecutionPool.getAllFutures(futures)) {
mergeEcaDefinitions(handlerRules);
}
}
Aggregations