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/09/10 21:07:05 UTC

svn commit: r693931 [3/12] - in /ode/trunk: bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath10/ bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/xpath20/ runtimes/...

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompensateGeneratorMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompensateGeneratorMessages.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompensateGeneratorMessages.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompensateGeneratorMessages.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.api.CompilationMessage;
+import org.apache.ode.bpel.compiler.api.CompilationMessageBundle;
+
+/**
+ * @author Alex Boisvert <boisvert at apache dot org>
+ */
+public class CompensateGeneratorMessages extends CompilationMessageBundle {
+
+    /** The scope to compensate is unspecified. */
+    public CompilationMessage errScopeToCompensateUnspecfied() {
+        return this.formatCompilationMessage("The scope to compensate is unspecified.");
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompensateScopeGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompensateScopeGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompensateScopeGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompensateScopeGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,47 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.utils.msg.MessageBundle;
+import org.apache.ode.bpel.rtrep.v1.OCompensate;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.compiler.bom.CompensateScopeActivity;
+
+
+/**
+ * Generates code for the <code>&lt;compensateScope&gt;</code> activities.
+ */
+class CompensateScopeGenerator extends DefaultActivityGenerator {
+    private static final CompensateGeneratorMessages __cmsgs = MessageBundle.getMessages(CompensateGeneratorMessages.class);
+    
+    public void compile(OActivity output, Activity src) {
+        CompensateScopeActivity compSrc = (CompensateScopeActivity) src;
+        if (compSrc.getScopeToCompensate() == null)
+            throw new CompilationException(__cmsgs.errScopeToCompensateUnspecfied());
+        ((OCompensate)output).compensatedScope = _context.resolveCompensatableScope(compSrc.getScopeToCompensate());
+    }
+
+    public OActivity newInstance(Activity src) {
+        return new OCompensate(_context.getOProcess(), _context.getCurrent());
+    }
+}
+

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompilerContext.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompilerContext.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompilerContext.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/CompilerContext.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,128 @@
+/*
+ * 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.v1;
+
+import java.util.List;
+
+import javax.wsdl.Operation;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.utils.NSContext;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.bom.*;
+import org.apache.ode.bpel.compiler.SourceLocation;
+import org.apache.ode.bpel.rtrep.v1.*;
+
+
+/**
+ * Interface providing access to the compiler.
+ * 
+ * @author Maciej Szefler ( m s z e f l e r @ g m a i l . c o m )
+ */
+public interface CompilerContext {
+
+    OExpression constantExpr(boolean value);
+
+    OExpression compileJoinCondition(Expression expr)
+            throws CompilationException;
+
+    OExpression compileExpr(Expression expr)
+            throws CompilationException;
+
+    OLValueExpression compileLValueExpr(Expression expr)
+            throws CompilationException;
+
+    /**
+     * BPEL 1.1 legacy. 
+     * @param locationstr
+     * @param nsContext
+     * @return
+     * @throws CompilationException
+     */
+    OExpression compileExpr(String locationstr, NSContext nsContext)
+            throws CompilationException;
+
+    OXslSheet compileXslt(String docStrUri)
+            throws CompilationException;
+
+    OXsdTypeVarType resolveXsdType(QName typeName)
+            throws CompilationException;
+
+    OProcess.OProperty resolveProperty(QName name)
+            throws CompilationException;
+
+    OScope.Variable resolveVariable(String name)
+            throws CompilationException;
+
+    List<OScope.Variable> getAccessibleVariables();
+
+    OScope.Variable resolveMessageVariable(String inputVar)
+            throws CompilationException;
+
+    OScope.Variable resolveMessageVariable(String inputVar, QName messageType)
+            throws CompilationException;
+
+    OMessageVarType.Part resolvePart(OScope.Variable variable, String partname)
+            throws CompilationException;
+
+    OMessageVarType.Part resolveHeaderPart(OScope.Variable variable, String partname)
+            throws CompilationException;
+
+    OActivity compile(Activity child)
+            throws CompilationException;
+
+    OScope compileSLC(ScopeLikeActivity child, OScope.Variable[] variables);
+
+    OPartnerLink resolvePartnerLink(String name)
+            throws CompilationException;
+
+    Operation resolvePartnerRoleOperation(OPartnerLink partnerLink, String operationName)
+            throws CompilationException;
+
+    Operation resolveMyRoleOperation(OPartnerLink partnerLink, String operationName)
+            throws CompilationException;
+
+    OProcess.OPropertyAlias resolvePropertyAlias(OScope.Variable variable, QName property)
+            throws CompilationException;
+
+    void recoveredFromError(SourceLocation where, CompilationException bce)
+            throws CompilationException;
+
+    OLink resolveLink(String linkName)
+            throws CompilationException;
+
+    OScope resolveCompensatableScope(String scopeToCompensate)
+            throws CompilationException;
+
+    OProcess getOProcess()
+            throws CompilationException;
+
+    OScope.CorrelationSet resolveCorrelationSet(String csetName)
+            throws CompilationException;
+
+    String getSourceLocation();
+
+    boolean isPartnerLinkAssigned(String plink);
+
+    List<OActivity> getActivityStack();
+
+    OActivity getCurrent();
+
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/DefaultActivityGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/DefaultActivityGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/DefaultActivityGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/DefaultActivityGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,57 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.bom.FailureHandling;
+import org.apache.ode.bpel.compiler.bom.BpelObject;
+import org.apache.ode.bpel.rtrep.v1.OFailureHandling;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.bpel.rtrep.common.extension.ExtensibilityQNames;
+import org.w3c.dom.Element;
+
+/**
+ * Base implementation of the {@link ActivityGenerator} interface.
+ */
+abstract class DefaultActivityGenerator implements ActivityGenerator {
+    protected CompilerContext _context;
+
+    public void setContext(CompilerContext context) {
+        _context = context;
+    }
+
+    static void defaultExtensibilityElements(OActivity output, BpelObject src) {
+        if (src != null) {
+            failureHandlinExtensibilityElement(output, src);
+        }
+    }
+
+    static private void failureHandlinExtensibilityElement(OActivity output, BpelObject src) {
+        // Failure handling extensibility element.
+        Element element = src.getExtensibilityElement(ExtensibilityQNames.FAILURE_HANDLING);
+        if (element == null)
+            return;
+        FailureHandling extElement = new FailureHandling(element);
+        OFailureHandling obj = new OFailureHandling();
+        obj.retryFor = extElement.getRetryFor();
+        obj.retryDelay = extElement.getRetryDelay();
+        obj.faultOnFailure = extElement.getFaultOnFailure();
+        output.setFailureHandling(obj);
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/EmptyGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/EmptyGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/EmptyGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/EmptyGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.bpel.rtrep.v1.OEmpty;
+
+/**
+ * Generates code for <code>&lt;empty&gt;</code> activities.
+ */
+class EmptyGenerator extends DefaultActivityGenerator {
+
+    public void compile(OActivity output, Activity src) {
+    }
+
+    public OActivity newInstance(Activity src) {
+        return new OEmpty(_context.getOProcess(), _context.getCurrent());
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ExpressionCompiler.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ExpressionCompiler.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ExpressionCompiler.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ExpressionCompiler.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,65 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.rtrep.v1.OExpression;
+import org.apache.ode.bpel.rtrep.v1.OLValueExpression;
+
+import java.util.Map;
+
+/**
+ * Interface implemented by BPEL expression language compilers.
+ */
+public interface ExpressionCompiler {
+
+  /**
+   * Set the compiler context (for resolving variables and such).
+   * @param compilerContext compiler context
+   */
+  void setCompilerContext(CompilerContext compilerContext);
+
+  /**
+   * Compile an expression into a {@link org.apache.ode.bpel.o.OExpression} object.
+   * @param source
+   * @return
+   */
+  OExpression compile(Object source)
+          throws CompilationException;
+  
+  /**
+   * Compile an lvalue (the 'to' of an assignment) into a {@link org.apache.ode.bpel.o.OLValueExpression} object.
+   * @param source
+   * @return
+   * @throws CompilationException
+   */
+  OLValueExpression compileLValue(Object source)
+  			 throws CompilationException;
+  
+  /**
+   * Compile a join condition into a {@link org.apache.ode.bpel.o.OExpression} object.
+   * @param source
+   * @return
+   */
+  OExpression compileJoinCondition(Object source)
+          throws CompilationException;
+
+  Map<String,String> getProperties();
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/FlowGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/FlowGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/FlowGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/FlowGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,103 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.utils.msg.MessageBundle;
+import org.apache.ode.utils.stl.CollectionsX;
+import org.apache.ode.utils.stl.MemberOfFunction;
+import org.apache.ode.bpel.compiler.bom.FlowActivity;
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.compiler.bom.Link;
+import org.apache.ode.bpel.compiler.bom.CompositeActivity;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.rtrep.v1.OLink;
+import org.apache.ode.bpel.rtrep.v1.OFlow;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+
+import java.util.Iterator;
+
+
+/**
+ * Generates code for <code>&lt;flow&gt;</code> activities.
+ */
+class FlowGenerator extends DefaultActivityGenerator {
+    private static final FlowGeneratorMessages __cmsgs = MessageBundle.getMessages(FlowGeneratorMessages.class);
+
+    public void compile(OActivity output, Activity src) {
+        FlowActivity flowAct = (FlowActivity)src;
+        OFlow oflow = (OFlow) output;
+        compileLinkDecls(oflow, flowAct);
+        compileChildren(oflow, flowAct);
+
+        for (OLink olink : oflow.localLinks) {
+            try {
+                if (olink.source == null)
+                    throw new CompilationException(__cmsgs.errLinkMissingSourceActivity(olink.name).setSource(flowAct));
+            } catch (CompilationException ce) {
+                _context.recoveredFromError(src, ce);
+            }
+
+            try {
+                if (olink.target == null)
+                    throw new CompilationException(__cmsgs.errLinkMissingTargetActivity(olink.name).setSource(flowAct));
+            } catch (CompilationException ce) {
+                _context.recoveredFromError(src, ce);
+            }
+        }
+    }
+
+
+  public OActivity newInstance(Activity src) {
+    return new OFlow(_context.getOProcess(),_context.getCurrent());
+  }
+
+  private void compileLinkDecls(OFlow oflow, FlowActivity flowAct) {
+    for (Link link : flowAct.getLinks()) {
+      OLink olink = new OLink(_context.getOProcess());
+      olink.name = link.getLinkName();
+      declareLink(oflow, olink);
+    }
+  }
+
+
+    private void declareLink(final OFlow oflow, final OLink olink) throws CompilationException {
+        if (CollectionsX.find_if(oflow.localLinks, new MemberOfFunction<OLink>() {
+            public boolean isMember(OLink o) {
+                return o.name.equals(olink.name);
+            }
+        }) != null)
+            throw new CompilationException(__cmsgs.errDuplicateLinkDecl(olink.name));
+
+        olink.declaringFlow = oflow;
+        oflow.localLinks.add(olink);
+    }
+
+  /**
+   */
+  protected void compileChildren(OFlow dest, CompositeActivity src) {
+    for (Activity child : src.getActivities()){
+      try {
+        OActivity compiledChild = _context.compile(child);
+        dest.parallelActivities.add(compiledChild);
+      } catch (CompilationException ce) {
+        _context.recoveredFromError(child, ce);
+      }
+    }
+  }
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/FlowGeneratorMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/FlowGeneratorMessages.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/FlowGeneratorMessages.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/FlowGeneratorMessages.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,42 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.api.CompilationMessageBundle;
+import org.apache.ode.bpel.compiler.api.CompilationMessage;
+
+public class FlowGeneratorMessages extends CompilationMessageBundle {
+
+    /** The link "{0}" does not have a source. */
+    public CompilationMessage errLinkMissingSourceActivity(String linkName) {
+        return this.formatCompilationMessage("The link \"{0}\" does not have a source.", linkName);
+    }
+
+    /** The link "{0}" does not have a target. */
+    public CompilationMessage errLinkMissingTargetActivity(String linkName) {
+        return this.formatCompilationMessage("The link \"{0}\" does not have a target.", linkName);
+    }
+
+    /** Duplicate declaration of link "{0}". */
+    public CompilationMessage errDuplicateLinkDecl(String linkName) {
+        return this.formatCompilationMessage("Duplicate declaration of link \"{0}\".", linkName);
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,87 @@
+/*
+ * 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.v1;
+
+import javax.xml.XMLConstants;
+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.bom.Activity;
+import org.apache.ode.bpel.compiler.bom.Scope;
+import org.apache.ode.bpel.compiler.bom.ForEachActivity;
+import org.apache.ode.bpel.compiler.bom.Variable;
+import org.apache.ode.bpel.rtrep.v1.OXsdTypeVarType;
+import org.apache.ode.bpel.rtrep.v1.OScope;
+import org.apache.ode.bpel.rtrep.v1.OForEach;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.utils.msg.MessageBundle;
+import org.apache.ode.utils.Namespaces;
+
+/**
+ * Generates code for <code>&lt;forEach&gt;</code> activities.
+ */
+public class ForEachGenerator extends DefaultActivityGenerator {
+
+    private static final Log __log = LogFactory.getLog(AssignGenerator.class);
+    private static final ForEachGeneratorMessages __cmsgs = MessageBundle.getMessages(ForEachGeneratorMessages.class);
+
+    public OActivity newInstance(Activity src) {
+        return new OForEach(_context.getOProcess(), _context.getCurrent());
+    }
+
+    public void compile(OActivity output, Activity src) {
+        if (__log.isDebugEnabled()) __log.debug("Compiling ForEach activity.");
+        OForEach oforEach = (OForEach) output;
+        ForEachActivity forEach = (ForEachActivity) src;
+        oforEach.parallel = forEach.isParallel();
+        oforEach.startCounterValue = _context.compileExpr(forEach.getStartCounter());
+        oforEach.finalCounterValue = _context.compileExpr(forEach.getFinalCounter());
+        if (forEach.getCompletionCondition() != null) {
+            oforEach.completionCondition =
+                    new OForEach.CompletionCondition(_context.getOProcess());
+            oforEach.completionCondition.successfulBranchesOnly
+                    = forEach.getCompletionCondition().isSuccessfulBranchesOnly();
+            oforEach.completionCondition.branchCount = _context.compileExpr(forEach.getCompletionCondition());
+        }
+
+        // ForEach 'adds' a counter variable in inner scope
+        if (__log.isDebugEnabled()) __log.debug("Adding the forEach counter variable to inner scope.");
+        Scope s = forEach.getChild().getScope();
+        // Checking if a variable using the same name as our counter is already defined.
+        // The spec requires a static analysis error to be thrown in that case.
+        if (s.getVariableDecl(forEach.getCounterName()) != null)
+            throw new CompilationException(__cmsgs.errForEachAndScopeVariableRedundant(forEach.getCounterName()).setSource(src));
+
+        OXsdTypeVarType counterType = new OXsdTypeVarType(oforEach.getOwner());
+        counterType.simple = true;
+        counterType.xsdType = new QName(Namespaces.XML_SCHEMA, "int");
+        OScope.Variable counterVar = new OScope.Variable(oforEach.getOwner(), counterType);
+        counterVar.name = forEach.getCounterName();
+
+        if (__log.isDebugEnabled()) __log.debug("Compiling forEach inner scope.");
+        oforEach.innerScope = _context.compileSLC(forEach.getChild(), new OScope.Variable[]{counterVar});
+
+        // oforEach.innerScope.addLocalVariable(counterVar);
+        oforEach.counterVariable = counterVar;
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGeneratorMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGeneratorMessages.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGeneratorMessages.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ForEachGeneratorMessages.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.bpel.compiler.v1;
+
+import org.apache.ode.bpel.compiler.api.CompilationMessageBundle;
+import org.apache.ode.bpel.compiler.api.CompilationMessage;
+
+public class ForEachGeneratorMessages extends CompilationMessageBundle {
+
+    /** The &lt;reply&gt; must specify a reply message. */
+    public CompilationMessage errForEachAndScopeVariableRedundant(String couterName) {
+        return this.formatCompilationMessage("The <scope> activity nested inside forEach already declares a " +
+            "variable named {0}, just like the forEach counterName.");
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/IfGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/IfGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/IfGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/IfGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,64 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.bom.IfActivity;
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.rtrep.v1.OSwitch;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.utils.msg.MessageBundle;
+
+/**
+ * Generates code for the <code>&lt;switch&gt;</code> activities.
+ */
+class IfGenerator extends DefaultActivityGenerator {
+    private static final IfGeneratorMessages __cmsgs = MessageBundle.getMessages(IfGeneratorMessages.class);
+
+    public OActivity newInstance(Activity src) {
+        return new OSwitch(_context.getOProcess(), _context.getCurrent());
+    }
+
+    public void compile(OActivity output, Activity src) {
+        OSwitch oswitch = (OSwitch) output;
+        IfActivity switchDef = (IfActivity)src;
+
+        if (switchDef.getCondition() == null)
+            throw new CompilationException(__cmsgs.errIfWithNoCondition());
+
+        boolean first = true;
+        if (switchDef.getActivity() != null) {
+            OSwitch.OCase ocase = new OSwitch.OCase(_context.getOProcess());
+            ocase.activity = _context.compile(switchDef.getActivity());
+            ocase.expression = _context.compileExpr(switchDef.getCondition());
+            oswitch.addCase(ocase);
+            first = false;
+        }
+
+        for (IfActivity.Case ccase : switchDef.getCases()) {
+            OSwitch.OCase ocase = new OSwitch.OCase(_context.getOProcess());
+            ocase.activity = _context.compile(ccase.getActivity());
+            ocase.expression = first ? _context.compileExpr(switchDef.getCondition())
+                    : (ccase.getCondition() == null ? _context.constantExpr(true) : _context.compileExpr(ccase.getCondition()));
+            oswitch.addCase(ocase);
+            first = false;
+        }
+    }
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/IfGeneratorMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/IfGeneratorMessages.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/IfGeneratorMessages.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/IfGeneratorMessages.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.api.CompilationMessageBundle;
+import org.apache.ode.bpel.compiler.api.CompilationMessage;
+
+/**
+ * @author Matthieu Riou <mriou at apache dot org>
+ */
+public class IfGeneratorMessages extends CompilationMessageBundle {
+
+    /** The &lt;if&gt; must have a condition element. */
+    public CompilationMessage errIfWithNoCondition() {
+        return this.formatCompilationMessage("A <if> activity is declared with no <condition> element.");
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/InvokeGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/InvokeGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/InvokeGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/InvokeGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,151 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.utils.msg.MessageBundle;
+import org.apache.ode.utils.stl.CollectionsX;
+import org.apache.ode.utils.stl.MemberOfFunction;
+import org.apache.ode.bpel.compiler.bom.Correlation;
+import org.apache.ode.bpel.compiler.bom.InvokeActivity;
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.rtrep.v1.OInvoke;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.bpel.rtrep.v1.OScope;
+import org.apache.ode.bpel.rtrep.v1.OProcess;
+
+import javax.wsdl.OperationType;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Generates code for <code>&lt;invoke&gt;</code> activities.
+ */
+class InvokeGenerator extends DefaultActivityGenerator {
+
+    private static final InvokeGeneratorMessages __imsgs = MessageBundle.getMessages(InvokeGeneratorMessages.class);
+
+    public OActivity newInstance(Activity src) {
+        return new OInvoke(_context.getOProcess(), _context.getCurrent());
+    }
+
+    public void compile(OActivity output, Activity srcx) {
+        InvokeActivity src = (InvokeActivity) srcx;
+        final OInvoke oinvoke = (OInvoke) output;
+
+        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()));
+        if (oinvoke.operation.getInput() != null && oinvoke.operation.getInput().getMessage() != null) {
+            // 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());
+            }
+        }
+        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());
+        }
+        List<Correlation> correlations = src.getCorrelations();
+        List<Correlation> incorrelations = CollectionsX.filter(new ArrayList<Correlation>(), correlations,
+                new MemberOfFunction<Correlation>() {
+                    @Override
+                    public boolean isMember(Correlation o) {
+                        return o.getPattern() == Correlation.CorrelationPattern.IN;
+                    }
+                });
+        List<Correlation> outcorrelations = CollectionsX.filter(new ArrayList<Correlation>(), correlations,
+                new MemberOfFunction<Correlation>() {
+                    @Override
+                    public boolean isMember(Correlation o) {
+                        return (o.getPattern() == Correlation.CorrelationPattern.OUT)
+                                 || (o.getPattern()== Correlation.CorrelationPattern.UNSET && oinvoke.operation.getStyle()== OperationType.ONE_WAY );
+                    }
+                });
+
+        List<Correlation> inoutcorrelations = CollectionsX.filter(new ArrayList<Correlation>(), correlations,
+                new MemberOfFunction<Correlation>() {
+                    @Override
+                    public boolean isMember(Correlation o) {
+                        return o.getPattern() == Correlation.CorrelationPattern.INOUT;
+                    }
+                });
+
+        if (oinvoke.inputVar != null) {
+            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);
+        }
+        
+    }
+
+    private void doCorrelations(List<Correlation> correlations, OScope.Variable var,
+            Collection<OScope.CorrelationSet> assertCorrelations, Collection<OScope.CorrelationSet> initCorrelations) {
+        for (Correlation correlation : correlations) {
+            OScope.CorrelationSet cset = _context.resolveCorrelationSet(correlation.getCorrelationSet());
+            switch (correlation.getInitiate()) {
+            case NO:
+                assertCorrelations.add(cset);
+                break;
+            case YES:
+                initCorrelations.add(cset);
+                break;
+            case JOIN:
+                // TODO: fixe errror
+                throw new UnsupportedOperationException();
+            }
+            for (OProcess.OProperty property : cset.properties) {
+                // Force resolution of alias, to make sure that we have one for
+                // this variable-property pair.
+                try {
+                    _context.resolvePropertyAlias(var, property.name);
+                } catch (CompilationException ce) {
+                    if (ce.getCompilationMessage().source == null) {
+                        ce.getCompilationMessage().source = correlation;
+                    }
+                    throw ce;
+                }
+                // onMessage.
+            }
+        }
+    }
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/InvokeGeneratorMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/InvokeGeneratorMessages.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/InvokeGeneratorMessages.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/InvokeGeneratorMessages.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,47 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.api.CompilationMessageBundle;
+import org.apache.ode.bpel.compiler.api.CompilationMessage;
+
+public class InvokeGeneratorMessages extends CompilationMessageBundle {
+
+    /**
+     * Invoke doesn't define an output variable even though the operation {0}
+     * declares an output message.
+     */
+    public CompilationMessage errInvokeNoOutputMessageForOutputOp(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 input variable even though the operation {0}
+     * declares an input message.
+     */
+    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);
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,76 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.compiler.bom.OnAlarm;
+import org.apache.ode.bpel.compiler.bom.PickActivity;
+import org.apache.ode.bpel.compiler.bom.OnMessage;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.rtrep.v1.OPickReceive;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+
+/**
+ * Generates code for <code>&lt;pick&gt;</code> activities.
+ */
+class PickGenerator extends PickReceiveGenerator {
+
+  public OActivity newInstance(Activity src) {
+        return new OPickReceive(_context.getOProcess(), _context.getCurrent());
+  }
+
+  public void compile(OActivity output, Activity src) {
+    OPickReceive opick = (OPickReceive) output;
+    PickActivity pickDef = (PickActivity) src;
+
+    opick.createInstanceFlag = pickDef.isCreateInstance();
+    for (OnMessage sOnMessage : pickDef.getOnMessages()) {
+      OPickReceive.OnMessage oOnMessage = compileOnMessage(sOnMessage.getVariable(),
+              sOnMessage.getPartnerLink(),
+              sOnMessage.getOperation(),
+              sOnMessage.getMessageExchangeId(),
+              sOnMessage.getPortType(),
+              pickDef.isCreateInstance(),
+              sOnMessage.getCorrelations());
+      oOnMessage.activity = _context.compile(sOnMessage.getActivity());
+      opick.onMessages.add(oOnMessage);
+    }
+
+    try {
+      for(OnAlarm onAlarmDef : pickDef.getOnAlarms()){
+        OPickReceive.OnAlarm oalarm = new OPickReceive.OnAlarm(_context.getOProcess());
+        oalarm.activity = _context.compile(onAlarmDef.getActivity());
+        if (onAlarmDef.getFor() != null && onAlarmDef.getUntil() == null) {
+          oalarm.forExpr = _context.compileExpr(onAlarmDef.getFor());
+        } else if (onAlarmDef.getFor() == null && onAlarmDef.getUntil() != null) {
+          oalarm.untilExpr = _context.compileExpr(onAlarmDef.getUntil());
+        } else {
+          throw new CompilationException(__cmsgs.errForOrUntilMustBeGiven().setSource(onAlarmDef));
+        }
+
+        if (pickDef.isCreateInstance())
+          throw new CompilationException(__cmsgs.errOnAlarmWithCreateInstance().setSource(onAlarmDef));
+
+        opick.onAlarms.add(oalarm);
+      }
+    } catch (CompilationException ce) {
+      _context.recoveredFromError(pickDef, ce);
+    }
+  }
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickGeneratorMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickGeneratorMessages.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickGeneratorMessages.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickGeneratorMessages.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,50 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.api.CompilationMessage;
+import org.apache.ode.bpel.compiler.api.CompilationMessageBundle;
+
+public class PickGeneratorMessages extends CompilationMessageBundle {
+
+    /**
+     * Attempt to use multiple non-initiate correlation sets; second set was
+     * "{0}".
+     */
+    public CompilationMessage errSecondNonInitiateCorrelationSet(String setName) {
+        return this.formatCompilationMessage("Attempt to use multiple non-initiate correlation sets;"
+                + " second set was \"{0}\".", setName);
+    }
+
+    // TODO: better error message
+    public CompilationMessage errForOrUntilMustBeGiven() {
+        return this.formatCompilationMessage("errForOrUntilMustBeGiven");
+    }
+
+    // TODO: better error message
+    public CompilationMessage errOnAlarmWithCreateInstance() {
+        return this.formatCompilationMessage("errOnAlarmWithCreateInstance");
+    }
+
+    public CompilationMessage errRendezvousNotSupported() {
+        return this.formatCompilationMessage("Rendezvous correlation mode not supported in this context.");
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickReceiveGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickReceiveGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickReceiveGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/PickReceiveGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,133 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.CommonCompilationMessages;
+import org.apache.ode.bpel.compiler.bom.Correlation;
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.rtrep.v1.OScope;
+import org.apache.ode.bpel.rtrep.v1.OPickReceive;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.bpel.rtrep.v1.OProcess;
+import org.apache.ode.utils.msg.MessageBundle;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+
+/**
+ * Base class for the {@link PickGenerator} and {@link ReceiveGenerator}
+ * classes. Provides common functionality related to generating
+ * {@link org.apache.ode.bpel.o.OPickReceive.OnMessage} objects.
+ */
+abstract class PickReceiveGenerator extends DefaultActivityGenerator {
+    protected static final CommonCompilationMessages __cmsgsGeneral = MessageBundle
+            .getMessages(CommonCompilationMessages.class);
+
+    protected static final PickGeneratorMessages __cmsgs = MessageBundle.getMessages(PickGeneratorMessages.class);
+
+    public OActivity newInstance(Activity src) {
+        return new OPickReceive(_context.getOProcess(), _context.getCurrent());
+    }
+
+    /**
+     * Compile an On-Message or Receive block.
+     * 
+     * @param varname
+     *            name of variable to receive into
+     * @param plink
+     *            partner link to receive on
+     * @param operation
+     *            name of operation
+     * @param portType
+     *            optional portType
+     * @param createInstance
+     *            is this a start activity
+     * @param correlations
+     *            the correlations used
+     * @return
+     */
+    protected OPickReceive.OnMessage compileOnMessage(String varname, String plink, String operation,
+            String messageExchangeId, QName portType, boolean createInstance, Collection<Correlation> correlations) {
+
+        OPickReceive.OnMessage onMessage = new OPickReceive.OnMessage(_context.getOProcess());
+        onMessage.partnerLink = _context.resolvePartnerLink(plink);
+        onMessage.operation = _context.resolveMyRoleOperation(onMessage.partnerLink, operation);
+        if (onMessage.operation.getInput() != null && onMessage.operation.getInput().getMessage() != null)
+            onMessage.variable = _context.resolveMessageVariable(varname, onMessage.operation.getInput().getMessage()
+                    .getQName());
+        onMessage.messageExchangeId = messageExchangeId;
+
+        if (portType != null && !portType.equals(onMessage.partnerLink.myRolePortType.getQName()))
+            throw new CompilationException(__cmsgsGeneral.errPortTypeMismatch(portType,
+                    onMessage.partnerLink.myRolePortType.getQName()));
+
+        if (createInstance)
+            onMessage.partnerLink.addCreateInstanceOperation(onMessage.operation);
+
+        for (Correlation correlation : correlations) {
+            OScope.CorrelationSet cset = _context.resolveCorrelationSet(correlation.getCorrelationSet());
+
+            switch (correlation.getInitiate()) {
+            case UNSET:
+            case NO:
+                if (createInstance)
+                    throw new CompilationException(__cmsgsGeneral.errUseOfUninitializedCorrelationSet(correlation
+                            .getCorrelationSet()));
+                if (onMessage.matchCorrelation != null)
+                    throw new CompilationException(__cmsgs.errSecondNonInitiateCorrelationSet(correlation
+                            .getCorrelationSet()));
+                onMessage.matchCorrelation = cset;
+                onMessage.partnerLink.addCorrelationSetForOperation(onMessage.operation, cset);
+                break;
+            case YES:
+                onMessage.initCorrelations.add(cset);
+                onMessage.partnerLink.addCorrelationSetForOperation(onMessage.operation, cset);
+                break;
+            case JOIN:
+                if (createInstance) {
+                    onMessage.partnerLink.addCorrelationSetForOperation(onMessage.operation, cset);
+                    onMessage.initCorrelations.add(cset);
+                    onMessage.matchCorrelation = cset;
+                } else {
+                    throw new CompilationException(__cmsgs.errRendezvousNotSupported());
+
+                }
+                break;
+
+                default:
+                    throw new AssertionError("Unexpected value for correlation set enumeration!");
+            }
+
+            for (OProcess.OProperty property : cset.properties) {
+                // Force resolution of alias, to make sure that we have one for
+                // this variable-property pair.
+                _context.resolvePropertyAlias(onMessage.variable, property.name);
+            }
+        }
+
+        if (!onMessage.partnerLink.hasMyRole()) {
+            throw new CompilationException(__cmsgsGeneral.errNoMyRoleOnReceivePartnerLink(onMessage.partnerLink
+                    .getName()));
+        }
+
+        return onMessage;
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReceiveGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReceiveGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReceiveGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReceiveGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,47 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.compiler.bom.ReceiveActivity;
+import org.apache.ode.bpel.rtrep.v1.OPickReceive;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.bpel.rtrep.v1.OEmpty;
+
+class ReceiveGenerator extends PickReceiveGenerator {
+
+  public void compile(OActivity output, Activity src) {
+    OPickReceive opick = (OPickReceive) output;
+    ReceiveActivity rcvDef = (ReceiveActivity) src;
+
+    opick.createInstanceFlag = rcvDef.isCreateInstance();
+    OPickReceive.OnMessage onMessage = compileOnMessage(
+            rcvDef.getVariable(),
+            rcvDef.getPartnerLink(),
+            rcvDef.getOperation(),
+            rcvDef.getMessageExchangeId(),
+            rcvDef.getPortType(),
+            rcvDef.isCreateInstance(),
+            rcvDef.getCorrelations());
+
+    onMessage.activity = new OEmpty(_context.getOProcess(), opick);
+    opick.onMessages.add(onMessage);
+  }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/RepeatUntilGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/RepeatUntilGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/RepeatUntilGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/RepeatUntilGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,41 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.compiler.bom.RepeatUntilActivity;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.bpel.rtrep.v1.ORepeatUntil;
+
+/**
+ * Generates code for <code>&lt;while&gt;</code> activities.
+ */
+class RepeatUntilGenerator extends DefaultActivityGenerator {
+    public OActivity newInstance(Activity src) {
+        return new ORepeatUntil(_context.getOProcess(), _context.getCurrent());
+    }
+
+    public void compile(OActivity output, Activity srcx)  {
+        ORepeatUntil oru = (ORepeatUntil) output;
+        RepeatUntilActivity src = (RepeatUntilActivity)srcx;
+        oru.untilCondition = _context.compileExpr(src.getCondition());
+        oru.activity = _context.compile(src.getActivity());
+    }
+}
+

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReplyGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReplyGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReplyGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReplyGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,111 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.CommonCompilationMessages;
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.compiler.bom.Correlation;
+import org.apache.ode.bpel.compiler.bom.ReplyActivity;
+import org.apache.ode.bpel.rtrep.v1.*;
+import org.apache.ode.utils.msg.MessageBundle;
+
+import javax.wsdl.Fault;
+import java.util.Iterator;
+
+
+/**
+ * Generates code for <code>&lt;reply&gt;</code> activities.
+ */
+class ReplyGenerator extends DefaultActivityGenerator  {
+
+    private static final CommonCompilationMessages _cmsgsGeneral =
+            MessageBundle.getMessages(CommonCompilationMessages.class);
+
+    private static final ReplyGeneratorMessages __cmsgsLocal =
+            MessageBundle.getMessages(ReplyGeneratorMessages.class);
+
+    public OActivity newInstance(Activity src) {
+        return new OReply(_context.getOProcess(), _context.getCurrent());
+    }
+
+    public void compile(OActivity output, Activity src) {
+        ReplyActivity replyDef = (ReplyActivity) src;
+        OReply oreply = (OReply) output;
+
+        oreply.isFaultReply = replyDef.getFaultName() != null;
+        oreply.partnerLink = _context.resolvePartnerLink(replyDef.getPartnerLink());
+        oreply.messageExchangeId = replyDef.getMessageExchangeId();
+        if (replyDef.getVariable() != null) {
+            oreply.variable = _context.resolveVariable(replyDef.getVariable());
+            if (!(oreply.variable.type instanceof OMessageVarType))
+                throw new CompilationException(_cmsgsGeneral.errMessageVariableRequired(oreply.variable.name));
+        }
+
+        if (oreply.partnerLink.myRolePortType == null)
+            throw new CompilationException(_cmsgsGeneral.errPartnerLinkDoesNotDeclareMyRole(oreply.partnerLink.getName()));
+        // The portType on the reply is not necessary, so we check its validty only when present.
+        if (replyDef.getPortType() != null && !oreply.partnerLink.myRolePortType.getQName().equals(replyDef.getPortType()))
+            throw new CompilationException(_cmsgsGeneral.errPortTypeMismatch(replyDef.getPortType(),oreply.partnerLink.myRolePortType.getQName()));
+
+        oreply.operation = _context.resolveMyRoleOperation(oreply.partnerLink, replyDef.getOperation());
+        if (oreply.operation.getOutput() == null)
+            throw new CompilationException(_cmsgsGeneral.errTwoWayOperationExpected(oreply.operation.getName()));
+
+        if (oreply.isFaultReply) {
+            Fault flt = null;
+            if (replyDef.getFaultName().getNamespaceURI().equals(oreply.partnerLink.myRolePortType.getQName().getNamespaceURI()))
+                flt = oreply.operation.getFault(replyDef.getFaultName().getLocalPart());
+            if (flt == null)
+                throw new CompilationException(__cmsgsLocal.errUndeclaredFault(replyDef.getFaultName().getLocalPart(), oreply.operation.getName()));
+            if (oreply.variable != null && !((OMessageVarType)oreply.variable.type).messageType.equals(flt.getMessage().getQName()))
+                throw new CompilationException(_cmsgsGeneral.errVariableTypeMismatch(oreply.variable.name, flt.getMessage().getQName(), ((OMessageVarType)oreply.variable.type).messageType));
+            oreply.fault = replyDef.getFaultName();
+        } else /* !oreply.isFaultReply */ {
+            assert oreply.fault == null;
+            if (oreply.variable == null)
+                throw new CompilationException(__cmsgsLocal.errOutputVariableMustBeSpecified());
+            if (!((OMessageVarType)oreply.variable.type).messageType.equals(oreply.operation.getOutput().getMessage().getQName()))
+                throw new CompilationException(_cmsgsGeneral.errVariableTypeMismatch(oreply.variable.name, oreply.operation.getOutput().getMessage().getQName(),((OMessageVarType)oreply.variable.type).messageType));
+        }
+
+        for (Correlation correlation  : replyDef.getCorrelations()) {
+            OScope.CorrelationSet cset = _context.resolveCorrelationSet(correlation.getCorrelationSet());
+
+            switch (correlation.getInitiate()) {
+                case UNSET:
+                case NO:
+                    oreply.assertCorrelations.add(cset);
+                    break;
+                case YES:
+                    oreply.initCorrelations.add(cset);
+                    break;
+                default:
+                    // TODO: Make error for this.
+                    throw new AssertionError();
+            }
+
+            for (Iterator<OProcess.OProperty> j = cset.properties.iterator(); j.hasNext(); ) {
+                OProcess.OProperty property = j.next();
+                // Force resolution of alias, to make sure that we have one for this variable-property pair.
+                _context.resolvePropertyAlias(oreply.variable, property.name);
+            }
+        }
+    }
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReplyGeneratorMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReplyGeneratorMessages.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReplyGeneratorMessages.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ReplyGeneratorMessages.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,41 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.api.CompilationMessage;
+import org.apache.ode.bpel.compiler.api.CompilationMessageBundle;
+
+public class ReplyGeneratorMessages extends CompilationMessageBundle {
+
+    /** The &lt;reply&gt; must specify a reply message. */
+    public CompilationMessage errOutputVariableMustBeSpecified() {
+        return this.formatCompilationMessage("The <reply> must specify a reply message.");
+    }
+
+    /**
+     * The &lt;reply&gt; activity has an undeclared fault "{0}" for operation
+     * "{1}".
+     */
+    public CompilationMessage errUndeclaredFault(String faultName, String operationName) {
+        return this.formatCompilationMessage("The <reply> activity has an undeclared fault"
+            + "\"{0}\" for operation \"{1}\".", faultName, operationName);
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/RethrowGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/RethrowGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/RethrowGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/RethrowGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.bpel.compiler.v1;
+
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.rtrep.v1.ORethrow;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+
+class RethrowGenerator extends DefaultActivityGenerator {
+
+    public void compile(OActivity output, Activity src) {
+    }
+
+    public OActivity newInstance(Activity src) {
+        return new ORethrow(_context.getOProcess(), _context.getCurrent());
+    }
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/SequenceGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/SequenceGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/SequenceGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/SequenceGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,64 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.compiler.bom.SequenceActivity;
+import org.apache.ode.bpel.compiler.bom.CompositeActivity;
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.CommonCompilationMessages;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.bpel.rtrep.v1.OSequence;
+import org.apache.ode.utils.msg.MessageBundle;
+
+
+/**
+ * Generates code for <code>&lt;sequence&gt;</code> activities.
+ */
+
+class SequenceGenerator extends DefaultActivityGenerator {
+
+    private static final CommonCompilationMessages __cmsgs =
+        MessageBundle.getMessages(CommonCompilationMessages.class);
+
+    public OActivity newInstance(Activity src) {
+        return new OSequence(_context.getOProcess(), _context.getCurrent());
+    }
+
+    public void compile(OActivity output, Activity src)  {
+        OSequence oseq = (OSequence) output;
+        compileChildren(oseq, (SequenceActivity) src);
+    }
+
+    protected void compileChildren(OSequence dest, CompositeActivity src) {
+        if (src.getActivities().size() == 0)
+            throw new CompilationException(__cmsgs.errEmptySequence().setSource(src));
+
+        for (Activity child : src.getActivities()) {
+            try {
+                OActivity compiledChild = _context.compile(child);
+                dest.sequence.add(compiledChild);
+            }
+            catch (CompilationException ce) {
+                _context.recoveredFromError(child, ce);
+            }
+        }
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/SwitchGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/SwitchGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/SwitchGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/SwitchGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,47 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.bom.SwitchActivity;
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.bpel.rtrep.v1.OSwitch;
+
+/**
+ * Generator for legacy BPEL 1.1 <code>&lt;switch&gt;</code> actiivty.
+ * @author Maciej Szefler - m s z e f l e r @ g m a i l . c o m
+ *
+ */
+public class SwitchGenerator extends DefaultActivityGenerator {
+  public OActivity newInstance(Activity src) {
+        return new OSwitch(_context.getOProcess(), _context.getCurrent());
+  }
+
+  public void compile(OActivity output, Activity src) {
+    OSwitch oswitch = (OSwitch) output;
+    SwitchActivity switchDef = (SwitchActivity)src;
+
+    for (SwitchActivity.Case ccase : switchDef.getCases()) {
+      OSwitch.OCase ocase = new OSwitch.OCase(_context.getOProcess());
+      ocase.activity = _context.compile(ccase.getActivity());
+      ocase.expression = (ccase.getCondition() == null ? _context.constantExpr(true) : _context.compileExpr(ccase.getCondition()));
+      oswitch.addCase(ocase);
+    }
+  }
+}
\ No newline at end of file

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/TerminateGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/TerminateGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/TerminateGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/TerminateGenerator.java Wed Sep 10 12:06:59 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.v1;
+
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+import org.apache.ode.bpel.rtrep.v1.OTerminate;
+
+
+/**
+ * Generates code for <code>&lt;terminate&gt;</code> activities.
+ */
+class TerminateGenerator extends DefaultActivityGenerator
+{
+    public void compile(OActivity output, Activity src) {
+    }
+
+    public OActivity newInstance(Activity src) {
+        return new OTerminate(_context.getOProcess(), _context.getCurrent());
+    }
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ThrowGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ThrowGenerator.java?rev=693931&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ThrowGenerator.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v1/ThrowGenerator.java Wed Sep 10 12:06:59 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.v1;
+
+import org.apache.ode.bpel.compiler.bom.ThrowActivity;
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.rtrep.v1.OThrow;
+import org.apache.ode.bpel.rtrep.v1.OActivity;
+
+
+/**
+ * Generates code for <code>&lt;throw&gt;</code> activities.
+ */
+class ThrowGenerator extends DefaultActivityGenerator {
+
+    public OActivity newInstance(Activity src) {
+        return new OThrow(_context.getOProcess(), _context.getCurrent());
+    }
+
+    public void compile(OActivity output, Activity src) {
+        ThrowActivity throwDef = (ThrowActivity)src;
+        OThrow othrow = (OThrow) output;
+        othrow.faultName = throwDef.getFaultName();
+        if(throwDef.getFaultVariable() != null)
+            othrow.faultVariable = _context.resolveVariable(throwDef.getFaultVariable());
+    }
+}