diff options
Diffstat (limited to 'java/sca')
4 files changed, 83 insertions, 16 deletions
diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java index f5139b20d9..a0d1848c5b 100644 --- a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java @@ -92,6 +92,9 @@ public class EmbeddedODEServer { Properties confProps = new Properties(); confProps.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=false)"); + // MJE 30/06/2009 - testing - limit the thread pools to max = 1 thread + confProps.put("ode-scathreads.pool.size", "1" ); + _config = new OdeConfigProperties(confProps, "ode-sca"); // Setting work root as the directory containing our database @@ -135,6 +138,8 @@ public class EmbeddedODEServer { // TODO - provide a system property / environment variable to set the path to the DB URL dbLocation = getClass().getClassLoader().getResource("jpadb"); + if (dbLocation == null) + throw new ODEInitializationException("Couldn't find database in the classpath"); // Handle OSGI bundle case if( dbLocation.getProtocol() == "bundleresource" ) { try { @@ -143,8 +148,7 @@ public class EmbeddedODEServer { throw new ODEInitializationException("Couldn't find database in the OSGi bundle"); } // end try } // end if - if (dbLocation == null) - throw new ODEInitializationException("Couldn't find database in the classpath"); + locationFile = new File(dbLocation.toURI()).getParentFile(); return locationFile; } // end method getDatabaseLocationAsFile @@ -210,7 +214,7 @@ public class EmbeddedODEServer { BpelServerImpl.PolledRunnableProcessor polledRunnableProcessor = new BpelServerImpl.PolledRunnableProcessor(); polledRunnableProcessor.setPolledRunnableExecutorService(_polledRunnableExecutorService); polledRunnableProcessor.setContexts(_bpelServer.getContexts()); - _scheduler.setPolledRunnableProcesser(polledRunnableProcessor); + //_scheduler.setPolledRunnableProcesser(polledRunnableProcessor); _bpelServer.setDaoConnectionFactory(_daoCF); _bpelServer.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl(_scheduler)); @@ -225,6 +229,11 @@ public class EmbeddedODEServer { dehy.setProcessMaxCount(_config.getDehydrationMaximumCount()); _bpelServer.setDehydrationPolicy(dehy); } + + System.out.println("TuscanyODEServer: threads.pool.size = " + + _config.getThreadPoolMaxSize() ); + + _bpelServer.setConfigProperties(_config.getProperties()); _bpelServer.init(); _bpelServer.setInstanceThrottledMaximumCount(_config.getInstanceThrottledMaximumCount()); diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java index 6a33f65a53..be25676f5e 100644 --- a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java @@ -27,7 +27,9 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Date; +import java.util.EnumSet; import java.util.HashMap; +import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Set; @@ -43,6 +45,7 @@ import org.apache.ode.bpel.iapi.Endpoint; import org.apache.ode.bpel.iapi.EndpointReference; import org.apache.ode.bpel.iapi.ProcessConf; import org.apache.ode.bpel.iapi.ProcessState; +import org.apache.ode.bpel.iapi.ProcessConf.CLEANUP_CATEGORY; import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.implementation.bpel.BPELImplementation; @@ -463,20 +466,23 @@ public class TuscanyProcessConfImpl implements ProcessConf { return cbpFile.length(); } // end getCBPFileSize + + private final Set<CLEANUP_CATEGORY> successCategories = EnumSet.noneOf(CLEANUP_CATEGORY.class); + private final Set<CLEANUP_CATEGORY> failureCategories = EnumSet.noneOf(CLEANUP_CATEGORY.class); public Set<CLEANUP_CATEGORY> getCleanupCategories(boolean instanceSucceeded) { - // TODO Is null acceptable or is an empty Set the correct response? - return null; + if( instanceSucceeded ) return successCategories; + else return failureCategories; } + private final Map<String, String> emptyPropertyMap = new Hashtable<String, String>(); public Map<String, String> getEndpointProperties(EndpointReference epr) { - // TODO Is null acceptable or is an empty Map the correct response? - return null; + return emptyPropertyMap; } - + + private final Map<QName, Node> emptyProcessProperties = new Hashtable<QName, Node>(); public Map<QName, Node> getProcessProperties() { - // TODO Is null acceptable or is an empty Map the correct response? - return null; + return emptyProcessProperties; } public boolean isCleanupCategoryEnabled(boolean instanceSucceeded, diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java index b28669d049..0b22929ae3 100644 --- a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java @@ -33,6 +33,7 @@ import org.apache.ode.bpel.iapi.MyRoleMessageExchange; import org.apache.ode.bpel.iapi.MessageExchange.Status; import org.apache.ode.utils.DOMUtils; import org.apache.ode.utils.GUID; +import org.apache.ode.utils.Properties; import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.Operation; @@ -126,7 +127,7 @@ public class BPELInvoker implements Invoker { mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(), bpelServiceName, bpelOperationName); - + mex.setProperty("isTwoWay", "true"); onhold = mex.invoke(createInvocationMessage(mex, args)); txMgr.commit(); @@ -156,16 +157,34 @@ public class BPELInvoker implements Invoker { // be sure we have the "freshest" one. mex = (MyRoleMessageExchange)odeServer.getBpelServer().getEngine().getMessageExchange(mex.getMessageExchangeId()); + Status status = mex.getStatus(); + if (__log.isDebugEnabled()) { - Status status = mex.getStatus(); Element invocationResponse = mex.getResponse().getMessage(); __log.debug(">>>Invocation status:" + status.name()); __log.debug(">>>Response:\n" + DOMUtils.domToString(invocationResponse)); __log.debug(">>>Response:\n" + DOMUtils.domToString(invocationResponse)); - } - - //process the method invocation result - response = processResponse(mex.getResponse().getMessage()); + } // end if + + switch (status) { + case FAULT: + if (__log.isDebugEnabled()) + __log.debug("Fault response message: " + mex.getFault()); + throw new ODEInvocationException("FAULT received from BPEL process : " + mex.getFault()); + case ASYNC: + case RESPONSE: + //process the method invocation result + response = processResponse(mex.getResponse().getMessage()); + if (__log.isDebugEnabled()) + __log.debug("Response message " + response); + break; + case FAILURE: + if (__log.isDebugEnabled()) + __log.debug("Failure response message: " + mex.getFault()); + break; + default: + throw new ODEInvocationException("FAILURE received from BPEL process : " + mex.getFault()); + } // end switch txMgr.commit(); // end of transaction two diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/ODEInvocationException.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/ODEInvocationException.java new file mode 100644 index 0000000000..343ba2d02a --- /dev/null +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/ODEInvocationException.java @@ -0,0 +1,33 @@ +/*
+ * 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.tuscany.sca.implementation.bpel.ode.provider;
+
+public class ODEInvocationException extends Exception {
+
+ /**
+ * Thrown when the result of the invocation of a BPEL Process operation
+ * returns a Fault or Failure code
+ */
+ private static final long serialVersionUID = 5096941965798566018L;
+
+ public ODEInvocationException(String message) {
+ super(message);
+ }
+
+}
|