You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ms...@apache.org on 2007/09/06 07:46:57 UTC
svn commit: r573153 [2/9] - in /ode/trunk: ./
axis2/src/main/java/org/apache/ode/axis2/ bpel-api/src/
bpel-api/src/main/java/org/apache/ode/bpel/explang/
bpel-api/src/main/java/org/apache/ode/bpel/iapi/
bpel-api/src/main/java/org/apache/ode/bpel/pmapi/...
Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java Wed Sep 5 22:46:42 2007
@@ -52,30 +52,27 @@
oinvoke.partnerLink = _context.resolvePartnerLink(src.getPartnerLink());
oinvoke.operation = _context.resolvePartnerRoleOperation(oinvoke.partnerLink, src.getOperation());
- assert oinvoke.operation.getInput() != null; // ensured by
- // resolvePartnerRoleOperation
- assert oinvoke.operation.getInput().getMessage() != null; // ensured
- // by
- // resolvePartnerRoleOperation
- // TODO: Add portType checking if specified by user
- // if (portType != null &&
- // !portType.equals(onMessage.partnerLink.myRolePortType.getQName()))
- // throw new CompilationException(CMSGSG.errPortTypeMismatch(portType,
- // onMessage.partnerLink.myRolePortType.getQName()));
+ assert oinvoke.operation.getInput() != null; // ensured by reolvePartnerRoleOperation
+ assert oinvoke.operation.getInput().getMessage() != null; // ensured by resolvePartnerRoleOperation
+ if (src.getPortType() != null) {
+ if (!src.getPortType().equals(oinvoke.partnerLink.partnerRolePortType.getQName()))
+ throw new CompilationException(__imsgs.errPortTypeMismatch(src.getPortType(), oinvoke.partnerLink.partnerRolePortType.getQName()));
+ }
+
if (oinvoke.operation.getInput() != null && oinvoke.operation.getInput().getMessage() != null) {
- // Input var can be omitted if input message has no part
+ // Input var can be omitted if input message has no part
if (oinvoke.operation.getInput().getMessage().getParts().size() > 0) {
if (src.getInputVar() == null)
throw new CompilationException(__imsgs.errInvokeNoInputMessageForInputOp(oinvoke.operation.getName()));
- oinvoke.inputVar = _context.resolveMessageVariable(src.getInputVar(), oinvoke.operation.getInput()
- .getMessage().getQName());
+ oinvoke.inputVar = _context.resolveMessageVariable(src.getInputVar(), oinvoke.operation.getInput().getMessage()
+ .getQName());
}
}
if (oinvoke.operation.getOutput() != null && oinvoke.operation.getOutput().getMessage() != null) {
if (src.getOutputVar() == null)
throw new CompilationException(__imsgs.errInvokeNoOutputMessageForOutputOp(oinvoke.operation.getName()));
- oinvoke.outputVar = _context.resolveMessageVariable(src.getOutputVar(), oinvoke.operation.getOutput()
- .getMessage().getQName());
+ oinvoke.outputVar = _context.resolveMessageVariable(src.getOutputVar(), oinvoke.operation.getOutput().getMessage()
+ .getQName());
}
List<Correlation> correlations = src.getCorrelations();
List<Correlation> incorrelations = CollectionsX.filter(new ArrayList<Correlation>(), correlations,
@@ -102,25 +99,20 @@
});
if (oinvoke.inputVar != null) {
- doCorrelations(outcorrelations, oinvoke.inputVar, oinvoke.assertCorrelationsInput,
- oinvoke.initCorrelationsInput);
- doCorrelations(inoutcorrelations, oinvoke.inputVar, oinvoke.assertCorrelationsInput,
- oinvoke.initCorrelationsInput);
+ doCorrelations(outcorrelations, oinvoke.inputVar, oinvoke.assertCorrelationsInput, oinvoke.initCorrelationsInput);
+ doCorrelations(inoutcorrelations, oinvoke.inputVar, oinvoke.assertCorrelationsInput, oinvoke.initCorrelationsInput);
}
if (oinvoke.outputVar != null) {
- doCorrelations(incorrelations, oinvoke.outputVar,
- oinvoke.assertCorrelationsOutput, oinvoke.initCorrelationsOutput);
- doCorrelations(inoutcorrelations, oinvoke.outputVar,
- oinvoke.assertCorrelationsOutput, oinvoke.initCorrelationsOutput);
+ doCorrelations(incorrelations, oinvoke.outputVar, oinvoke.assertCorrelationsOutput, oinvoke.initCorrelationsOutput);
+ doCorrelations(inoutcorrelations, oinvoke.outputVar, oinvoke.assertCorrelationsOutput, oinvoke.initCorrelationsOutput);
}
-
-// Partner link could be initialized with magic session in a previous receive.
-// if (!oinvoke.getOwner().version.equals(Constants.NS_BPEL4WS_2003_03)) {
-// if (!oinvoke.partnerLink.initializePartnerRole && !_context.isPartnerLinkAssigned(oinvoke.partnerLink.getName())) {
-// throw new CompilationException(__cmsgs.errUninitializedPartnerLinkInInvoke(oinvoke.partnerLink.getName()));
-// }
-// }
+ // Partner link could be initialized with magic session in a previous receive.
+ // if (!oinvoke.getOwner().version.equals(Constants.NS_BPEL4WS_2003_03)) {
+ // if (!oinvoke.partnerLink.initializePartnerRole && !_context.isPartnerLinkAssigned(oinvoke.partnerLink.getName())) {
+ // throw new CompilationException(__cmsgs.errUninitializedPartnerLinkInInvoke(oinvoke.partnerLink.getName()));
+ // }
+ // }
}
private void doCorrelations(List<Correlation> correlations, OScope.Variable var,
Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGeneratorMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGeneratorMessages.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGeneratorMessages.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGeneratorMessages.java Wed Sep 5 22:46:42 2007
@@ -19,6 +19,8 @@
package org.apache.ode.bpel.compiler;
+import javax.xml.namespace.QName;
+
import org.apache.ode.bpel.compiler.api.CompilationMessage;
import org.apache.ode.bpel.compiler.api.CompilationMessageBundle;
@@ -40,8 +42,15 @@
*/
public CompilationMessage errInvokeNoInputMessageForInputOp(String operation) {
return this.formatCompilationMessage(
- "Invoke doesn't define an output variable even though the operation \"{0}\" "
- + "declares an output message.", operation);
+ "Invoke doesn't define an output variable even though the operation \"{0}\" "
+ + "declares an output message.", operation);
+ }
+
+ public CompilationMessage errPortTypeMismatch(QName iptype, QName pltype) {
+ return this.formatCompilationMessage(
+ "The portType \"{0}\" specified on the <invoke> does not match \"{1}\", the port type declared in the" +
+ "partner link.", iptype, pltype);
+
}
}
Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGeneratorMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGeneratorMessages.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGeneratorMessages.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGeneratorMessages.java Wed Sep 5 22:46:42 2007
@@ -33,14 +33,12 @@
+ " second set was \"{0}\".", setName);
}
- // TODO: better error message
public CompilationMessage errForOrUntilMustBeGiven() {
- return this.formatCompilationMessage("errForOrUntilMustBeGiven");
+ return this.formatCompilationMessage("An <onAlarm> block must include a <for> or <until> block.");
}
- // TODO: better error message
public CompilationMessage errOnAlarmWithCreateInstance() {
- return this.formatCompilationMessage("errOnAlarmWithCreateInstance");
+ return this.formatCompilationMessage("An <onAlarm> may not be used when createInstance=yes.");
}
public CompilationMessage errRendezvousNotSupported() {
Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java Wed Sep 5 22:46:42 2007
@@ -201,7 +201,9 @@
if (ee instanceof XMLSchemaType) {
String schema = ((XMLSchemaType)ee).getXMLSchema();
+
WsdlFinderXMLEntityResolver resolver = new WsdlFinderXMLEntityResolver(rf, defuri, _internalSchemas, false);
+
try {
Map<URI, byte[]> capture = XSUtils.captureSchema(defuri, schema, resolver);
_schemas.putAll(capture);
Modified: ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/WSDLRegistryTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/WSDLRegistryTest.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/WSDLRegistryTest.java (original)
+++ ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/WSDLRegistryTest.java Wed Sep 5 22:46:42 2007
@@ -68,10 +68,12 @@
// load & register wsdl
WSDLFactory4BPEL factory = (WSDLFactory4BPEL)WSDLFactoryBPEL11.newInstance();
WSDLReader reader = factory.newWSDLReader();
-
- //ResourceFinder finder = new DefaultResourceFinder(new File(wsd.getPath()).getParentFile());
+
+
File parent = new File(wsd.toURI().getPath()).getParentFile();
ResourceFinder finder = new DefaultResourceFinder(parent, parent);
+
+
WSDLLocatorImpl loc = new WSDLLocatorImpl(finder,wsd.toURI());
Definition4BPEL wsdl = (Definition4BPEL) reader.readWSDL(loc);
_registry.addDefinition(wsdl, finder, wsd.toURI());
Modified: ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/BpelDAOConnection.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/BpelDAOConnection.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/BpelDAOConnection.java (original)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/BpelDAOConnection.java Wed Sep 5 22:46:42 2007
@@ -27,82 +27,96 @@
import java.util.Date;
import java.util.List;
-
/**
* Represents the physical resource for connecting to the bpel state store.
*/
-public interface BpelDAOConnection {
- /**
- * Return the DAO for a bpel process.
- *
- * @param processId name (identifier) of the process
- *
- * @return DAO
- */
- ProcessDAO getProcess(QName processId);
-
-
- /**
- * Retrieve a process instance from the database.
- * @param iid instance identifier
- * @return process instance
- */
- ProcessInstanceDAO getInstance(Long iid);
-
- /**
- * Retrieve a scope instance from the database.
- * @param siidl scope instance identifier
- * @return scope instance
- */
- ScopeDAO getScope(Long siidl);
-
- /**
- * Query instances in the database meeting the requested
- * criteria.
- * @param criteria
- * @return Collection<ProcessInstanceDAO>
- */
- Collection<ProcessInstanceDAO> instanceQuery(InstanceFilter criteria);
-
- /**
- * Insert a BPEL event into the database.
- * @param event a BPEL event
- * @param process associated process (optional)
- * @param instance associated instance (optional)
- */
- void insertBpelEvent(BpelEvent event, ProcessDAO process,
- ProcessInstanceDAO instance);
-
- /**
- * Execute a query for the timeline for BPEL events matching the criteria.
- * @param ifilter instance filter (optional)
- * @param efilter event filter (optional)
- * @return List of event timestamps of events matching the criteria
- */
- List<Date> bpelEventTimelineQuery(InstanceFilter ifilter, BpelEventFilter efilter);
-
- /**
- * Execute a query to retrieve the BPEL events matching the criteria.
- * @param ifilter instance filter
- * @param efilter event filter
- * @return
- */
- List<BpelEvent> bpelEventQuery(InstanceFilter ifilter, BpelEventFilter efilter);
-
- void close();
-
- Collection<ProcessInstanceDAO> instanceQuery(String expression);
-
- ProcessDAO createProcess(QName pid, QName type, String guid, long version);
-
-
- /**
- * Create a message exchange.
- * @param dir type of message exchange
- * @return
- */
- MessageExchangeDAO createMessageExchange(char dir);
+public interface BpelDAOConnection {
+ /**
+ * Return the DAO for a bpel process.
+ *
+ * @param processId
+ * name (identifier) of the process
+ *
+ * @return DAO
+ */
+ ProcessDAO getProcess(QName processId);
+
+ /**
+ * Retrieve a process instance from the database.
+ *
+ * @param iid
+ * instance identifier
+ * @return process instance
+ */
+ ProcessInstanceDAO getInstance(Long iid);
+
+ /**
+ * Retrieve a scope instance from the database.
+ *
+ * @param siidl
+ * scope instance identifier
+ * @return scope instance
+ */
+ ScopeDAO getScope(Long siidl);
+
+ /**
+ * Query instances in the database meeting the requested criteria.
+ *
+ * @param criteria
+ * @return Collection<ProcessInstanceDAO>
+ */
+ Collection<ProcessInstanceDAO> instanceQuery(InstanceFilter criteria);
+
+ /**
+ * Insert a BPEL event into the database.
+ *
+ * @param event
+ * a BPEL event
+ * @param process
+ * associated process (optional)
+ * @param instance
+ * associated instance (optional)
+ */
+ void insertBpelEvent(BpelEvent event, ProcessDAO process, ProcessInstanceDAO instance);
+
+ /**
+ * Execute a query for the timeline for BPEL events matching the criteria.
+ *
+ * @param ifilter
+ * instance filter (optional)
+ * @param efilter
+ * event filter (optional)
+ * @return List of event timestamps of events matching the criteria
+ */
+ List<Date> bpelEventTimelineQuery(InstanceFilter ifilter, BpelEventFilter efilter);
+
+ /**
+ * Execute a query to retrieve the BPEL events matching the criteria.
+ *
+ * @param ifilter
+ * instance filter
+ * @param efilter
+ * event filter
+ * @return
+ */
+ List<BpelEvent> bpelEventQuery(InstanceFilter ifilter, BpelEventFilter efilter);
+
+ void close();
+
+ Collection<ProcessInstanceDAO> instanceQuery(String expression);
+
+ ProcessDAO createProcess(QName pid, QName type, String guid, long version);
+
+ /**
+ * Create a message exchange.
+ *
+ * @param mexId message exchange id (application-assigned)
+ * @param dir
+ * type of message exchange
+ * @return
+ */
+ MessageExchangeDAO createMessageExchange(String mexId, char dir);
- MessageExchangeDAO getMessageExchange(String mexid);
+ MessageExchangeDAO getMessageExchange(String mexid);
}
Modified: ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageDAO.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageDAO.java (original)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageDAO.java Wed Sep 5 22:46:42 2007
@@ -23,16 +23,24 @@
import org.w3c.dom.Element;
-// TODO: Abstract out the data representation.
+/**
+ * Representation of a message (i.e. request/response) in the database.
+ *
+ * @author Maciej Szefler <mszefler at gmail dot com>
+ *
+ */
public interface MessageDAO {
- void setType(QName type);
-
- QName getType();
-
- void setData(Element value);
-
- Element getData();
+ /** Set the message type (i.e. the <wsdl:message> type). */
+ void setType(QName type);
+
+ /** Get the message type (i.e. the <wsdl:message> type). */
+ QName getType();
+
+ /** Set the message data (content). */
+ void setData(Element value);
+
+ /** Get the message data (content). */
+ Element getData();
- MessageExchangeDAO getMessageExchange();
}
Modified: ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageExchangeDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageExchangeDAO.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageExchangeDAO.java (original)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/MessageExchangeDAO.java Wed Sep 5 22:46:42 2007
@@ -18,12 +18,17 @@
*/
package org.apache.ode.bpel.dao;
-import org.w3c.dom.Element;
-
-import javax.xml.namespace.QName;
import java.util.Date;
import java.util.Set;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.iapi.InvocationStyle;
+import org.apache.ode.bpel.iapi.MessageExchange.AckType;
+import org.apache.ode.bpel.iapi.MessageExchange.FailureType;
+import org.apache.ode.bpel.iapi.MessageExchange.Status;
+import org.w3c.dom.Element;
+
/**
* Data access object for a message exchange.
*/
@@ -41,6 +46,19 @@
String getMessageExchangeId();
/**
+ * Get the invocation style.
+ * @return
+ */
+ InvocationStyle getInvocationStyle();
+
+ /**
+ * Set the invocation style.
+ * @param invocationStyle
+ */
+ void setInvocationStyle(InvocationStyle invocationStyle);
+
+
+ /**
* Get output message (could be fault message)
*
* @return output message DAO
@@ -88,14 +106,14 @@
*
* @param status state to be set
*/
- void setStatus(String status);
+ void setStatus(Status status);
/**
* Get state of last message sent/received.
*
* @return the state
*/
- String getStatus();
+ Status getStatus();
/**
* Create a new message associated with this message-exchange
@@ -133,11 +151,13 @@
void setPartnerLinkModelId(int modelId);
/**
- * Get the correlation identifier/client id
+ * Get the the partner's identifier for this message exchange. Generally, the partner will have a different
+ * identifier for each exchange. This key is used in sistuations when the partner needs to find the mex,
+ * but only has their own identifier.
*
* @return correlation identifier
*/
- String getCorrelationId();
+ String getPartnersKey();
/**
* Set the correlation identifier/client id
@@ -145,7 +165,7 @@
* @param correlationId
* identifier
*/
- void setCorrelationId(String correlationId);
+ void setPartnersKey(String correlationId);
void setPattern(String string);
@@ -172,8 +192,6 @@
*/
void setChannel(String string);
- boolean getPropagateTransactionFlag();
-
QName getFault();
void setFault(QName faultType);
@@ -210,14 +228,14 @@
char getDirection();
/**
- * Get the "callee"--the id of the process being invoked in a myRole
+ * Get the "callee"--the id of the service being invoked in a myRole
* exchange.
* @return
*/
QName getCallee();
/**
- * Set the "callee"--the id of the process being invoked in a myRole
+ * Set the "callee"--the id of the service being invoked in a myRole
* exchange.
* @param callee
*/
@@ -234,13 +252,30 @@
PartnerLinkDAO getPartnerLink();
/**
- * Gets the mex id for the message exchange that has been piped with
- * this one in a process to process interaction.
- * @return
+ * Gets the message exchange that has been piped with this one in a process to process interaction.
+ *
+ * @return other side of the message pipe
*/
String getPipedMessageExchangeId();
- void setPipedMessageExchangeId(String mexId);
-
+
+ void setPipedMessageExchangeId(String pipedMexId);
+
void release();
-}
+ void setFailureType(FailureType failureType);
+
+ FailureType getFailureType();
+
+ long getTimeout();
+
+ void setTimeout(long timeout);
+
+ void setAckType(AckType ackType);
+
+ AckType getAckType();
+
+ QName getPipedPID();
+
+ void setPipedPID(QName pipedPid);
+
+ }
Modified: ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessInstanceDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessInstanceDAO.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessInstanceDAO.java (original)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessInstanceDAO.java Wed Sep 5 22:46:42 2007
@@ -27,146 +27,156 @@
import javax.xml.namespace.QName;
-
/**
- * BPEL process instance data access object. This object serves as the root
- * object for data related to a particular process instance; this state
- * includes auditing events, scopes, pick/received waiters, and the
- * serialized process instance image.
+ * BPEL process instance data access object. This object serves as the root object for data related to a particular process
+ * instance; this state includes auditing events, scopes, pick/received waiters, and the serialized process instance image.
*/
public interface ProcessInstanceDAO {
/**
* Get the time when the process instance was created.
+ *
* @return time of instance creation
*/
public Date getCreateTime();
-
+
/**
* Get the time when the process instance was last active (re-hydrated).
+ *
* @return time of activity
*/
public Date getLastActiveTime();
-
+
/**
* Set last activity time for the process instance
- * @param dt tiem of activity
+ *
+ * @param dt
+ * tiem of activity
*/
void setLastActiveTime(Date dt);
/**
- * The un-caught fault associated with the process. This will be
- * <code>null</code> if no fault occurred or if all faults are caught and
- * processed.
- * @param fault the fault
+ * The un-caught fault associated with the process. This will be <code>null</code> if no fault occurred or if all faults are
+ * caught and processed.
+ *
+ * @param fault
+ * the fault
*/
void setFault(FaultDAO fault);
-
+
void setFault(QName faultName, String explanation, int faultLineNo, int activityId, Element faultMessage);
/**
- * The un-caught fault associated with the process. This will be
- * <code>null</code> if no fault occurred or if all faults are caught and
- * processed.
- *
+ * The un-caught fault associated with the process. This will be <code>null</code> if no fault occurred or if all faults are
+ * caught and processed.
+ *
* @return the fault
*/
FaultDAO getFault();
/**
* Get the (opaque) instance execution state.
+ *
* @return opaque execution state
*/
byte[] getExecutionState();
/**
* Set the (opaque) instance execution state.
- * @param execState execuction state
+ *
+ * @param execState
+ * execuction state
*/
void setExecutionState(byte[] execState);
/**
* Get the process.
- *
+ *
* @return process reference.
*/
ProcessDAO getProcess();
/**
* Get the root (global) scope for the process.
- *
+ *
* @return the root scope
*/
ScopeDAO getRootScope();
/**
- * Set the state of the process instance; one of the <code>STATE_XXX</code>
- * constants defined in ProcessState.
+ * Set the state of the process instance; one of the <code>STATE_XXX</code> constants defined in ProcessState.
*
* This should automatically populate the previous state.
- *
- * @param state new state of the process instance
+ *
+ * @param state
+ * new state of the process instance
*/
void setState(short state);
/**
- * Get the state of the process instance; one of the <code>STATE_XXX</code>
- * constants defined in ProcessState.
- *
+ * Get the state of the process instance; one of the <code>STATE_XXX</code> constants defined in ProcessState.
+ *
* @return state of process instance
*/
short getState();
-
+
/**
- * Returns the next to last state.
+ * Returns the next to last state.
+ *
* @return
*/
short getPreviousState();
/**
* Creates a new scope.
- *
- * @param parentScope parent scope of the new scope, or null if this is the
- * root scope.
- * @param name scope name
- *
+ *
+ * @param parentScope
+ * parent scope of the new scope, or null if this is the root scope.
+ * @param name
+ * scope name
+ *
* @return the newly created scope
*/
ScopeDAO createScope(ScopeDAO parentScope, String name, int scopeModelId);
/**
* Get the instance identifier.
+ *
* @return the instance identifier
*/
Long getInstanceId();
/**
* Returns a scope using its instance id.
+ *
* @param scopeInstanceId
* @return
*/
ScopeDAO getScope(Long scopeInstanceId);
-
- /**
+
+ /**
* Returns all the scopes with the associated name.
+ *
* @param scopeName
* @return
*/
Collection<ScopeDAO> getScopes(String scopeName);
-
- /**
+
+ /**
* Returns all the scopes belonging to this isntance.
+ *
* @param scopeName
* @return
*/
Collection<ScopeDAO> getScopes();
-
+
/**
* Return the correlator which results in the instantiation of the process instance.
+ *
* @return
*/
CorrelatorDAO getInstantiatingCorrelator();
-
+
/**
* Returns all variable instances matching the variable name for a specified scope.
*/
@@ -174,20 +184,22 @@
/**
* Get all the correlation sets for this process.
+ *
* @return {@link Set} of {@link CorrelationSetDAO} objects
*/
Set<CorrelationSetDAO> getCorrelationSets();
/**
* Get a correlation set by its name from this process
+ *
* @param name
* @return a {@link CorrelationSetDAO} object
*/
CorrelationSetDAO getCorrelationSet(String name);
/**
- * A simple callback to allow the ProcessInstance to perform post-completion duties.
- * The DAO's state indicates whether any fault has occured.
+ * A simple callback to allow the ProcessInstance to perform post-completion duties. The DAO's state indicates whether any fault
+ * has occured.
*/
void finishCompletion();
@@ -198,18 +210,22 @@
/**
* Insert a BPEL event to the database (associating with this process).
- * @param event BPEL event
+ *
+ * @param event
+ * BPEL event
*/
void insertBpelEvent(ProcessInstanceEvent event);
/**
* Get a triple containing the first
+ *
* @return
*/
EventsFirstLastCountTuple getEventsFirstLastCount();
- /**
+ /**
* Get the next number from a monotonically increasing sequence.
+ *
* @return next number in seqeunce
*/
public long genMonotonic();
@@ -232,25 +248,29 @@
Collection<ActivityRecoveryDAO> getActivityRecoveries();
/**
- * Create an activity recovery object for a given activity instance.
- * Specify the reason and optional data associated with the failure.
- * Date/time failure occurred, and the recovery channel and available
- * recovery actions.
+ * Create an activity recovery object for a given activity instance. Specify the reason and optional data associated with the
+ * failure. Date/time failure occurred, and the recovery channel and available recovery actions.
*/
- void createActivityRecovery(String channel, long activityId, String reason, Date dateTime, Element data, String[] actions, int retries);
+ void createActivityRecovery(String channel, long activityId, String reason, Date dateTime, Element data, String[] actions,
+ int retries);
/**
* Delete previously registered activity recovery.
*/
void deleteActivityRecovery(String channel);
+ public int getExecutionStateCounter();
+
+ public void setExecutionStateCounter(int stateCounter);
+
/**
- * Transport object holding the date of the first and last instance event
- * along with the number events.
+ * Transport object holding the date of the first and last instance event along with the number events.
*/
public class EventsFirstLastCountTuple {
public Date first;
+
public Date last;
+
public int count;
}
Modified: ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/MockScheduler.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/MockScheduler.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/MockScheduler.java (original)
+++ ode/trunk/bpel-epr/src/main/java/org/apache/ode/il/MockScheduler.java Wed Sep 5 22:46:42 2007
@@ -24,15 +24,12 @@
import java.util.List;
import java.util.Map;
import java.util.Timer;
-import java.util.TimerTask;
import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
-import javax.transaction.Status;
import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
import org.apache.commons.logging.Log;
@@ -41,124 +38,58 @@
import org.apache.ode.bpel.iapi.Scheduler;
/**
+ *
* @author Matthieu Riou <mriou at apache dot org>
+ *
+ * - BART refactor: Removed transaction management logic.
+ * @author Maciej Szefler <mszefler at gmail dot com>
*/
public class MockScheduler implements Scheduler {
private static final Log __log = LogFactory.getLog(MockScheduler.class);
private JobProcessor _processor;
- private ExecutorService _executorSvc = Executors.newCachedThreadPool();
- private ThreadLocal<Boolean> _transacted = new ThreadLocal<Boolean>();
- private TransactionManager _txm;
private Timer _timer = new Timer(false);
- public MockScheduler() {
- _transacted.set(false);
- }
+ private ScheduledExecutorService _exec;
+
+ private TransactionManager _txm;
public MockScheduler(TransactionManager txm) {
_txm = txm;
- _transacted.set(false);
+ _exec = Executors.newSingleThreadScheduledExecutor();
}
- ThreadLocal<List<Synchronizer>> _synchros = new ThreadLocal<List<Scheduler.Synchronizer>>() {
+ ThreadLocal<List<Synchronization>> _synchros = new ThreadLocal<List<Synchronization>>() {
@Override
- protected List<Synchronizer> initialValue() {
- return new ArrayList<Synchronizer>();
+ protected List<Synchronization> initialValue() {
+ return new ArrayList<Synchronization>();
}
};
- public String schedulePersistedJob(final Map<String, Object> detail, final Date date) throws ContextException {
- if (date != null) {
- registerSynchronizer(new Synchronizer() {
- public void afterCompletion(boolean success) {
- if (!success) return;
- _timer.schedule(new TimerTask() {
- public void run() {
- try {
- execIsolatedTransaction(new Callable() {
- public Object call() throws Exception {
- JobInfo ji = new JobInfo("volatileJob", detail, 0);
- doExecute(ji);
- return null;
- }
- });
- } catch (Exception e) {
- throw new ContextException("Failure when scheduling a new volatile job.", e);
- }
- }
- }, date);
- }
- public void beforeCompletion() { }
- });
- return null;
- } else {
- return scheduleVolatileJob(true, detail);
- }
- }
-
- public String scheduleVolatileJob(final boolean transacted, final Map<String, Object> detail) throws ContextException {
- registerSynchronizer(new Synchronizer() {
- public void afterCompletion(boolean success) {
- if (!success) return;
- try {
- if (transacted) {
- execIsolatedTransaction(new Callable() {
- public Object call() throws Exception {
- JobInfo ji = new JobInfo("volatileJob", detail, 0);
- doExecute(ji);
- return null;
- }
- });
- } else {
- JobInfo ji = new JobInfo("volatileJob", detail, 0);
+ public String schedulePersistedJob(final Map<String, Object> detail, Date dt) throws ContextException {
+ final Date date = dt == null ? new Date() : dt;
+ registerSynchronizer(new Synchronization() {
+ public void afterCompletion(int status) {
+ long delay = Math.max(0, date.getTime() - System.currentTimeMillis());
+ _exec.schedule(new Callable<Void>() {
+ public Void call() throws Exception {
+ JobInfo ji = new JobInfo("job" + System.currentTimeMillis(), detail, 0);
doExecute(ji);
+ return null;
}
- } catch (Exception e) {
- throw new ContextException("Failure when starting a new volatile job.", e);
- }
+ }, delay, TimeUnit.MILLISECONDS);
+ }
+
+ public void beforeCompletion() {
}
- public void beforeCompletion() { }
});
return null;
- }
-
- public void cancelJob(String arg0) throws ContextException {
}
- public <T> T execTransaction(Callable<T> transaction) throws Exception, ContextException {
- begin();
- try {
- T retval = transaction.call();
- commit();
- return retval;
- } catch (Throwable t) {
- __log.error("Caught an exception during transaction", t);
- rollback();
- throw new ContextException("Error in tx", t);
- }
- }
+ public void cancelJob(String arg0) throws ContextException {
- public <T> Future<T> execIsolatedTransaction(final Callable<T> transaction) throws Exception, ContextException {
- return _executorSvc.submit(new Callable<T>() {
- public T call() throws Exception {
- return execTransaction(transaction);
- }
- });
- }
-
- public boolean isTransacted() {
- if (_txm != null) {
- try {
- return _txm.getTransaction() != null;
- } catch (SystemException e) {
- __log.error("Exception in mock scheduler isTransacted.", e);
- throw new RuntimeException(e);
- }
- }
- else return _transacted.get();
}
public void start() {
@@ -170,88 +101,15 @@
public void shutdown() {
}
- public void registerSynchronizer(final Synchronizer synch) throws ContextException {
- if (_txm != null) {
- try {
- _txm.getTransaction().registerSynchronization(new Synchronization() {
- public void beforeCompletion() {
- synch.beforeCompletion();
- }
- public void afterCompletion(int status) {
- synch.afterCompletion(status == Status.STATUS_COMMITTED);
- }
- });
- } catch (Exception e) {
- __log.error("Exception in mock scheduler sync registration.", e);
- throw new RuntimeException(e);
- }
- } else {
- _synchros.get().add(synch);
- }
- }
-
- public void begin() {
- if (_txm != null) {
- try {
- _txm.begin();
- } catch (Exception e) {
- __log.error("Exception in mock scheduler begin.", e);
- throw new RuntimeException(e);
- }
- } else {
- _synchros.get().clear();
- }
- _transacted.set(Boolean.TRUE);
- }
-
- public void commit() {
- if (_txm != null) {
- try {
- _txm.commit();
- } catch (Exception e) {
- __log.error("Exception in mock scheduler commit.", e);
- throw new RuntimeException(e);
- }
- } else {
- for (Synchronizer s : _synchros.get())
- try {
- s.beforeCompletion();
- } catch (Throwable t) {
- }
- for (Synchronizer s : _synchros.get())
- try {
- s.afterCompletion(true);
- } catch (Throwable t) {
- }
-
- _synchros.get().clear();
+ private void registerSynchronizer(final Synchronization synch) throws ContextException {
+ try {
+ _txm.getTransaction().registerSynchronization(synch);
+ } catch (Exception e) {
+ __log.error("Exception in mock scheduler sync registration.", e);
+ throw new RuntimeException(e);
}
- _transacted.set(Boolean.FALSE);
}
- public void rollback() {
- if (_txm != null) {
- try {
- _txm.rollback();
- } catch (Exception e) {
- __log.error("Exception in mock scheduler rollback.", e);
- throw new RuntimeException(e);
- }
- } else {
- for (Synchronizer s : _synchros.get())
- try {
- s.beforeCompletion();
- } catch (Throwable t) {
- }
- for (Synchronizer s : _synchros.get())
- try {
- s.afterCompletion(false);
- } catch (Throwable t) {
- }
- _synchros.get().clear();
- }
- _transacted.set(Boolean.FALSE);
- }
private void doExecute(JobInfo ji) {
JobProcessor processor = _processor;
@@ -268,7 +126,7 @@
_processor = processor;
}
- public void setExecutorSvc(ExecutorService executorSvc) {
- _executorSvc = executorSvc;
+ public void jobCompleted(String jobId) {
+
}
}
Modified: ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OFaultHandler.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OFaultHandler.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OFaultHandler.java (original)
+++ ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OFaultHandler.java Wed Sep 5 22:46:42 2007
@@ -36,7 +36,4 @@
super(owner);
}
- public Collection<OLink> outgoinglinks() {
- throw new UnsupportedOperationException(); // TODO: implement me!
- }
}
Modified: ode/trunk/bpel-ql/src/main/java/org/apache/ode/ql/jcc/TreeBuilder.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-ql/src/main/java/org/apache/ode/ql/jcc/TreeBuilder.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-ql/src/main/java/org/apache/ode/ql/jcc/TreeBuilder.java (original)
+++ ode/trunk/bpel-ql/src/main/java/org/apache/ode/ql/jcc/TreeBuilder.java Wed Sep 5 22:46:42 2007
@@ -48,7 +48,6 @@
org.apache.ode.ql.jcc.ASTStart start = new Parser(query).start();
return build(start);
}catch(ParseException ex) {
- //TODO create common exception which will indicate parsing exception
throw new RuntimeException(ex.getMessage(), ex);
}
}
@@ -119,7 +118,6 @@
ASTOrderType astType = (ASTOrderType)extractChildNode(node, 1);
type = OrderByType.valueOf(astType.getValue().toUpperCase());
} else {
- //TODO
throw new IllegalArgumentException();
}
Identifier id = createIdentifier(node, 0);
@@ -185,7 +183,6 @@
if(node instanceof ASTProperty) {
return new org.apache.ode.ql.tree.nodes.Property(((ASTProperty)node).getName());
}
- //TODO
throw new IllegalArgumentException("");
}
private ASTValue extractValue(Node parentNode, int index) {
@@ -196,14 +193,12 @@
private Node extractChildNode(Node parentNode, int index, Class expected) {
Node node = extractChildNode(parentNode, index);
if(!(expected.isAssignableFrom(node.getClass()))) {
- //TODO
throw new IllegalArgumentException("");
}
return node;
}
private Node extractChildNode(Node parentNode, int index) {
if(parentNode.jjtGetNumChildren()<=index) {
- //TODO
throw new IllegalArgumentException("");
}
return parentNode.jjtGetChild(index);
Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java Wed Sep 5 22:46:42 2007
@@ -147,8 +147,8 @@
try {
return ISO8601DateParser.parseCal(literal);
} catch (Exception ex) {
- String errmsg = "Invalid date: " + literal;
- __log.error(errmsg, ex);
+ String errmsg = "Invalid date format: " + literal;
+ __log.error(errmsg);
throw new FaultException(cexp.getOwner().constants.qnInvalidExpressionValue,errmsg);
}
}
Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelDatabase.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelDatabase.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelDatabase.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelDatabase.java Wed Sep 5 22:46:42 2007
@@ -18,67 +18,71 @@
*/
package org.apache.ode.bpel.engine;
-
-
import javax.xml.namespace.QName;
import org.apache.ode.bpel.dao.BpelDAOConnection;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
-import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
- * Encapsulates transactional access to the BPEL database.
+ * Mostly of historical interest. Provides transactional access to the BPEL database, defines a Callable-style
+ * interface for transactions.
+ *
+ * <p>Should probably be eliminated. --mszefler 2007-07-26 </p>
+ *
+ * @author Maciej Szefler <mszefler at gmail dot com>
*/
class BpelDatabase {
- static Log __log = LogFactory.getLog(BpelDatabase.class);
+ static Log __log = LogFactory.getLog(BpelDatabase.class);
+
+ protected BpelDAOConnectionFactory _sscf;
- protected BpelDAOConnectionFactory _sscf;
- protected Scheduler _scheduler;
+ protected Contexts _contexts;
- BpelDatabase(BpelDAOConnectionFactory sscf, Scheduler scheduler) {
- if (sscf == null)
- throw new NullPointerException("sscf is null!");
- if (scheduler == null)
- throw new NullPointerException("scheduler is null!");
-
- _sscf = sscf;
- _scheduler = scheduler;
-
- }
-
- /**
- * Get a connection to the database with the correct store identifier.
- * @return a state store connection
- * @throws org.apache.ode.utils.dao.DConnectionException
- */
- BpelDAOConnection getConnection() {
- // Note: this will give us a connection associated with the current
- // transaction, so no need to worry about closing it.
- return _sscf.getConnection();
- }
-
- BpelProcessDatabase getProcessDb(QName pid) {
- return new BpelProcessDatabase(_sscf, _scheduler, pid);
- }
-
- /**
- * Execute a self-contained database transaction.
- * @param callable database transaction
- * @return
- * @throws DConnectionException
- */
- <T> T exec(final Callable<T> callable) throws Exception {
- return _scheduler.execTransaction(new java.util.concurrent.Callable<T>() {
- public T call() throws Exception {
- return callable.run(_sscf.getConnection());
- }
- });
- }
-
- interface Callable<T> {
- public T run(BpelDAOConnection conn) throws Exception;
- }
+ BpelDatabase(Contexts contexts) {
+ if (contexts == null)
+ throw new NullPointerException("scheduler is null!");
+
+ _sscf = contexts.dao;
+ _contexts = contexts;
+
+ }
+
+ /**
+ * Get a connection to the database with the correct store identifier.
+ *
+ * @return a state store connection
+ * @throws org.apache.ode.utils.dao.DConnectionException
+ */
+ BpelDAOConnection getConnection() {
+ // Note: this will give us a connection associated with the current
+ // transaction, so no need to worry about closing it.
+ return _sscf.getConnection();
+ }
+
+ BpelProcessDatabase getProcessDb(QName pid) {
+ return new BpelProcessDatabase(_contexts, pid);
+ }
+
+ /**
+ * Execute a self-contained database transaction.
+ *
+ * @param callable
+ * database transaction
+ * @return
+ * @throws DConnectionException
+ */
+ <T> T exec(final Callable<T> callable) throws Exception {
+ return _contexts.execTransaction(new java.util.concurrent.Callable<T>() {
+ public T call() throws Exception {
+ return callable.run(_sscf.getConnection());
+ }
+ });
+ }
+
+ interface Callable<T> {
+ public T run(BpelDAOConnection conn) throws Exception;
+ }
}
Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java?rev=573153&r1=573152&r2=573153&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java Wed Sep 5 22:46:42 2007
@@ -40,6 +40,8 @@
* Implementation of the instance/process management interaction. This class implements
* the methods necessary to support process debugging. It also implements all the methods in the
* newer Process/Instance Management interface (pmapi).
+ *
+ * @author Maciej Szefler <mszefler at gmail dot com>
*/
public class BpelManagementFacadeImpl extends ProcessAndInstanceManagementImpl
implements BpelManagementFacade {
@@ -183,14 +185,8 @@
* @param procid
*/
public OProcess getProcessDef(String procid) throws ManagementException {
- if (_server._engine == null)
- throw new ProcessingException("ServiceProvider required for debugger operation.");
- BpelProcess process = _server._engine._activeProcesses.get(QName.valueOf(procid));
- if (process == null)
- throw new InvalidRequestException("The process \"" + procid + "\" is not available. Please make sure it is deployed and encompassing System is activated." );
-
- return process.getOProcess();
+ return _server.getOProcess(QName.valueOf(procid));
}
public void step(final Long iid) throws ManagementException {