Author: vanto Date: Mon Jul 23 06:02:29 2007 New Revision: 558709 URL: http://svn.apache.org/viewvc?view=rev&rev=558709 Log: OPEN - issue ODE-157: Create a (default) BPEL event listener http://issues.apache.org/jira/browse/ODE-157
Added: incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/bpel/common/ incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/bpel/common/evt/ incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/bpel/common/evt/DebugBpelEventListener.java Modified: incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java incubator/ode/trunk/jbi/src/main/jbi/ode-jbi.properties Added: incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/bpel/common/evt/DebugBpelEventListener.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/bpel/common/evt/DebugBpelEventListener.java?view=auto&rev=558709 ============================================================================== --- incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/bpel/common/evt/DebugBpelEventListener.java (added) +++ incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/bpel/common/evt/DebugBpelEventListener.java Mon Jul 23 06:02:29 2007 @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ode.bpel.common.evt; + +import java.util.Properties; + +import org.apache.commons.lang.BooleanUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.ode.bpel.evt.BpelEvent; +import org.apache.ode.bpel.iapi.BpelEventListener; + +/** + * Example implementation of the [EMAIL PROTECTED] BpelEventListener} interface. + * + * Dumps navigation events to a logging appender and optionally to stdout. + * To use the DebugBpelEventListener add the following lines to your + * ode-xxx.properties file: + * <code> + * ode-jbi.event.listeners=org.apache.ode.bpel.common.evt.DebugBpelEventListener + * debugeventlistener.dumpToStdOut=on/off + * </code> + * + * @author Tammo van Lessen (University of Stuttgart) + */ +public class DebugBpelEventListener implements BpelEventListener { + private static final Log __log = LogFactory.getLog(BpelEventListener.class); + + private static final String SYSOUT_KEY = "debugeventlistener.dumpToStdOut"; + private boolean _dumpToStdOut = false; + + @Override + public void onEvent(BpelEvent bpelEvent) { + if (__log.isDebugEnabled()) { + __log.debug(bpelEvent.toString()); + } + + if (_dumpToStdOut) { + System.out.println(bpelEvent.toString()); + } + } + + @Override + public void startup(Properties configProperties) { + if (configProperties != null) { + _dumpToStdOut = BooleanUtils.toBoolean(configProperties.getProperty(SYSOUT_KEY, "false")); + } + } + + @Override + public void shutdown() {} +} Modified: incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java?view=diff&rev=558709&r1=558708&r2=558709 ============================================================================== --- incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java (original) +++ incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java Mon Jul 23 06:02:29 2007 @@ -19,6 +19,8 @@ package org.apache.ode.test; import junit.framework.TestCase; + +import org.apache.ode.bpel.common.evt.DebugBpelEventListener; import org.apache.ode.bpel.dao.BpelDAOConnectionFactory; import org.apache.ode.bpel.engine.BpelServerImpl; import org.apache.ode.bpel.iapi.Message; @@ -46,6 +48,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; +import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; import java.util.Collection; @@ -58,7 +61,8 @@ import java.util.regex.Pattern; public abstract class BPELTestAbstract extends TestCase { - + private static final String SHOW_EVENTS_ON_CONSOLE = "no"; + protected BpelServerImpl _server; protected ProcessStore store; @@ -143,6 +147,7 @@ } }); _server.setConfigProperties(getConfigProperties()); + _server.registerBpelEventListener(new DebugBpelEventListener()); _server.init(); _server.start(); } @@ -382,7 +387,13 @@ if (deployxmlurl == null) { fail("Resource not found: " + deployxml); } - return new File(deployxmlurl.getPath()).getParentFile(); + try { + return new File(deployxmlurl.toURI().getPath()).getParentFile(); + } catch (URISyntaxException e) { + e.printStackTrace(); + fail(e.getMessage()); + return null; + } } /** @@ -394,7 +405,9 @@ protected Properties getConfigProperties() { // could also return null, returning an empty properties // object is more fail-safe. - return new Properties(); + Properties p = new Properties(); + p.setProperty("debugeventlistener.dumpToStdOut", SHOW_EVENTS_ON_CONSOLE); + return p; } protected static class Failure { Modified: incubator/ode/trunk/jbi/src/main/jbi/ode-jbi.properties URL: http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/jbi/ode-jbi.properties?view=diff&rev=558709&r1=558708&r2=558709 ============================================================================== --- incubator/ode/trunk/jbi/src/main/jbi/ode-jbi.properties (original) +++ incubator/ode/trunk/jbi/src/main/jbi/ode-jbi.properties Mon Jul 23 06:02:29 2007 @@ -20,7 +20,7 @@ # ODE-JBI Configuraiton Properties # Process Identifier Namespace [QNAME] -# Namespace for processes created using the JBI integartion. +# Namespace for processes created using the JBI integration. # This will be the namespace of the process identifiers (PIDs) ode-jbi.pidNamespace=urn:ode-jbi @@ -66,7 +66,13 @@ # Class name of the message mapper that should be used to convert message # between ODE / NMS. -# org.apache.ode.jbi.msgmap.JbiWsdl11WrapperMapper - use JBI WSDL 1.1 "warapped" +# org.apache.ode.jbi.msgmap.JbiWsdl11WrapperMapper - use JBI WSDL 1.1 "wrapped" # org.apache.ode.jbi.msgmap.ServiceMixMapper # org.apache.ode.jbi.msgmap.DocLitMapper ode-jbi.messageMapper=org.apache.ode.jbi.msgmap.ServiceMixMapper + +# BPEL Event Listener +# Uncomment the following for a debug output of BPEL navigation events. +#ode-jbi.event.listeners=org.apache.ode.bpel.common.evt.DebugBpelEventListener +#debugeventlistener.dumpToStdOut=on/off +