You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2008/08/05 01:54:05 UTC
svn commit: r682542 [1/4] - in /ode/branches/rtver:
axis2/src/main/java/org/apache/ode/axis2/
bpel-api/src/main/java/org/apache/ode/bpel/rapi/
bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/
bpel-compiler/src/main/java/org/apache/ode/bpel/com...
Author: mriou
Date: Mon Aug 4 16:54:02 2008
New Revision: 682542
URL: http://svn.apache.org/viewvc?rev=682542&view=rev
Log:
Broke and repaired the compiler again. I might break it a little more again but we're getting there.
Added:
ode/branches/rtver/bpel-api/src/main/java/org/apache/ode/bpel/rapi/Serializer.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompilerFactory.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SourceLocation.java
- copied, changed from r680846, ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SourceLocationImpl.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ActivityGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BaseCompiler.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler11.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20Draft.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompilerImpl.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/CompensateGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/CompensateGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/CompensateScopeGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/CompilerContext.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/DefaultActivityGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/EmptyGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ExpressionCompiler.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ExtensionActivityGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ExtensionActivtityGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ExtensionValidator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/FlowGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/FlowGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ForEachGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/IfGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/IfGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/PickGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/PickGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/PickReceiveGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ReceiveGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/RepeatUntilGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ReplyGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ReplyGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/RethrowGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/SequenceGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/SwitchGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/TerminateGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ThrowGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/WaitGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/WaitGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/WhileGenerator.java
ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/Serializers.java
Removed:
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ActivityGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BaseCompiler.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler11.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20Draft.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CompensateGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CompensateGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CompensateScopeGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultActivityGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/EmptyGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivityGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivtityGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/FlowGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/FlowGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/IfGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/IfGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickReceiveGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReceiveGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/RepeatUntilGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/RethrowGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SequenceGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SourceLocationImpl.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SwitchGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/TerminateGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ThrowGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WaitGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WaitGeneratorMessages.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WhileGenerator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilerContext.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/ExpressionCompiler.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/ExtensionValidator.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/SourceLocation.java
Modified:
ode/branches/rtver/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationException.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationMessage.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/JaxenBpelHandler.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/SourceLocatorWrapper.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XPath10ExpressionCompilerBPEL11.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XPath10ExpressionCompilerBPEL20.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XPath10ExpressionCompilerImpl.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XslCompilationErrorListener.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath10/compiler/XslCompileUriResolver.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpFunctionResolver.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/JaxpVariableResolver.java
ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/elang/xpath20/compiler/XPath20ExpressionCompilerImpl.java
ode/branches/rtver/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/CompilationMessageTest.java
ode/branches/rtver/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/WSDLRegistryTest.java
ode/branches/rtver/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java
ode/branches/rtver/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/MockCompilerContext.java
ode/branches/rtver/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
ode/branches/rtver/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
ode/branches/rtver/bpel-test/src/test/java/org/apache/ode/test/ExtensibilityTest.java
ode/branches/rtver/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeImpl.java
ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/Serializer.java
Modified: ode/branches/rtver/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?rev=682542&r1=682541&r2=682542&view=diff
==============================================================================
--- ode/branches/rtver/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java (original)
+++ ode/branches/rtver/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java Mon Aug 4 16:54:02 2008
@@ -47,7 +47,7 @@
import org.apache.ode.axis2.service.ManagementService;
import org.apache.ode.axis2.httpbinding.HttpExternalService;
import org.apache.ode.axis2.soapbinding.SoapExternalService;
-import org.apache.ode.bpel.compiler.api.ExtensionValidator;
+import org.apache.ode.bpel.compiler.v2.ExtensionValidator;
import org.apache.ode.bpel.connector.BpelServerConnector;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
import org.apache.ode.bpel.engine.BpelServerImpl;
Added: ode/branches/rtver/bpel-api/src/main/java/org/apache/ode/bpel/rapi/Serializer.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-api/src/main/java/org/apache/ode/bpel/rapi/Serializer.java?rev=682542&view=auto
==============================================================================
--- ode/branches/rtver/bpel-api/src/main/java/org/apache/ode/bpel/rapi/Serializer.java (added)
+++ ode/branches/rtver/bpel-api/src/main/java/org/apache/ode/bpel/rapi/Serializer.java Mon Aug 4 16:54:02 2008
@@ -0,0 +1,11 @@
+package org.apache.ode.bpel.rapi;
+
+import java.io.OutputStream;
+import java.io.IOException;
+
+public interface Serializer {
+
+ public void writePModel(ProcessModel process, OutputStream os) throws IOException;
+
+ public ProcessModel readPModel() throws IOException, ClassNotFoundException;
+}
Modified: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java?rev=682542&r1=682541&r2=682542&view=diff
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java (original)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java Mon Aug 4 16:54:02 2008
@@ -26,7 +26,6 @@
import java.io.OutputStream;
import java.net.URI;
import java.util.Map;
-
import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
@@ -34,12 +33,12 @@
import org.apache.ode.bpel.compiler.api.CompilationException;
import org.apache.ode.bpel.compiler.api.CompilationMessage;
import org.apache.ode.bpel.compiler.api.CompileListener;
-import org.apache.ode.bpel.compiler.api.ExtensionValidator;
-import org.apache.ode.bpel.compiler.api.SourceLocation;
+import org.apache.ode.bpel.compiler.v2.ExtensionValidator;
import org.apache.ode.bpel.compiler.bom.BpelObjectFactory;
import org.apache.ode.bpel.compiler.bom.Process;
-import org.apache.ode.bpel.rtrep.v2.OProcess;
-import org.apache.ode.bpel.rtrep.v2.Serializer;
+import org.apache.ode.bpel.rapi.ProcessModel;
+import org.apache.ode.bpel.rapi.Serializer;
+import org.apache.ode.bpel.rtrep.Serializers;
import org.apache.ode.utils.StreamUtils;
import org.apache.ode.utils.msg.MessageBundle;
import org.w3c.dom.Node;
@@ -47,8 +46,7 @@
/**
* <p>
- * Wrapper for {@link org.apache.ode.bpel.compiler.BpelCompiler} implementations,
- * providing basic utility methods and auto-detection of BPEL version.
+ * Wrapper for BpelCompiler implementations, providing basic utility methods and auto-detection of BPEL version.
* </p>
s */
public class BpelC {
@@ -196,9 +194,7 @@
logCompilationMessage(__cmsgs.infCompilingProcess());
- BpelCompiler compiler;
ResourceFinder wf;
-
if (_wsdlFinder != null) {
wf = _wsdlFinder;
} else {
@@ -216,27 +212,25 @@
}
};
+ BpelCompiler compiler;
try {
+ compiler = BpelCompilerFactory.latestCompiler(process.getBpelVersion());
+ compiler.setResourceFinder(wf);
+
switch (process.getBpelVersion()) {
case BPEL20:
- compiler = new BpelCompiler20();
- compiler.setResourceFinder(wf);
if (_bpel11wsdl != null) {
CompilationMessage cmsg = __cmsgs.warnWsdlUriIgnoredFor20Process();
logCompilationMessage(cmsg);
}
break;
case BPEL20_DRAFT:
- compiler = new BpelCompiler20Draft();
- compiler.setResourceFinder(wf);
if (_bpel11wsdl != null) {
CompilationMessage cmsg = __cmsgs.warnWsdlUriIgnoredFor20Process();
logCompilationMessage(cmsg);
}
break;
case BPEL11:
- compiler = new BpelCompiler11();
- compiler.setResourceFinder(wf);
if (_bpel11wsdl != null) {
compiler.addWsdlImport(new URI(_bpelFile.getName()), _bpel11wsdl,null);
} else {
@@ -270,9 +264,9 @@
throw new CompilationException(cmsg,ex);
}
- OProcess oprocess;
+ ProcessModel pmodel;
try {
- oprocess = compiler.compile(process,wf);
+ pmodel = compiler.compile(process, wf);
}
catch (CompilationException cex) {
this.invalidate();
@@ -294,8 +288,8 @@
}
try {
- Serializer fileHeader = new Serializer(System.currentTimeMillis());
- fileHeader.writeOProcess(oprocess, _outputStream);
+ Serializer fileHeader = Serializers.getLatest();
+ fileHeader.writePModel(pmodel, _outputStream);
} finally {
// close & mark myself invalid
this.invalidate();
@@ -331,7 +325,7 @@
process = BpelObjectFactory.getInstance().parse(isrc,_bpelFile.toURI());
} catch (Exception e) {
- CompilationMessage cmsg = __cmsgs.errBpelParseErr().setSource(new SourceLocationImpl(bpelFile.toURI()));
+ CompilationMessage cmsg = __cmsgs.errBpelParseErr().setSource(new SourceLocation(bpelFile.toURI()));
this.invalidate();
throw new CompilationException(cmsg, e);
}
Added: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java?rev=682542&view=auto
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java (added)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java Mon Aug 4 16:54:02 2008
@@ -0,0 +1,33 @@
+package org.apache.ode.bpel.compiler;
+
+import org.apache.ode.bpel.compiler.api.CompileListener;
+import org.apache.ode.bpel.compiler.v2.ExtensionValidator;
+import org.apache.ode.bpel.compiler.bom.Process;
+import org.apache.ode.bpel.rapi.ProcessModel;
+import org.w3c.dom.Node;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+import java.net.URI;
+
+public interface BpelCompiler {
+
+ public enum Version {
+ BPEL11,
+ BPEL20_DRAFT,
+ BPEL20
+ }
+
+ void setResourceFinder(ResourceFinder rf);
+
+ void setCompileListener(CompileListener cl);
+
+ void setCustomProperties(Map<QName, Node> props);
+
+ void setExtensionValidators(Map<QName, ExtensionValidator> validators);
+
+ void addWsdlImport(URI from, URI wsdlImport, SourceLocation sloc);
+
+ ProcessModel compile(Process p, ResourceFinder rf);
+
+}
Added: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompilerFactory.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompilerFactory.java?rev=682542&view=auto
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompilerFactory.java (added)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompilerFactory.java Mon Aug 4 16:54:02 2008
@@ -0,0 +1,49 @@
+package org.apache.ode.bpel.compiler;
+
+import org.apache.ode.bpel.compiler.v2.BpelCompiler20;
+import org.apache.ode.bpel.compiler.v2.BpelCompiler20Draft;
+import org.apache.ode.bpel.compiler.v2.BpelCompiler11;
+import org.apache.ode.bpel.compiler.api.CompilationMessage;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.utils.msg.MessageBundle;
+
+import java.net.URI;
+
+public class BpelCompilerFactory {
+
+ private static final CommonCompilationMessages __cmsgs =
+ MessageBundle.getMessages(CommonCompilationMessages.class);
+
+ /**
+ * Creates a new compiler for the latest version of the internal BPEL model and the provided version
+ * of the BPEL specification.
+ */
+ public static BpelCompiler latestCompiler(BpelCompiler.Version bpelVersion) {
+ BpelCompiler compiler;
+ switch (bpelVersion) {
+ case BPEL20:
+ compiler = new BpelCompiler20();
+ break;
+ case BPEL20_DRAFT:
+ compiler = new BpelCompiler20Draft();
+ break;
+ case BPEL11:
+ compiler = new BpelCompiler11();
+ break;
+ default:
+ CompilationMessage cmsg = __cmsgs.errUnrecognizedBpelVersion();
+ throw new CompilationException(cmsg);
+ }
+
+ return compiler;
+ }
+
+ /**
+ * Creates a new compiler for the provided version of the internal BPEL model and the provided version
+ * of the BPEL specification.
+ */
+ public static BpelCompiler versionCompiler(BpelCompiler.Version bpelVersion, int version) {
+ // TODO switch on the version when we'll have more than one
+ return latestCompiler(bpelVersion);
+ }
+}
Modified: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java?rev=682542&r1=682541&r2=682542&view=diff
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java (original)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java Mon Aug 4 16:54:02 2008
@@ -33,42 +33,42 @@
* Resolver implementation that restricts us to a known set of resources.
*/
class LocalEntityResolver implements EntityResolver {
- private static final Log __log = LogFactory.getLog(LocalEntityResolver.class);
+ private static final Log __log = LogFactory.getLog(LocalEntityResolver.class);
- private final HashMap<String, URL> _mappings = new HashMap<String,URL>();
-
- public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException {
- if (__log.isTraceEnabled())
- __log.trace("resolveEntity(" + publicId + "," + systemId + ")") ;
-
- URL target = _mappings.get(systemId);
- if (target == null)
- target = _mappings.get(publicId);
-
- if (target == null) {
- if (__log.isDebugEnabled())
- __log.debug("resolveEntity(" + publicId + "," + systemId +
- ") failed (resource not found) ");
- throw new IOException("Resource not found: " + publicId + " : " + systemId);
+ private final HashMap<String, URL> _mappings = new HashMap<String,URL>();
+
+ public InputSource resolveEntity(String publicId, String systemId)
+ throws SAXException, IOException {
+ if (__log.isTraceEnabled())
+ __log.trace("resolveEntity(" + publicId + "," + systemId + ")") ;
+
+ URL target = _mappings.get(systemId);
+ if (target == null)
+ target = _mappings.get(publicId);
+
+ if (target == null) {
+ if (__log.isDebugEnabled())
+ __log.debug("resolveEntity(" + publicId + "," + systemId +
+ ") failed (resource not found) ");
+ throw new IOException("Resource not found: " + publicId + " : " + systemId);
+ }
+
+ if (__log.isDebugEnabled())
+ __log.debug("resolveEntity(" + publicId + "," + systemId +
+ ") ==> target" );
+
+ return new InputSource(target.openStream());
+ }
+
+
+ void register(String id, URL location) {
+ if (id == null)
+ throw new NullPointerException("id arg must not be null!");
+ if (location == null)
+ throw new NullPointerException("location arg must not be null");
+
+ if (__log.isDebugEnabled())
+ __log.debug("mapping " + id + " ==> " + location);
+ _mappings.put(id, location);
}
-
- if (__log.isDebugEnabled())
- __log.debug("resolveEntity(" + publicId + "," + systemId +
- ") ==> target" );
-
- return new InputSource(target.openStream());
- }
-
-
- void register(String id, URL location) {
- if (id == null)
- throw new NullPointerException("id arg must not be null!");
- if (location == null)
- throw new NullPointerException("location arg must not be null");
-
- if (__log.isDebugEnabled())
- __log.debug("mapping " + id + " ==> " + location);
- _mappings.put(id, location);
- }
}
Copied: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SourceLocation.java (from r680846, ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SourceLocationImpl.java)
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SourceLocation.java?p2=ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SourceLocation.java&p1=ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SourceLocationImpl.java&r1=680846&r2=682542&rev=682542&view=diff
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SourceLocationImpl.java (original)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SourceLocation.java Mon Aug 4 16:54:02 2008
@@ -20,16 +20,17 @@
import java.net.URI;
-import org.apache.ode.bpel.compiler.api.SourceLocation;
-
-class SourceLocationImpl implements SourceLocation {
+public class SourceLocation {
private int _col;
private int _line;
private String _path;
private URI _uri;
- SourceLocationImpl(URI uri) {
+ public SourceLocation() {
+ }
+
+ SourceLocation(URI uri) {
_uri = uri;
}
Modified: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java?rev=682542&r1=682541&r2=682542&view=diff
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java (original)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLRegistry.java Mon Aug 4 16:54:02 2008
@@ -21,7 +21,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.compiler.api.CompilationException;
-import org.apache.ode.bpel.compiler.api.CompilerContext;
+import org.apache.ode.bpel.compiler.v2.CompilerContext;
import org.apache.ode.bpel.compiler.bom.PartnerLinkType;
import org.apache.ode.bpel.compiler.bom.PropertyAlias;
import org.apache.ode.bpel.compiler.wsdl.Definition4BPEL;
@@ -49,7 +49,7 @@
/**
* A parsed collection of WSDL definitions, including BPEL-specific extensions.
*/
-class WSDLRegistry {
+public class WSDLRegistry {
private static final Log __log = LogFactory.getLog(WSDLRegistry.class);
private static final CommonCompilationMessages __cmsgs =
@@ -65,7 +65,7 @@
private CompilerContext _ctx;
- WSDLRegistry(CompilerContext cc) {
+ public WSDLRegistry(CompilerContext cc) {
// bogus schema to force schema creation
_schemas.put(URI.create("http://fivesight.com/bogus/namespace"),
("<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
@@ -130,7 +130,7 @@
}
}
- ArrayList<Definition4BPEL> defs = null;
+ ArrayList<Definition4BPEL> defs;
if (_definitions.get(def.getTargetNamespace()) == null) defs = new ArrayList<Definition4BPEL>();
else defs = _definitions.get(def.getTargetNamespace());
@@ -165,11 +165,11 @@
if (importDef == null) {
CompilationException ce = new CompilationException(
__cmsgs.errWsdlImportNotFound(im.getNamespaceURI(),
- im.getLocationURI()).setSource(new SourceLocationImpl(defuri)));
+ im.getLocationURI()).setSource(new SourceLocation(defuri)));
if (_ctx == null)
throw ce;
- _ctx.recoveredFromError(new SourceLocationImpl(defuri), ce);
+ _ctx.recoveredFromError(new SourceLocation(defuri), ce);
continue;
}
@@ -193,13 +193,9 @@
Types types = def.getTypes();
if (types != null) {
- for (Iterator<ExtensibilityElement> iter =
- ((List<ExtensibilityElement>)def.getTypes().getExtensibilityElements()).iterator();
- iter.hasNext();) {
- ExtensibilityElement ee = iter.next();
-
+ for (ExtensibilityElement ee : ((List<ExtensibilityElement>) def.getTypes().getExtensibilityElements())) {
if (ee instanceof XMLSchemaType) {
- String schema = ((XMLSchemaType)ee).getXMLSchema();
+ String schema = ((XMLSchemaType) ee).getXMLSchema();
WsdlFinderXMLEntityResolver resolver = new WsdlFinderXMLEntityResolver(rf, defuri, _internalSchemas, false);
@@ -216,10 +212,10 @@
throw new RuntimeException("Couldn't parse schema in " + def.getTargetNamespace(), e);
}
} catch (XsdException xsde) {
- __log.debug("captureSchemas: capture failed for " + defuri,xsde);
+ __log.debug("captureSchemas: capture failed for " + defuri, xsde);
LinkedList<XsdException> exceptions = new LinkedList<XsdException>();
- while (xsde != null) {
+ while (xsde != null) {
exceptions.addFirst(xsde);
xsde = xsde.getPrevious();
}
@@ -228,9 +224,9 @@
// TODO: the line number here is going to be wrong for the in-line schema.
// String location = ex.getSystemId() + ":" + ex.getLineNumber();
CompilationException ce = new CompilationException(
- __cmsgs.errSchemaError(ex.getDetailMessage()).setSource(new SourceLocationImpl(defuri)));
+ __cmsgs.errSchemaError(ex.getDetailMessage()).setSource(new SourceLocation(defuri)));
if (_ctx != null)
- _ctx.recoveredFromError(new SourceLocationImpl(defuri),ce);
+ _ctx.recoveredFromError(new SourceLocation(defuri), ce);
else
throw ce;
}
Modified: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationException.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationException.java?rev=682542&r1=682541&r2=682542&view=diff
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationException.java (original)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationException.java Mon Aug 4 16:54:02 2008
@@ -22,26 +22,26 @@
* Exception indicating a compilation error.
*/
public class CompilationException extends RuntimeException {
- private static final long serialVersionUID = -4683674811787611083L;
- private CompilationMessage _msg;
+ private static final long serialVersionUID = -4683674811787611083L;
+ private CompilationMessage _msg;
- public CompilationException(CompilationMessage msg, Throwable cause) {
- super(msg.toErrorString(),cause);
- _msg = msg;
- }
- /**
- * @see Exception#Exception(String,Throwable)
- */
- public CompilationException(CompilationMessage msg) {
- this(msg, null);
- }
+ public CompilationException(CompilationMessage msg, Throwable cause) {
+ super(msg.toErrorString(),cause);
+ _msg = msg;
+ }
+ /**
+ * @see Exception#Exception(String,Throwable)
+ */
+ public CompilationException(CompilationMessage msg) {
+ this(msg, null);
+ }
- public String toErrorMessage() {
- return _msg.toErrorString();
- }
+ public String toErrorMessage() {
+ return _msg.toErrorString();
+ }
- /** Get the {@link CompilationMessage} associated with this exception}. */
- public CompilationMessage getCompilationMessage() {
- return _msg;
- }
+ /** Get the {@link CompilationMessage} associated with this exception}. */
+ public CompilationMessage getCompilationMessage() {
+ return _msg;
+ }
}
Modified: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationMessage.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationMessage.java?rev=682542&r1=682541&r2=682542&view=diff
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationMessage.java (original)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationMessage.java Mon Aug 4 16:54:02 2008
@@ -20,6 +20,7 @@
import org.apache.ode.utils.msg.CommonMessages;
import org.apache.ode.utils.msg.MessageBundle;
+import org.apache.ode.bpel.compiler.SourceLocation;
/**
* Data structure representing messages emitted from the compiler. These
@@ -27,61 +28,61 @@
* errors and the like).
*/
public class CompilationMessage {
- /** Informational message. */
- public static final short INFO = 0;
- /** Warning message. */
- public static final short WARN = 1;
- /** Error message. */
- public static final short ERROR = 2;
-
- /** Compilation phase. */
- public short phase;
-
- /** The severity severity. */
- public short severity;
-
- /** The message/error code for this message. */
- public String code;
-
- /** Internationalized message text. */
- public String messageText;
-
- /** The location in the source that caused this error/message/warning */
- public SourceLocation source;
-
- /** Common internationalized words. */
- private static final CommonMessages __commonMsgs = MessageBundle.getMessages(CommonMessages.class);
-
- private static final String SEVERITY_LEVELS[] = {
- __commonMsgs.strInfo().toLowerCase() + ": ",
- __commonMsgs.strWarning().toLowerCase() + ": ",
- __commonMsgs.strError().toLowerCase() + ": "
- };
-
- public CompilationMessage setSource(SourceLocation source) {
- this.source = source;
- return this;
- }
-
- /** Convert to a human-readable error string. */
- public String toErrorString() {
- StringBuffer buf = new StringBuffer();
- if (source != null) {
- buf.append(source.getURI());
- buf.append(':');
- buf.append(source.getLineNo());
- buf.append(": ");
+ /** Informational message. */
+ public static final short INFO = 0;
+ /** Warning message. */
+ public static final short WARN = 1;
+ /** Error message. */
+ public static final short ERROR = 2;
+
+ /** Compilation phase. */
+ public short phase;
+
+ /** The severity severity. */
+ public short severity;
+
+ /** The message/error code for this message. */
+ public String code;
+
+ /** Internationalized message text. */
+ public String messageText;
+
+ /** The location in the source that caused this error/message/warning */
+ public SourceLocation source;
+
+ /** Common internationalized words. */
+ private static final CommonMessages __commonMsgs = MessageBundle.getMessages(CommonMessages.class);
+
+ private static final String SEVERITY_LEVELS[] = {
+ __commonMsgs.strInfo().toLowerCase() + ": ",
+ __commonMsgs.strWarning().toLowerCase() + ": ",
+ __commonMsgs.strError().toLowerCase() + ": "
+ };
+
+ public CompilationMessage setSource(SourceLocation source) {
+ this.source = source;
+ return this;
+ }
+
+ /** Convert to a human-readable error string. */
+ public String toErrorString() {
+ StringBuffer buf = new StringBuffer();
+ if (source != null) {
+ buf.append(source.getURI());
+ buf.append(':');
+ buf.append(source.getLineNo());
+ buf.append(": ");
+ }
+ buf.append(SEVERITY_LEVELS[severity]);
+ buf.append('[');
+ buf.append(code);
+ buf.append("] ");
+ buf.append(messageText);
+ return buf.toString();
+ }
+
+ public String toString() {
+ return "CompilationMessage: " + toErrorString();
}
- buf.append(SEVERITY_LEVELS[severity]);
- buf.append('[');
- buf.append(code);
- buf.append("] ");
- buf.append(messageText);
- return buf.toString();
- }
-
- public String toString() {
- return "CompilationMessage: " + toErrorString();
- }
}
Modified: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java?rev=682542&r1=682541&r2=682542&view=diff
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java (original)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java Mon Aug 4 16:54:02 2008
@@ -18,7 +18,7 @@
*/
package org.apache.ode.bpel.compiler.bom;
-import org.apache.ode.bpel.compiler.api.SourceLocation;
+import org.apache.ode.bpel.compiler.SourceLocation;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.NSContext;
import org.apache.ode.utils.stl.CollectionsX;
@@ -41,7 +41,7 @@
* location information (i.e. line numbers) and namespace context (XML namespace
* prefix maps).
*/
-public class BpelObject implements SourceLocation {
+public class BpelObject extends SourceLocation {
public static final QName ATTR_LINENO = new QName("urn:org.apache.ode.bpel.compiler", "lineno");
Modified: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java?rev=682542&r1=682541&r2=682542&view=diff
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java (original)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java Mon Aug 4 16:54:02 2008
@@ -23,18 +23,13 @@
import java.util.Set;
import org.w3c.dom.Element;
+import org.apache.ode.bpel.compiler.BpelCompiler;
/**
* BPEL Object Model (BOM) representation of a BPEL process.
*/
public class Process extends Scope {
- public enum Version {
- BPEL11,
- BPEL20_DRAFT,
- BPEL20
- }
-
public Process(Element el) {
super(el);
}
@@ -51,10 +46,10 @@
/**
* Get the BPEL version of this process.
*/
- public Version getBpelVersion() {
- if (is11()) return Version.BPEL11;
- if (is20Draft()) return Version.BPEL20_DRAFT;
- return Version.BPEL20;
+ public BpelCompiler.Version getBpelVersion() {
+ if (is11()) return BpelCompiler.Version.BPEL11;
+ if (is20Draft()) return BpelCompiler.Version.BPEL20_DRAFT;
+ return BpelCompiler.Version.BPEL20;
}
/**
Added: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ActivityGenerator.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ActivityGenerator.java?rev=682542&view=auto
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ActivityGenerator.java (added)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ActivityGenerator.java Mon Aug 4 16:54:02 2008
@@ -0,0 +1,43 @@
+/*
+ * 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.compiler.v2;
+
+import org.apache.ode.bpel.compiler.v2.CompilerContext;
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.rtrep.v2.OActivity;
+
+
+/**
+ * Interface implemented by classes providing activity-generating logic.
+ * Implementations of this interface are used to convert an
+ * activity description object ({@link org.apache.ode.bom.impl.nodes.ActivityImpl})
+ * into a <em>compiled</em> BPEL representation.
+ */
+public interface ActivityGenerator {
+ public void setContext(CompilerContext context);
+
+ /**
+ * Generate compiled representation for the given activity definition.
+ *
+ * @param src activity definition
+ */
+ public void compile(OActivity output, Activity src);
+
+ public OActivity newInstance(Activity src);
+}
Added: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java?rev=682542&view=auto
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java (added)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java Mon Aug 4 16:54:02 2008
@@ -0,0 +1,296 @@
+/*
+ * 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.compiler.v2;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.v2.ExtensionValidator;
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.compiler.bom.AssignActivity;
+import org.apache.ode.bpel.compiler.bom.Copy;
+import org.apache.ode.bpel.compiler.bom.ExtensionAssignOperation;
+import org.apache.ode.bpel.compiler.bom.ExtensionVal;
+import org.apache.ode.bpel.compiler.bom.From;
+import org.apache.ode.bpel.compiler.bom.LiteralVal;
+import org.apache.ode.bpel.compiler.bom.PartnerLinkVal;
+import org.apache.ode.bpel.compiler.bom.PropertyVal;
+import org.apache.ode.bpel.compiler.bom.To;
+import org.apache.ode.bpel.compiler.bom.VariableVal;
+import org.apache.ode.bpel.compiler.bom.AssignActivity.AssignOperation;
+import org.apache.ode.bpel.rtrep.v2.DebugInfo;
+import org.apache.ode.bpel.rtrep.v2.OActivity;
+import org.apache.ode.bpel.rtrep.v2.OAssign;
+import org.apache.ode.bpel.rtrep.v2.OMessageVarType;
+import org.apache.ode.bpel.rtrep.v2.OAssign.RValue;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.SerializableElement;
+import org.apache.ode.utils.msg.MessageBundle;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Generates code for <code><assign></code> activities.
+ *
+ * @author Maciej Szefler ( m s z e f l e r @ g m a i l . c o m )
+ * @author Tammo van Lessen (University of Stuttgart)
+ */
+class AssignGenerator extends DefaultActivityGenerator {
+ private static final Log __log = LogFactory.getLog(AssignGenerator.class);
+
+ private static final AssignGeneratorMessages __cmsgs =
+ MessageBundle.getMessages(AssignGeneratorMessages.class);
+
+ public OActivity newInstance(Activity src) {
+ return new OAssign(_context.getOProcess(), _context.getCurrent());
+ }
+
+ public void compile(OActivity dest, Activity source) {
+ OAssign oassign = (OAssign) dest;
+ AssignActivity ad = (AssignActivity) source;
+
+ for (AssignOperation operation : ad.getOperations()) {
+ if (operation instanceof Copy) {
+ Copy scopy = (Copy)operation;
+ OAssign.Copy ocopy = new OAssign.Copy(_context.getOProcess());
+ ocopy.keepSrcElementName = scopy.isKeepSrcElement();
+ ocopy.debugInfo = new DebugInfo(_context.getSourceLocation(), scopy.getLineNo(),
+ source.getExtensibilityElements());
+ try {
+ if (scopy.getFrom() == null)
+ throw new CompilationException(__cmsgs.errMissingFromSpec().setSource(scopy));
+ ocopy.from = compileFrom(scopy.getFrom());
+ if (scopy.getTo() == null)
+ throw new CompilationException(__cmsgs.errMissingToSpec().setSource(scopy));
+ ocopy.to = compileTo(scopy.getTo());
+
+ verifyCopy(ocopy);
+ oassign.operations.add(ocopy);
+
+ } catch (CompilationException ce) {
+ _context.recoveredFromError(scopy, ce);
+ }
+ } else if (operation instanceof ExtensionAssignOperation) {
+ ExtensionAssignOperation sop = (ExtensionAssignOperation)operation;
+ OAssign.ExtensionAssignOperation oext = new OAssign.ExtensionAssignOperation(_context.getOProcess());
+ oext.debugInfo = new DebugInfo(_context.getSourceLocation(), sop.getLineNo(), source.getExtensibilityElements());
+ try {
+ if (source.is20Draft()) {
+ throw new CompilationException(__cmsgs.errExtensibleAssignNotSupported());
+ }
+ Element el = sop.getNestedElement();
+ if (el == null) {
+ throw new CompilationException(__cmsgs.errMissingExtensionAssignOperationElement().setSource(sop));
+ }
+ if (!_context.isExtensionDeclared(el.getNamespaceURI())) {
+ throw new CompilationException(__cmsgs.errUndeclaredExtensionAssignOperation().setSource(sop));
+ }
+ ExtensionValidator validator = _context.getExtensionValidator(DOMUtils.getElementQName(el));
+ if (validator != null) {
+ validator.validate(_context, sop);
+ }
+ oext.nestedElement = new SerializableElement(el);
+ oassign.operations.add(oext);
+ } catch (CompilationException ce) {
+ _context.recoveredFromError(sop, ce);
+ }
+ }
+ }
+ }
+
+ /**
+ * Verify that a copy follows the correct form.
+ *
+ * @param ocopy
+ */
+ private void verifyCopy(OAssign.Copy ocopy) {
+ if (__log.isDebugEnabled())
+ __log.debug("verifying copy: " + ocopy);
+
+ // If direct Message->Message copy
+ if (ocopy.to instanceof OAssign.VariableRef && ((OAssign.VariableRef) ocopy.to).isMessageRef()
+ && ocopy.from instanceof OAssign.VariableRef && ((OAssign.VariableRef) ocopy.from).isMessageRef()) {
+ // Check that the LValue/RValue message types match up.
+ String lvar = ((OAssign.VariableRef) ocopy.to).variable.name;
+ String rvar = ((OAssign.VariableRef) ocopy.from).variable.name;
+ QName tlvalue = ((OMessageVarType) ((OAssign.VariableRef) ocopy.to).variable.type).messageType;
+ QName trvalue = ((OMessageVarType) ((OAssign.VariableRef) ocopy.from).variable.type).messageType;
+
+ if (!tlvalue.equals(trvalue))
+ throw new CompilationException(__cmsgs.errMismatchedMessageAssignment(lvar, tlvalue, rvar, trvalue));
+
+ }
+
+ // If Message->Non-Message copy
+ else if (ocopy.from instanceof OAssign.VariableRef && ((OAssign.VariableRef) ocopy.from).isMessageRef()
+ && (!(ocopy.to instanceof OAssign.VariableRef) || !((OAssign.VariableRef) ocopy.to).isMessageRef())) {
+ String rval = ((OAssign.VariableRef) ocopy.from).variable.name;
+ throw new CompilationException(__cmsgs.errCopyFromMessageToNonMessage(rval));
+
+ }
+
+ // If Non-Message->Message copy
+ else if (ocopy.to instanceof OAssign.VariableRef && ((OAssign.VariableRef) ocopy.to).isMessageRef()
+ && (!(ocopy.from instanceof OAssign.VariableRef) || !((OAssign.VariableRef) ocopy.from).isMessageRef())) {
+
+ String lval = ((OAssign.VariableRef) ocopy.to).variable.name;
+ throw new CompilationException(__cmsgs.errCopyToMessageFromNonMessage(lval));
+ }
+
+ // If *->Partner Link copy
+ else if (ocopy.to instanceof OAssign.PartnerLinkRef
+ && !((OAssign.PartnerLinkRef) ocopy.to).partnerLink.hasPartnerRole()) {
+ String lval = ((OAssign.PartnerLinkRef) ocopy.to).partnerLink.getName();
+ throw new CompilationException(__cmsgs.errCopyToUndeclaredPartnerRole(lval));
+ }
+
+ // If Partner Link->* copy
+ else if (ocopy.from instanceof OAssign.PartnerLinkRef) {
+ if (((OAssign.PartnerLinkRef) ocopy.from).isMyEndpointReference
+ && !((OAssign.PartnerLinkRef) ocopy.from).partnerLink.hasMyRole()) {
+ String lval = ((OAssign.PartnerLinkRef) ocopy.from).partnerLink.getName();
+ throw new CompilationException(__cmsgs.errCopyFromUndeclaredPartnerRole(lval, "myRole"));
+ }
+ if (!((OAssign.PartnerLinkRef) ocopy.from).isMyEndpointReference
+ && !((OAssign.PartnerLinkRef) ocopy.from).partnerLink.hasPartnerRole()) {
+ String lval = ((OAssign.PartnerLinkRef) ocopy.from).partnerLink.getName();
+ throw new CompilationException(__cmsgs.errCopyFromUndeclaredPartnerRole(lval, "partnerRole"));
+ }
+ }
+
+ __log.debug("Copy verified OK: " + ocopy);
+ }
+
+ private OAssign.RValue compileFrom(From from) {
+ assert from != null;
+ try {
+ if (from.isExtensionVal()) {
+ return compileExtensionVal(from.getAsExtensionVal());
+ } else if (from.isLiteralVal()) {
+ return compileLiteral(from.getAsLiteralVal());
+ } else if (from.isPropertyVal()) {
+ OAssign.PropertyRef pref = new OAssign.PropertyRef(_context.getOProcess());
+ PropertyVal pval = from.getAsPropertyVal();
+ pref.variable = _context.resolveVariable(pval.getVariable());
+ pref.propertyAlias = _context.resolvePropertyAlias(pref.variable, pval.getProperty());
+ return pref;
+ } else if (from.isVariableVal()) {
+ VariableVal vv = from.getAsVariableVal();
+ OAssign.VariableRef vref = new OAssign.VariableRef(_context.getOProcess());
+ vref.variable = _context.resolveVariable(vv.getVariable());
+ if (vv.getPart() != null) {
+ vref.part = _context.resolvePart(vref.variable, vv.getPart());
+ if (vv.getLocation() != null && vv.getLocation().getExpression() != null)
+ vref.location = _context.compileExpr(vv.getLocation());
+ }
+ if (vv.getHeader() != null) {
+ vref.headerPart = _context.resolveHeaderPart(vref.variable, vv.getHeader());
+ if (vref.headerPart == null)
+ vref.headerPart = new OMessageVarType.Part(_context.getOProcess(), vv.getHeader(), null);
+ if (vv.getLocation() != null && vv.getLocation().getExpression() != null)
+ vref.location = _context.compileExpr(vv.getLocation());
+ }
+ return vref;
+ } else if (from.isPartnerLinkVal()) {
+ PartnerLinkVal plv = from.getAsPartnerLinkVal();
+ OAssign.PartnerLinkRef plref = new OAssign.PartnerLinkRef(_context.getOProcess());
+ plref.partnerLink = _context.resolvePartnerLink(plv.getPartnerLink());
+ plref.isMyEndpointReference = (plv.getEndpointReference() == PartnerLinkVal.EndpointReference.MYROLE);
+ return plref;
+ } else if (from.getAsExpression() != null) {
+ return new OAssign.Expression(_context.getOProcess(), _context.compileExpr(from.getAsExpression()));
+ }
+
+ throw new CompilationException(__cmsgs.errUnkownFromSpec().setSource(from));
+
+ } catch (CompilationException ce) {
+ if (ce.getCompilationMessage().source == null)
+ ce.getCompilationMessage().source = from;
+ throw ce;
+ }
+ }
+
+ /**
+ * Compile an extension to/from-spec. Extension to/from-specs are compiled into
+ * "DirectRef"s.
+ *
+ * @param extVal source representation
+ * @return compiled representation
+ */
+ private RValue compileExtensionVal(ExtensionVal extVal) {
+ OAssign.DirectRef dref = new OAssign.DirectRef(_context.getOProcess());
+ dref.variable = _context.resolveVariable(extVal.getVariable());
+ dref.elName = extVal.getExtension();
+ return dref;
+ }
+
+ private OAssign.RValue compileLiteral(LiteralVal from) {
+ Element literal = from.getLiteral();
+ Document newDoc = DOMUtils.newDocument();
+ Element clone = (Element) newDoc.importNode(literal, true);
+ newDoc.appendChild(clone);
+ return new OAssign.Literal(_context.getOProcess(), newDoc);
+ }
+
+ private OAssign.LValue compileTo(To to) {
+ assert to != null;
+
+ try {
+ if (to.isPropertyVal()) {
+ OAssign.PropertyRef pref = new OAssign.PropertyRef(_context.getOProcess());
+ pref.variable = _context.resolveVariable(to.getAsPropertyVal().getVariable());
+ pref.propertyAlias = _context.resolvePropertyAlias(pref.variable, to.getAsPropertyVal().getProperty());
+ return pref;
+ } else if (to.isVariableVal()) {
+ VariableVal vv = to.getAsVariableVal();
+ OAssign.VariableRef vref = new OAssign.VariableRef(_context.getOProcess());
+ vref.variable = _context.resolveVariable(vv.getVariable());
+ if (to.getAsVariableVal().getPart() != null) {
+ vref.part = _context.resolvePart(vref.variable, vv.getPart());
+ if (vv.getLocation() != null && vv.getLocation().getExpression() != null)
+ vref.location = _context.compileExpr(vv.getLocation());
+ }
+ if (to.getAsVariableVal().getHeader() != null) {
+ vref.headerPart = _context.resolveHeaderPart(vref.variable, vv.getHeader());
+ if (vref.headerPart == null)
+ vref.headerPart = new OMessageVarType.Part(_context.getOProcess(), to.getAsVariableVal().getHeader(), null);
+ if (vv.getLocation() != null && vv.getLocation().getExpression() != null)
+ vref.location = _context.compileExpr(vv.getLocation());
+ }
+ return vref;
+ } else if (to.isPartnerLinkVal()) {
+ OAssign.PartnerLinkRef plref = new OAssign.PartnerLinkRef(_context.getOProcess());
+ plref.partnerLink = _context.resolvePartnerLink(to.getAsPartnerLinkVal().getPartnerLink());
+ return plref;
+ } else if (to.getAsExpression() != null){
+ return new OAssign.LValueExpression(_context.getOProcess(), _context
+ .compileLValueExpr(to.getAsExpression()));
+ }
+
+ throw new CompilationException(__cmsgs.errUnknownToSpec().setSource(to));
+ } catch (CompilationException ce) {
+ if (ce.getCompilationMessage().source == null)
+ ce.getCompilationMessage().source = to;
+ throw ce;
+ }
+ }
+
+}
Added: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGeneratorMessages.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGeneratorMessages.java?rev=682542&view=auto
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGeneratorMessages.java (added)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGeneratorMessages.java Mon Aug 4 16:54:02 2008
@@ -0,0 +1,104 @@
+/*
+ * 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.compiler.v2;
+
+import org.apache.ode.bpel.compiler.api.CompilationMessage;
+import org.apache.ode.bpel.compiler.api.CompilationMessageBundle;
+
+import javax.xml.namespace.QName;
+
+public class AssignGeneratorMessages extends CompilationMessageBundle {
+
+ /** Copy missing from-spec. */
+ public CompilationMessage errMissingFromSpec() {
+ return this.formatCompilationMessage("Copy missing from-spec.");
+ }
+
+ /** Copy to message variable {0} requires a message for the r-value. */
+ public CompilationMessage errCopyToMessageFromNonMessage(String lval) {
+ return this.formatCompilationMessage(
+ "Copy to message variable {0} requires a message for the r-value.", lval);
+ }
+
+ /** Copy from message variable {0} requires a message for the l-value. */
+ public CompilationMessage errCopyFromMessageToNonMessage(String rval) {
+ return this.formatCompilationMessage(
+ "Copy from message variable {0} requires a message for the l-value.", rval);
+ }
+
+ /**
+ * Copy to message variable {0} of type {1} from message {2} of type {3} is
+ * not permitted (the message types do not match).
+ */
+ public CompilationMessage errMismatchedMessageAssignment(String lvar, QName tlvalue,
+ String rval, QName trvalue) {
+ return this.formatCompilationMessage(
+ "Copy to message variable {0} of type {1} from message {2}" +
+ " of type {3} is not permitted (the message types do not match).", lvar,
+ tlvalue, rval, trvalue);
+ }
+
+ /** Copy to partner link {0} requires the partnerRole to be defined on partner link. */
+ public CompilationMessage errCopyToUndeclaredPartnerRole(String lval) {
+ return this.formatCompilationMessage(
+ "Copy to partner link {0} requires the partnerRole to be defined on partner link.", lval);
+ }
+
+ /**
+ * Copy from partner link {0} with enpoint reference {1} requires
+ * the corresponding role to be defined on partner link.
+ */
+ public CompilationMessage errCopyFromUndeclaredPartnerRole(String rval, String epr) {
+ return this.formatCompilationMessage(
+ "Copy from partner link {0} with enpoint reference {1} requires" +
+ " the corresponding role to be defined on partner link.", rval, epr);
+ }
+
+ /** Copy missing to-spec. */
+ public CompilationMessage errMissingToSpec() {
+ return this.formatCompilationMessage("Copy missing to-spec.");
+ }
+
+ /** From-spec format is unrecognized. */
+ public CompilationMessage errUnkownFromSpec() {
+ return this.formatCompilationMessage("From-spec format is unrecognized.");
+ }
+
+ /** To-spec format is unrecognized. */
+ public CompilationMessage errUnknownToSpec() {
+ return this.formatCompilationMessage("To-spec format is unrecognized.");
+ }
+
+ /**ExtensionAssignOperation's nested element missing*/
+ public CompilationMessage errMissingExtensionAssignOperationElement(){
+ return this.formatCompilationMessage("Extensibility element in <extensionAssignOperation> is missing.");
+ }
+
+ /**ExtensionAssignOperation's nested element missing*/
+ public CompilationMessage errUndeclaredExtensionAssignOperation(){
+ return this.formatCompilationMessage("Extension namespace of <extensionAssignOperation> has not been declared.");
+ }
+
+ /**Draft extensibleAssign is not supported.*/
+ public CompilationMessage errExtensibleAssignNotSupported(){
+ return this.formatCompilationMessage("ExtensibleAssign is not supported, please upgrade to BPEL 2.0 final.");
+ }
+
+}
Added: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BaseCompiler.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BaseCompiler.java?rev=682542&view=auto
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BaseCompiler.java (added)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BaseCompiler.java Mon Aug 4 16:54:02 2008
@@ -0,0 +1,37 @@
+package org.apache.ode.bpel.compiler.v2;
+
+import org.apache.ode.bpel.rtrep.v2.OProcess;
+import org.apache.ode.bpel.rtrep.v2.OConstants;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author Matthieu Riou <mr...@apache.org>
+ */
+public abstract class BaseCompiler {
+
+ protected OProcess _oprocess;
+
+ protected OConstants makeConstants() {
+ OConstants constants = new OConstants(_oprocess);
+ constants.qnConflictingReceive = new QName(getBpwsNamespace(), "conflictingReceive");
+ constants.qnCorrelationViolation = new QName(getBpwsNamespace(), "correlationViolation");
+ constants.qnForcedTermination = new QName(getBpwsNamespace(), "forcedTermination");
+ constants.qnJoinFailure = new QName(getBpwsNamespace(), "joinFailure");
+ constants.qnMismatchedAssignmentFailure = new QName(getBpwsNamespace(), "mismatchedAssignment");
+ constants.qnMissingReply = new QName(getBpwsNamespace(), "missingReply");
+ constants.qnMissingRequest = new QName(getBpwsNamespace(), "missingRequest");
+ constants.qnSelectionFailure = new QName(getBpwsNamespace(), "selectionFailure");
+ constants.qnUninitializedVariable = new QName(getBpwsNamespace(), "uninitializedVariable");
+ constants.qnXsltInvalidSource = new QName(getBpwsNamespace(), "xsltInvalidSource");
+ constants.qnSubLanguageExecutionFault = new QName(getBpwsNamespace(), "subLanguageExecutionFault");
+ constants.qnUninitializedPartnerRole = new QName(getBpwsNamespace(), "uninitializedPartnerRole");
+ constants.qnForEachCounterError = new QName(getBpwsNamespace(), "forEachCounterError");
+ constants.qnInvalidBranchCondition = new QName(getBpwsNamespace(), "invalidBranchCondition");
+ constants.qnInvalidExpressionValue = new QName(getBpwsNamespace(), "invalidExpressionValue");
+ return constants;
+ }
+
+ protected abstract String getBpwsNamespace();
+
+}
Added: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler11.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler11.java?rev=682542&view=auto
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler11.java (added)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler11.java Mon Aug 4 16:54:02 2008
@@ -0,0 +1,77 @@
+/*
+ * 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.compiler.v2;
+
+import org.apache.ode.bpel.compiler.bom.AssignActivity;
+import org.apache.ode.bpel.compiler.bom.Bpel11QNames;
+import org.apache.ode.bpel.compiler.bom.CompensateScopeActivity;
+import org.apache.ode.bpel.compiler.bom.EmptyActivity;
+import org.apache.ode.bpel.compiler.bom.FlowActivity;
+import org.apache.ode.bpel.compiler.bom.InvokeActivity;
+import org.apache.ode.bpel.compiler.bom.PickActivity;
+import org.apache.ode.bpel.compiler.bom.ReceiveActivity;
+import org.apache.ode.bpel.compiler.bom.ReplyActivity;
+import org.apache.ode.bpel.compiler.bom.SequenceActivity;
+import org.apache.ode.bpel.compiler.bom.SwitchActivity;
+import org.apache.ode.bpel.compiler.bom.TerminateActivity;
+import org.apache.ode.bpel.compiler.bom.ThrowActivity;
+import org.apache.ode.bpel.compiler.bom.WaitActivity;
+import org.apache.ode.bpel.compiler.bom.WhileActivity;
+import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
+import org.apache.ode.bpel.compiler.wsdl.WSDLFactoryBPEL11;
+
+/**
+ * BPEL v1.1 compiler.
+ */
+public class BpelCompiler11 extends BpelCompilerImpl {
+
+ /** URI for the XPath 1.0 expression language. */
+ public static final String EXPLANG_XPATH = "http://www.w3.org/TR/1999/REC-xpath-19991116";
+
+ public BpelCompiler11() {
+ super((WSDLFactory4BPEL) WSDLFactoryBPEL11.newInstance());
+
+ registerActivityCompiler(EmptyActivity.class, new EmptyGenerator());
+ registerActivityCompiler(CompensateScopeActivity.class, new CompensateGenerator());
+ registerActivityCompiler(FlowActivity.class, new FlowGenerator());
+ registerActivityCompiler(SequenceActivity.class, new SequenceGenerator());
+ registerActivityCompiler(AssignActivity.class, new AssignGenerator());
+ registerActivityCompiler(ThrowActivity.class, new ThrowGenerator());
+ registerActivityCompiler(WhileActivity.class, new WhileGenerator());
+ registerActivityCompiler(SwitchActivity.class, new SwitchGenerator());
+ registerActivityCompiler(PickActivity.class, new PickGenerator());
+ registerActivityCompiler(ReplyActivity.class, new ReplyGenerator());
+ registerActivityCompiler(ReceiveActivity.class, new ReceiveGenerator());
+ registerActivityCompiler(InvokeActivity.class, new InvokeGenerator());
+ registerActivityCompiler(WaitActivity.class, new WaitGenerator());
+ registerActivityCompiler(TerminateActivity.class, new TerminateGenerator());
+
+ registerExpressionLanguage(EXPLANG_XPATH, "org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL11");
+ }
+
+
+ protected String getBpwsNamespace() {
+ return Bpel11QNames.NS_BPEL4WS_2003_03;
+ }
+
+ protected String getDefaultExpressionLanguage() {
+ return EXPLANG_XPATH;
+ }
+
+}
Added: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20.java?rev=682542&view=auto
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20.java (added)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20.java Mon Aug 4 16:54:02 2008
@@ -0,0 +1,94 @@
+/*
+ * 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.compiler.v2;
+
+import org.apache.ode.bpel.compiler.bom.AssignActivity;
+import org.apache.ode.bpel.compiler.bom.Bpel20QNames;
+import org.apache.ode.bpel.compiler.bom.CompensateActivity;
+import org.apache.ode.bpel.compiler.bom.CompensateScopeActivity;
+import org.apache.ode.bpel.compiler.bom.EmptyActivity;
+import org.apache.ode.bpel.compiler.bom.ExtensionActivity;
+import org.apache.ode.bpel.compiler.bom.FlowActivity;
+import org.apache.ode.bpel.compiler.bom.ForEachActivity;
+import org.apache.ode.bpel.compiler.bom.IfActivity;
+import org.apache.ode.bpel.compiler.bom.InvokeActivity;
+import org.apache.ode.bpel.compiler.bom.PickActivity;
+import org.apache.ode.bpel.compiler.bom.ReceiveActivity;
+import org.apache.ode.bpel.compiler.bom.RepeatUntilActivity;
+import org.apache.ode.bpel.compiler.bom.ReplyActivity;
+import org.apache.ode.bpel.compiler.bom.RethrowActivity;
+import org.apache.ode.bpel.compiler.bom.SequenceActivity;
+import org.apache.ode.bpel.compiler.bom.TerminateActivity;
+import org.apache.ode.bpel.compiler.bom.ThrowActivity;
+import org.apache.ode.bpel.compiler.bom.WaitActivity;
+import org.apache.ode.bpel.compiler.bom.WhileActivity;
+import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
+import org.apache.ode.bpel.compiler.wsdl.WSDLFactoryBPEL20;
+import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL20;
+
+/**
+ * OASIS BPEL V2.0 Compiler
+ */
+public class BpelCompiler20 extends BpelCompilerImpl {
+
+ public static final String OASIS_EXPLANG_XPATH_1_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0";
+ public static final String OASIS_EXPLANG_XPATH_2_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0";
+
+ public BpelCompiler20() {
+ super((WSDLFactory4BPEL) WSDLFactoryBPEL20.newInstance());
+
+ registerActivityCompiler(EmptyActivity.class, new EmptyGenerator());
+ registerActivityCompiler(CompensateScopeActivity.class, new CompensateScopeGenerator());
+ registerActivityCompiler(CompensateActivity.class, new CompensateGenerator());
+ registerActivityCompiler(FlowActivity.class, new FlowGenerator());
+ registerActivityCompiler(SequenceActivity.class, new SequenceGenerator());
+ registerActivityCompiler(AssignActivity.class, new AssignGenerator());
+ registerActivityCompiler(ThrowActivity.class, new ThrowGenerator());
+ registerActivityCompiler(WhileActivity.class, new WhileGenerator());
+ registerActivityCompiler(RepeatUntilActivity.class, new RepeatUntilGenerator());
+ registerActivityCompiler(IfActivity.class, new IfGenerator());
+ registerActivityCompiler(PickActivity.class, new PickGenerator());
+ registerActivityCompiler(ReplyActivity.class, new ReplyGenerator());
+ registerActivityCompiler(ReceiveActivity.class, new ReceiveGenerator());
+ registerActivityCompiler(InvokeActivity.class, new InvokeGenerator());
+ registerActivityCompiler(WaitActivity.class, new WaitGenerator());
+ registerActivityCompiler(TerminateActivity.class, new TerminateGenerator());
+ registerActivityCompiler(RethrowActivity.class, new RethrowGenerator());
+ registerActivityCompiler(ForEachActivity.class, new ForEachGenerator());
+ registerActivityCompiler(ExtensionActivity.class, new ExtensionActivtityGenerator());
+
+ registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20());
+
+ try {
+ registerExpressionLanguage(OASIS_EXPLANG_XPATH_2_0,
+ "org.apache.ode.bpel.elang.xpath20.compiler.XPath20ExpressionCompilerBPEL20");
+ } catch (Exception e) {
+ __log.error("Error loading XPath 2.0 Expression Language: it will not be available.");
+ }
+
+ }
+
+ protected String getBpwsNamespace() {
+ return Bpel20QNames.NS_WSBPEL2_0_FINAL_EXEC;
+ }
+
+ protected String getDefaultExpressionLanguage() {
+ return OASIS_EXPLANG_XPATH_1_0;
+ }
+}
Added: ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20Draft.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20Draft.java?rev=682542&view=auto
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20Draft.java (added)
+++ ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompiler20Draft.java Mon Aug 4 16:54:02 2008
@@ -0,0 +1,92 @@
+/*
+ * 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.compiler.v2;
+
+import org.apache.ode.bpel.compiler.bom.AssignActivity;
+import org.apache.ode.bpel.compiler.bom.Bpel20QNames;
+import org.apache.ode.bpel.compiler.bom.CompensateScopeActivity;
+import org.apache.ode.bpel.compiler.bom.EmptyActivity;
+import org.apache.ode.bpel.compiler.bom.ExtensionActivity;
+import org.apache.ode.bpel.compiler.bom.FlowActivity;
+import org.apache.ode.bpel.compiler.bom.ForEachActivity;
+import org.apache.ode.bpel.compiler.bom.IfActivity;
+import org.apache.ode.bpel.compiler.bom.InvokeActivity;
+import org.apache.ode.bpel.compiler.bom.PickActivity;
+import org.apache.ode.bpel.compiler.bom.ReceiveActivity;
+import org.apache.ode.bpel.compiler.bom.RepeatUntilActivity;
+import org.apache.ode.bpel.compiler.bom.ReplyActivity;
+import org.apache.ode.bpel.compiler.bom.RethrowActivity;
+import org.apache.ode.bpel.compiler.bom.SequenceActivity;
+import org.apache.ode.bpel.compiler.bom.TerminateActivity;
+import org.apache.ode.bpel.compiler.bom.ThrowActivity;
+import org.apache.ode.bpel.compiler.bom.WaitActivity;
+import org.apache.ode.bpel.compiler.bom.WhileActivity;
+import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
+import org.apache.ode.bpel.compiler.wsdl.WSDLFactoryBPEL20Draft;
+import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL20Draft;
+
+/**
+ * @author Matthieu Riou <mriou at apache dot org>
+ */
+public class BpelCompiler20Draft extends BpelCompilerImpl {
+
+ public static final String OASIS_EXPLANG_XPATH_1_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0";
+ public static final String OASIS_EXPLANG_XPATH_2_0 = "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0";
+
+ public BpelCompiler20Draft() {
+ super((WSDLFactory4BPEL) WSDLFactoryBPEL20Draft.newInstance());
+
+ registerActivityCompiler(EmptyActivity.class, new EmptyGenerator());
+ registerActivityCompiler(CompensateScopeActivity.class, new CompensateGenerator());
+ registerActivityCompiler(FlowActivity.class, new FlowGenerator());
+ registerActivityCompiler(SequenceActivity.class, new SequenceGenerator());
+ registerActivityCompiler(AssignActivity.class, new AssignGenerator());
+ registerActivityCompiler(ThrowActivity.class, new ThrowGenerator());
+ registerActivityCompiler(WhileActivity.class, new WhileGenerator());
+ registerActivityCompiler(RepeatUntilActivity.class, new RepeatUntilGenerator());
+ registerActivityCompiler(IfActivity.class, new IfGenerator());
+ registerActivityCompiler(PickActivity.class, new PickGenerator());
+ registerActivityCompiler(ReplyActivity.class, new ReplyGenerator());
+ registerActivityCompiler(ReceiveActivity.class, new ReceiveGenerator());
+ registerActivityCompiler(InvokeActivity.class, new InvokeGenerator());
+ registerActivityCompiler(WaitActivity.class, new WaitGenerator());
+ registerActivityCompiler(TerminateActivity.class, new TerminateGenerator());
+ registerActivityCompiler(RethrowActivity.class, new RethrowGenerator());
+ registerActivityCompiler(ForEachActivity.class, new ForEachGenerator());
+ registerActivityCompiler(ExtensionActivity.class, new ExtensionActivtityGenerator());
+
+ registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20Draft());
+ try {
+ registerExpressionLanguage(OASIS_EXPLANG_XPATH_2_0,
+ "org.apache.ode.bpel.elang.xpath20.compiler.XPath20ExpressionCompilerBPEL20Draft");
+ } catch (Exception e) {
+ __log.error("Error loading XPath 2.0 Expression Language: it will not be available.");
+ }
+ }
+
+ protected String getBpwsNamespace() {
+ return Bpel20QNames.NS_WSBPEL2_0;
+ }
+
+ protected String getDefaultExpressionLanguage() {
+ return OASIS_EXPLANG_XPATH_1_0;
+ }
+
+}