You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by bo...@apache.org on 2007/07/02 05:30:59 UTC
svn commit: r552392 - in /incubator/ode/trunk:
axis2/src/main/java/org/apache/ode/axis2/
bpel-epr/src/main/java/org/apache/ode/il/config/
jbi/src/main/java/org/apache/ode/jbi/
Author: boisvert
Date: Sun Jul 1 20:30:58 2007
New Revision: 552392
URL: http://svn.apache.org/viewvc?view=rev&rev=552392
Log:
Register MessageExchangeInterceptors via configuration
Modified:
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/Messages.java
incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
Modified: incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java?view=diff&rev=552392&r1=552391&r2=552392
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java (original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java Sun Jul 1 20:30:58 2007
@@ -135,6 +135,10 @@
return format("Registered custom BPEL event listener: {0}", listenerCN);
}
+ public String msgMessageExchangeInterceptorRegistered(String interceptorCN) {
+ return format("Registered message exchange interceptor: {0}", interceptorCN);
+ }
+
public String msgOdeShutdownCompleted() {
return "Shutdown completed. ";
}
Modified: incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?view=diff&rev=552392&r1=552391&r2=552392
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java (original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java Sun Jul 1 20:30:58 2007
@@ -36,11 +36,13 @@
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
import org.apache.ode.bpel.iapi.BpelEventListener;
+import org.apache.ode.bpel.iapi.BpelEventListener;
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.bpel.iapi.ProcessStoreEvent;
import org.apache.ode.bpel.iapi.ProcessStoreListener;
import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
import org.apache.ode.bpel.scheduler.quartz.QuartzSchedulerImpl;
import org.apache.ode.il.dbutil.Database;
@@ -61,7 +63,7 @@
/**
* Server class called by our Axis hooks to handle all ODE lifecycle management.
- *
+ *
* @author Matthieu Riou <mriou at apache dot org>
*/
public class ODEServer {
@@ -151,10 +153,11 @@
__log.debug("Initializing BPEL server.");
initBpelServer();
- // Register BPEL event listeners configured in axis2.properties
- // file.
+ // Register BPEL event listeners configured in axis2.properties file.
registerEventListeners();
+ registerMexInterceptors();
+
try {
_server.start();
} catch (Exception ex) {
@@ -209,7 +212,7 @@
/**
* Shutdown the service engine. This performs cleanup before the BPE is terminated. Once this method has been called, init()
* must be called before the transformation engine can be started again with a call to start().
- *
+ *
* @throws AxisFault
* if the engine is unable to shut down.
*/
@@ -265,7 +268,7 @@
if (_db != null)
try {
_db.shutdown();
-
+
} catch (Throwable ex) {
__log.debug("DB shutdown failed.", ex);
} finally {
@@ -402,7 +405,7 @@
/**
* Initialize the DAO.
- *
+ *
* @throws ServletException
*/
protected void initDAO() throws ServletException {
@@ -413,7 +416,7 @@
String errmsg = __msgs.msgDAOInstantiationFailed(_odeConfig.getDAOConnectionFactory());
__log.error(errmsg, ex);
throw new ServletException(errmsg, ex);
-
+
}
}
@@ -482,10 +485,26 @@
__log.info(__msgs.msgBpelEventListenerRegistered(listenerCN));
} catch (Exception e) {
__log.warn("Couldn't register the event listener " + listenerCN + ", the class couldn't be "
- + "loaded properly.");
+ + "loaded properly: " + e);
}
}
+ }
+ }
+
+ private void registerMexInterceptors() {
+ String listenersStr = _odeConfig.getMessageExchangeInterceptors();
+ if (listenersStr != null) {
+ for (StringTokenizer tokenizer = new StringTokenizer(listenersStr, ",;"); tokenizer.hasMoreTokens();) {
+ String interceptorCN = tokenizer.nextToken();
+ try {
+ _server.registerMessageExchangeInterceptor((MessageExchangeInterceptor) Class.forName(interceptorCN).newInstance());
+ __log.info(__msgs.msgMessageExchangeInterceptorRegistered(interceptorCN));
+ } catch (Exception e) {
+ __log.warn("Couldn't register the event listener " + interceptorCN + ", the class couldn't be "
+ + "loaded properly: " + e);
+ }
+ }
}
}
Modified: incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java?view=diff&rev=552392&r1=552391&r2=552392
==============================================================================
--- incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java (original)
+++ incubator/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java Sun Jul 1 20:30:58 2007
@@ -77,6 +77,8 @@
public static final String PROP_EVENT_LISTENERS = "event.listeners";
+ public static final String PROP_MEX_INTERCEPTORS = "mex.interceptors";
+
public static final String PROP_PROCESS_DEHYDRATION = "process.dehydration";
public static final String PROP_DAOCF = "dao.factory";
@@ -231,6 +233,10 @@
public String getEventListeners() {
return getProperty(PROP_EVENT_LISTENERS);
+ }
+
+ public String getMessageExchangeInterceptors() {
+ return getProperty(PROP_MEX_INTERCEPTORS);
}
public boolean isDehydrationEnabled() {
Modified: incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/Messages.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/Messages.java?view=diff&rev=552392&r1=552391&r2=552392
==============================================================================
--- incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/Messages.java (original)
+++ incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/Messages.java Sun Jul 1 20:30:58 2007
@@ -149,5 +149,8 @@
return format("Registered custom BPEL event listener: {0}", listenerCN);
}
+ public String msgMessageExchangeInterceptorRegistered(String interceptorCN) {
+ return format("Registered message exchange interceptor: {0}", interceptorCN);
+ }
}
Modified: incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java?view=diff&rev=552392&r1=552391&r2=552392
==============================================================================
--- incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java (original)
+++ incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java Sun Jul 1 20:30:58 2007
@@ -25,6 +25,7 @@
import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.iapi.BpelEventListener;
+import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
import org.apache.ode.bpel.scheduler.quartz.QuartzSchedulerImpl;
import org.apache.ode.il.dbutil.Database;
import org.apache.ode.il.dbutil.DatabaseConfigException;
@@ -113,6 +114,8 @@
// Register BPEL event listeners configured in ode-jbi.properties.
registerEventListeners();
+ registerMexInterceptors();
+
__log.debug("Starting JCA connector.");
initConnector();
@@ -160,19 +163,19 @@
__log.error(errmsg, ex);
throw new JBIException(errmsg, ex);
}
-
+
_ode._dataSource = _db.getDataSource();
}
/**
* Load the "ode-jbi.properties" file from the install directory.
- *
+ *
* @throws JBIException
*/
private void initProperties() throws JBIException {
OdeConfigProperties config = new OdeConfigProperties(new File(_ode.getContext().getInstallRoot(),
OdeConfigProperties.CONFIG_FILE_NAME));
-
+
try {
config.load();
} catch (FileNotFoundException fnf) {
@@ -222,7 +225,7 @@
/**
* Initialize the data store.
- *
+ *
* @throws JBIException
*/
private void initDao() throws JBIException {
@@ -273,6 +276,21 @@
}
}
+ private void registerMexInterceptors() {
+ String listenersStr = _ode._config.getMessageExchangeInterceptors();
+ if (listenersStr != null) {
+ for (StringTokenizer tokenizer = new StringTokenizer(listenersStr, ",;"); tokenizer.hasMoreTokens();) {
+ String interceptorCN = tokenizer.nextToken();
+ try {
+ _ode._server.registerMessageExchangeInterceptor((MessageExchangeInterceptor) Class.forName(interceptorCN).newInstance());
+ __log.info(__msgs.msgMessageExchangeInterceptorRegistered(interceptorCN));
+ } catch (Exception e) {
+ __log.warn("Couldn't register the event listener " + interceptorCN + ", the class couldn't be "
+ + "loaded properly: " + e);
+ }
+ }
+ }
+ }
public synchronized void start() throws JBIException {
if (_started)
@@ -349,7 +367,7 @@
/**
* Shutdown the service engine. This performs cleanup before the BPE is terminated. Once this method has been called, init()
* must be called before the transformation engine can be started again with a call to start().
- *
+ *
* @throws javax.jbi.JBIException
* if the transformation engine is unable to shut down.
*/