public GroovyEngine(ServiceDispatcher dispatcher) { super(dispatcher); try { String scriptBaseClass = ServiceConfigUtil.getEngineParameter("groovy", "scriptBaseClass"); if (scriptBaseClass != null) { CompilerConfiguration conf = new CompilerConfiguration(); conf.setScriptBaseClass(scriptBaseClass); groovyClassLoader = new GroovyClassLoader(getClass().getClassLoader(), conf); } } catch (GenericConfigException gce) { Debug.logWarning( gce, "Error retrieving the configuration for the groovy service engine: ", module); } }
// Load the JMS listeners private void loadListeners() { try { Element rootElement = ServiceConfigUtil.getXmlRootElement(); NodeList nodeList = rootElement.getElementsByTagName("jms-service"); if (Debug.verboseOn()) Debug.logVerbose("[ServiceDispatcher] : Loading JMS Listeners.", module); for (int i = 0; i < nodeList.getLength(); i++) { Element element = (Element) nodeList.item(i); StringBuilder serverKey = new StringBuilder(); for (Element server : UtilXml.childElementList(element, "server")) { try { String listenerEnabled = server.getAttribute("listen"); if (listenerEnabled.equalsIgnoreCase("true")) { // create a server key serverKey.append(server.getAttribute("jndi-server-name") + ":"); serverKey.append(server.getAttribute("jndi-name") + ":"); serverKey.append(server.getAttribute("topic-queue")); // store the server element servers.put(serverKey.toString(), server); // load the listener GenericMessageListener listener = loadListener(serverKey.toString(), server); // store the listener w/ the key if (serverKey.length() > 0 && listener != null) listeners.put(serverKey.toString(), listener); } } catch (GenericServiceException gse) { Debug.logInfo( "Cannot load message listener " + serverKey + " error: (" + gse.toString() + ").", module); } catch (Exception e) { Debug.logError(e, "Uncaught exception.", module); } } } } catch (org.ofbiz.base.config.GenericConfigException gce) { Debug.logError(gce, "Cannot get serviceengine.xml root element.", module); } catch (Exception e) { Debug.logError(e, "Uncaught exception.", module); } }