Author: mriou
Date: Fri Jun 13 09:08:20 2008
New Revision: 667580
URL: http://svn.apache.org/viewvc?rev=667580&view=rev
Log:
Back to a working state (strange how things you don't touch seem to break by
themselves). Fixed the tests that were supposed to work as well as those that
weren't.
Modified:
ode/sandbox/simpel/Rakefile
ode/sandbox/simpel/lib/e4x-grammar-0.1.jar
ode/sandbox/simpel/src/main/antlr/org/apache/ode/simpel/antlr/SimPELWalker.g
ode/sandbox/simpel/src/main/java/org/apache/ode/embed/EmbeddedStore.java
ode/sandbox/simpel/src/main/java/org/apache/ode/simpel/SimPELCompiler.java
ode/sandbox/simpel/src/main/java/org/apache/ode/simpel/omodel/OBuilder.java
ode/sandbox/simpel/src/test/java/org/apache/ode/simpel/SimPELRuntimeTest.java
Modified: ode/sandbox/simpel/Rakefile
URL:
http://svn.apache.org/viewvc/ode/sandbox/simpel/Rakefile?rev=667580&r1=667579&r2=667580&view=diff
==============================================================================
--- ode/sandbox/simpel/Rakefile (original)
+++ ode/sandbox/simpel/Rakefile Fri Jun 13 09:08:20 2008
@@ -15,7 +15,7 @@
# limitations under the License.
#
-gem "buildr", "~>1.2.4"
+gem "buildr", "~>1.3"
require "buildr"
require "buildr/antlr"
@@ -38,20 +38,15 @@
:transaction
=>"org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1",
:resource
=>"org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.0"
)
-LOG4J = "log4j:log4j:jar:1.2.15"
-ODE = ["org.apache.ode:ode-bpel-api:jar:1.2-SNAPSHOT",
- "org.apache.ode:ode-bpel-compiler:jar:1.2-SNAPSHOT",
- "org.apache.ode:ode-bpel-dao:jar:1.2-SNAPSHOT",
- "org.apache.ode:ode-bpel-obj:jar:1.2-SNAPSHOT",
- "org.apache.ode:ode-bpel-runtime:jar:1.2-SNAPSHOT",
- "org.apache.ode:ode-il-common:jar:1.2-SNAPSHOT",
- "org.apache.ode:ode-jacob:jar:1.2-SNAPSHOT",
- "org.apache.ode:ode-scheduler-simple:jar:1.2-SNAPSHOT",
- "org.apache.ode:ode-utils:jar:1.2-SNAPSHOT"]
-WSDL4J = "wsdl4j:wsdl4j:jar:1.6.2"
+LOG4J = "log4j:log4j:jar:1.2.15"
+ODE = group("ode-bpel-api", "ode-bpel-compiler",
"ode-bpel-dao", "ode-bpel-obj",
+ "ode-bpel-runtime", "ode-il-common", "ode-jacob",
"ode-scheduler-simple",
+ "ode-utils", :under=>"org.apache.ode",
:version=>"1.3-SNAPSHOT")
+WSDL4J = "wsdl4j:wsdl4j:jar:1.6.2"
XERCES = "xerces:xercesImpl:jar:2.9.0"
repositories.remote << "http://repo1.maven.org/maven2"
+repositories.remote << "http://people.apache.org/~mriou/ode-1.2RC1/"
desc "ODE SimPEL process execution language."
define "simpel" do
@@ -64,11 +59,13 @@
meta_inf << file("NOTICE")
pkg_name = "org.apache.ode.simpel.antlr"
- antlr_task = antlr(_("src/main/antlr"), {:in_package=>pkg_name,
:token=>pkg_name})
+ antlr_task =
antlr([_("src/main/antlr/org/apache/ode/simpel/antlr/SimPEL.g"),
+
_("src/main/antlr/org/apache/ode/simpel/antlr/SimPELWalker.g")],
+ {:in_package=>pkg_name, :token=>pkg_name})
# Because of a pending ANTLR bug, we need to insert some additional
# code in generated classes.
- task('tweak_antlr' => antlr_task) do
+ task('tweak_antlr' => [antlr_task]) do
walker =
_("target/generated/antlr/org/apache/ode/simpel/antlr/SimPELWalker.java")
walker_txt = File.read(walker)
@@ -87,6 +84,6 @@
compile.enhance([task('tweak_antlr')])
compile.with HSQLDB, JAVAX.resource, JAVAX.transaction, COMMONS.lang,
COMMONS.logging, ODE, LOG4J,
WSDL4J, GERONIMO.transaction, XERCES,
- file(_("lib/e4x-grammar-0.1.jar")), file(_("lib/antlr-20080215.jar")),
file(_("lib/rhino-1.7R1.jar"))
+ file(_("lib/e4x-grammar-0.1.jar")), ANTLR, file(_("lib/rhino-1.7R1.jar"))
package :jar
end
Modified: ode/sandbox/simpel/lib/e4x-grammar-0.1.jar
URL:
http://svn.apache.org/viewvc/ode/sandbox/simpel/lib/e4x-grammar-0.1.jar?rev=667580&r1=667579&r2=667580&view=diff
==============================================================================
Binary files - no diff available.
Modified:
ode/sandbox/simpel/src/main/antlr/org/apache/ode/simpel/antlr/SimPELWalker.g
URL:
http://svn.apache.org/viewvc/ode/sandbox/simpel/src/main/antlr/org/apache/ode/simpel/antlr/SimPELWalker.g?rev=667580&r1=667579&r2=667580&view=diff
==============================================================================
---
ode/sandbox/simpel/src/main/antlr/org/apache/ode/simpel/antlr/SimPELWalker.g
(original)
+++
ode/sandbox/simpel/src/main/antlr/org/apache/ode/simpel/antlr/SimPELWalker.g
Fri Jun 13 09:08:20 2008
@@ -127,12 +127,23 @@
join : ^(JOIN ID* expr?);
if_ex
- : ^(IF expr body (^(ELSE body))?);
+scope ExprContext;
+ : ^(IF {
+ $ExprContext::expr = new SimPELExpr(builder.getProcess());
+ }
+ e=expr body (^(ELSE body))?) {
+ // TODO compile if
+ };
while_ex
- : ^(WHILE expr body);
+scope ExprContext;
+ : ^(WHILE {
+ $ExprContext::expr = new SimPELExpr(builder.getProcess());
+ }
+ expr body);
until_ex
+scope ExprContext;
: ^(UNTIL expr body);
foreach
@@ -142,7 +153,11 @@
try_ex
scope BPELScope;
- : ^(TRY body catch_ex*);
+ : ^(TRY {
+ OBuilder.StructuredActivity<OScope> oscope = builder.build(OScope.class,
null, $Parent::activity);
+ $BPELScope::oscope = oscope.getOActivity();
+ }
+ body catch_ex*);
catch_ex: ^(CATCH ^(NS ID ID?) param_block);
scope_ex
@@ -157,40 +172,48 @@
: ^(COMPENSATION body);
with_ex
- : ^(WITH with_map* body);
+scope ExprContext;
+ : ^(WITH {
+ $ExprContext::expr = new SimPELExpr(builder.getProcess());
+ }
+ with_map* body);
with_map: ^(MAP ID path_expr);
// Simple activities
invoke : ^(INVOKE p=ID o=ID in=ID?);
-reply : ^(REPLY msg=ID (pl=ID var=ID)?)
- { builder.build(OReply.class, $BPELScope::oscope,
$Parent::activity,
- $ReceiveBlock::receive, text($msg), text($pl),
text($var)); };
+reply
+ : ^(REPLY msg=ID (pl=ID var=ID)?) {
+ if (ReceiveBlock_stack.size() > 0)
+ builder.build(OReply.class, $BPELScope::oscope, $Parent::activity,
+ $ReceiveBlock::receive, text($msg), text($pl),
text($var));
+ else
+ builder.build(OReply.class, $BPELScope::oscope, $Parent::activity,
+ null, text($msg), text($pl), text($var));
+ };
receive
scope ReceiveBlock;
- : ^(RECEIVE ^(p=ID o=ID correlation?))
- {
- OBuilder.StructuredActivity<OPickReceive> rec =
builder.build(OPickReceive.class, $BPELScope::oscope,
- $Parent::activity, text($p), text($o));
- $ReceiveBlock::receive = rec.getOActivity();
+ : ^(RECEIVE ^(p=ID o=ID correlation?)) {
+ OBuilder.StructuredActivity<OPickReceive> rec =
builder.build(OPickReceive.class, $BPELScope::oscope,
+ $Parent::activity, text($p), text($o));
+ $ReceiveBlock::receive = rec.getOActivity();
}
(prb=(param_block))?;
-
assign
scope ExprContext;
- : ^(ASSIGN
- {
- $ExprContext::expr = new SimPELExpr(builder.getProcess());
- }
- lv=(path_expr) rv=(rvalue))
- {
- $ExprContext::expr.setExpr(deepText($rv));
- OBuilder.StructuredActivity<OAssign> assign =
builder.build(OAssign.class, $BPELScope::oscope, $Parent::activity,
deepText($lv), $ExprContext::expr);
- // The long, winding road of abstraction
- $ExprContext::expr = (SimPELExpr)
((OAssign.Expression)((OAssign.Copy)assign.getOActivity().operations.get(0)).from).expression;
- };
+ : ^(ASSIGN {
+ $ExprContext::expr = new SimPELExpr(builder.getProcess());
+ }
+ lv=(path_expr) rv=(rvalue)) {
+ $ExprContext::expr.setExpr(deepText($rv));
+ OBuilder.StructuredActivity<OAssign> assign =
+ builder.build(OAssign.class, $BPELScope::oscope,
$Parent::activity, deepText($lv), $ExprContext::expr);
+ // The long, winding road of abstraction
+ $ExprContext::expr = (SimPELExpr)
((OAssign.Expression)((OAssign.Copy)assign.
+ getOActivity().operations.get(0)).from).expression;
+ };
rvalue : receive | invoke | expr | xmlElement;
throw_ex: ^(THROW ns_id);
@@ -204,8 +227,13 @@
partner_link
: ^(PARTNERLINK ID*);
+
correlation
- : ^(CORRELATION corr_mapping*);
+scope ExprContext;
+ : ^(CORRELATION {
+ $ExprContext::expr = new SimPELExpr(builder.getProcess());
+ }
+ corr_mapping*);
corr_mapping
: ^(CORR_MAP ID expr);
@@ -227,7 +255,9 @@
funct_call
: ^(CALL ID*);
path_expr
- : ^(PATH ids=(ns_id*)) {
builder.addExprVariable($BPELScope::oscope, $ExprContext::expr,
deepText($ids)); };
+ : ^(PATH ids=(ns_id*)) {
+ builder.addExprVariable($BPELScope::oscope, $ExprContext::expr,
deepText($ids));
+ };
ns_id : ^(NS ID? ID);
s_expr : ^('==' s_expr s_expr)
Modified:
ode/sandbox/simpel/src/main/java/org/apache/ode/embed/EmbeddedStore.java
URL:
http://svn.apache.org/viewvc/ode/sandbox/simpel/src/main/java/org/apache/ode/embed/EmbeddedStore.java?rev=667580&r1=667579&r2=667580&view=diff
==============================================================================
--- ode/sandbox/simpel/src/main/java/org/apache/ode/embed/EmbeddedStore.java
(original)
+++ ode/sandbox/simpel/src/main/java/org/apache/ode/embed/EmbeddedStore.java
Fri Jun 13 09:08:20 2008
@@ -26,6 +26,7 @@
import org.apache.ode.bpel.o.OPartnerLink;
import org.apache.ode.simpel.SimPELCompiler;
import org.w3c.dom.Node;
+import org.w3c.dom.Element;
import javax.wsdl.Definition;
import javax.xml.namespace.QName;
@@ -172,10 +173,6 @@
throw new UnsupportedOperationException();
}
- public Map<QName, Node> getProperties() {
- throw new UnsupportedOperationException();
- }
-
public String getPackage() {
throw new UnsupportedOperationException();
}
@@ -205,5 +202,17 @@
}
return res;
}
+
+ public Map<QName, Node> getProcessProperties() {
+ throw new UnsupportedOperationException();
+ }
+
+ public List<Element> getExtensionElement(QName qName) {
+ return new ArrayList<Element>();
+ }
+
+ public Map<String, String> getEndpointProperties(EndpointReference
endpointReference) {
+ throw new UnsupportedOperationException();
+ }
}
}
Modified:
ode/sandbox/simpel/src/main/java/org/apache/ode/simpel/SimPELCompiler.java
URL:
http://svn.apache.org/viewvc/ode/sandbox/simpel/src/main/java/org/apache/ode/simpel/SimPELCompiler.java?rev=667580&r1=667579&r2=667580&view=diff
==============================================================================
--- ode/sandbox/simpel/src/main/java/org/apache/ode/simpel/SimPELCompiler.java
(original)
+++ ode/sandbox/simpel/src/main/java/org/apache/ode/simpel/SimPELCompiler.java
Fri Jun 13 09:08:20 2008
@@ -56,9 +56,9 @@
throw new CompilationException(e);
}
// pull out the tree and cast it
- Tree t = (Tree)result.getTree();
+ LinkedListTree t = (LinkedListTree)result.getTree();
StringBuffer b = new StringBuffer();
- toText((LinkedListTree) t, b);
+ toText(t, b);
System.out.println(b.toString());
if (t != null) {
@@ -70,7 +70,7 @@
SimPELWalker walker = new SimPELWalker(nodes);
walker.setErrorListener(errListener);
HashMap<Integer, Integer> tokenMapping =
buildTokenMap(E4XParser.tokenNames, E4XLexer.class, SimPELWalker.class);
- rewriteTokens(tokenMapping, E4XParser.tokenNames, (LinkedListTree)
t, walker, false);
+ rewriteTokens(tokenMapping, E4XParser.tokenNames, t, walker,
false);
nodes.setTokenStream(tokenStream);
try {
@@ -89,7 +89,7 @@
if (tok.getText() != null) b.append(tok.getText());
}
- private void handleFunctions(Tree t) {
+ private void handleFunctions(LinkedListTree t) {
ArrayList<Integer> toRemove = new ArrayList<Integer>();
for(int m = 0; m < t.getChildCount(); m++) {
if ("function".equals(t.getChild(m).getText())) {
Modified:
ode/sandbox/simpel/src/main/java/org/apache/ode/simpel/omodel/OBuilder.java
URL:
http://svn.apache.org/viewvc/ode/sandbox/simpel/src/main/java/org/apache/ode/simpel/omodel/OBuilder.java?rev=667580&r1=667579&r2=667580&view=diff
==============================================================================
--- ode/sandbox/simpel/src/main/java/org/apache/ode/simpel/omodel/OBuilder.java
(original)
+++ ode/sandbox/simpel/src/main/java/org/apache/ode/simpel/omodel/OBuilder.java
Fri Jun 13 09:08:20 2008
@@ -35,6 +35,7 @@
HashMap<String, String> exprRuntime = new HashMap<String, String>();
exprRuntime.put("runtime-class",
"org.apache.ode.simpel.expr.SimPELExprRuntime");
_exprLang = new OExpressionLanguage(_oprocess, exprRuntime);
+ _exprLang.expressionLanguageUri = SIMPEL_NS + "/exprLang";
}
public StructuredActivity build(Class oclass, OScope oscope,
StructuredActivity parent, Object... params) {
@@ -91,9 +92,13 @@
final OScope processScope = new OScope(_oprocess, null);
processScope.name = "__PROCESS_SCOPE:" + name;
_oprocess.procesScope = processScope;
- return new StructuredActivity<OScope>(processScope) {
+ return buildScope(processScope, null);
+ }
+
+ public StructuredActivity<OScope> buildScope(final OScope oscope, OScope
parentScope) {
+ return new StructuredActivity<OScope>(oscope) {
public void run(OActivity child) {
- processScope.activity = child;
+ oscope.activity = child;
}
};
}
Modified:
ode/sandbox/simpel/src/test/java/org/apache/ode/simpel/SimPELRuntimeTest.java
URL:
http://svn.apache.org/viewvc/ode/sandbox/simpel/src/test/java/org/apache/ode/simpel/SimPELRuntimeTest.java?rev=667580&r1=667579&r2=667580&view=diff
==============================================================================
---
ode/sandbox/simpel/src/test/java/org/apache/ode/simpel/SimPELRuntimeTest.java
(original)
+++
ode/sandbox/simpel/src/test/java/org/apache/ode/simpel/SimPELRuntimeTest.java
Fri Jun 13 09:08:20 2008
@@ -19,14 +19,6 @@
" }\n" +
"}";
- private static final String POLITE_HELLO_WORLD =
- "process HelloWorld {\n" +
- " receive(my_pl, hello_op) { |info|\n" +
- " msg_out = msg_in + \" World\";\n" +
- " reply(msg_out);\n" +
- " }\n" +
- "}";
-
public void testHelloWorldComplete() throws Exception {
EmbeddedServer server = new EmbeddedServer();
server.start();