Replace tabs with spaces in changed source files
Project: http://git-wip-us.apache.org/repos/asf/ode/repo Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/4b87e5b1 Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/4b87e5b1 Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/4b87e5b1 Branch: refs/heads/master Commit: 4b87e5b11589e4f7941642d42118c8482c50ebfa Parents: bb2eeb2 Author: hahnml <[email protected]> Authored: Mon Jan 29 16:23:55 2018 +0100 Committer: hahnml <[email protected]> Committed: Mon Jan 29 16:23:55 2018 +0100 ---------------------------------------------------------------------- .../java/org/apache/ode/axis2/ODEServer.java | 38 +- .../ode/bpel/eapi/AbstractExtensionBundle.java | 105 +- .../apache/ode/bpel/eapi/ExtensionContext.java | 109 +- .../ode/bpel/eapi/ExtensionOperation.java | 35 +- .../ode/bpel/compiler/AssignGenerator.java | 205 ++-- .../bpel/compiler/AssignGeneratorMessages.java | 21 +- .../apache/ode/bpel/compiler/BpelCompiler.java | 59 +- .../ExtensionActivityGeneratorMessages.java | 47 +- .../compiler/ExtensionActivtityGenerator.java | 97 +- .../ode/bpel/compiler/bom/AssignActivity.java | 27 +- .../bpel/compiler/bom/BpelObjectFactory.java | 17 +- .../apache/ode/bpel/compiler/bom/Extension.java | 42 +- .../bpel/compiler/bom/ExtensionActivity.java | 139 ++- .../compiler/bom/ExtensionAssignOperation.java | 60 +- .../ode/bpel/compiler/bom/Extensions.java | 30 +- .../org/apache/ode/bpel/compiler/XPathTest.java | 2 +- .../ode/il/config/OdeConfigProperties.java | 2 +- .../java/org/apache/ode/bpel/obj/OAssign.java | 1033 +++++++++--------- .../apache/ode/bpel/obj/OExtensionActivity.java | 114 +- .../java/org/apache/ode/bpel/obj/OProcess.java | 82 +- .../apache/ode/bpel/obj/migrate/OmOld2new.java | 449 ++++---- .../java/org/apache/ode/bpel/o/OProcess.java | 2 +- .../Bpel4RestLightExtensionBundle.java | 60 +- .../bpel4restlight/Bpel4RestLightOperation.java | 131 ++- .../bpel4restlight/Bpel4RestLightUtil.java | 520 +++++---- .../bpel4restlight/MethodAttribute.java | 38 +- .../bpel4restlight/http/HighLevelRestApi.java | 332 +++--- .../bpel4restlight/http/HttpMethod.java | 28 +- .../http/HttpResponseMessage.java | 81 +- .../bpel4restlight/http/LowLevelRestApi.java | 124 ++- .../org/apache/ode/bpel/engine/BpelProcess.java | 36 +- .../ode/bpel/engine/BpelRuntimeContextImpl.java | 54 +- .../apache/ode/bpel/engine/BpelServerImpl.java | 6 +- .../org/apache/ode/bpel/engine/Contexts.java | 2 +- .../org/apache/ode/bpel/engine/Messages.java | 6 +- .../org/apache/ode/bpel/runtime/ASSIGN.java | 73 +- .../ode/bpel/runtime/EXTENSIONACTIVITY.java | 117 +- .../ode/bpel/runtime/ExtensionContextImpl.java | 171 ++- .../runtime/channels/ExtensionResponse.java | 32 +- .../xpath20/runtime/MockCompilerContext.java | 6 +- .../apache/ode/bpel/runtime/CoreBpelTest.java | 11 +- .../ode/test/RestExtensionActivitiesTest.java | 470 ++++---- 42 files changed, 2470 insertions(+), 2543 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java ---------------------------------------------------------------------- diff --git a/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java b/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java index 2d9f0ca..6d40dbe 100644 --- a/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java +++ b/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java @@ -713,26 +713,24 @@ public class ODEServer { // Add support for extension bundles based on ODE 2.0 alpha branch private void registerExtensionActivityBundles() { - String extensionsStr = _odeConfig.getExtensionActivityBundles(); - - if (extensionsStr != null) { - // TODO replace StringTokenizer by regex - for (String bundleCN : extensionsStr.split("\\s*(,|;)\\s*")) { - try { - // instantiate bundle - AbstractExtensionBundle bundle = (AbstractExtensionBundle) Class - .forName(bundleCN).newInstance(); - - // register extension bundle (BPEL server) - _bpelServer.registerExtensionBundle(bundle); - } catch (Exception e) { - __log.warn("Couldn't register the extension bundle runtime " - + bundleCN - + ", the class couldn't be " - + "loaded properly."); - } - } - } + String extensionsStr = _odeConfig.getExtensionActivityBundles(); + + if (extensionsStr != null) { + // TODO replace StringTokenizer by regex + for (String bundleCN : extensionsStr.split("\\s*(,|;)\\s*")) { + try { + // instantiate bundle + AbstractExtensionBundle bundle = + (AbstractExtensionBundle) Class.forName(bundleCN).newInstance(); + + // register extension bundle (BPEL server) + _bpelServer.registerExtensionBundle(bundle); + } catch (Exception e) { + __log.warn("Couldn't register the extension bundle runtime " + bundleCN + + ", the class couldn't be " + "loaded properly."); + } + } + } } private class ProcessStoreListenerImpl implements ProcessStoreListener { http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-api/src/main/java/org/apache/ode/bpel/eapi/AbstractExtensionBundle.java ---------------------------------------------------------------------- diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/eapi/AbstractExtensionBundle.java b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/AbstractExtensionBundle.java index 2210242..1690327 100644 --- a/bpel-api/src/main/java/org/apache/ode/bpel/eapi/AbstractExtensionBundle.java +++ b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/AbstractExtensionBundle.java @@ -1,20 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.eapi; @@ -24,48 +20,53 @@ import java.util.Map; import java.util.Set; /** -* Abstract class that bundles and registers <code><extensionActivity></code> and -* <code><extensionAssignOperation></code> implementations related to a particular namespace. -* -* @author Tammo van Lessen (University of Stuttgart) -*/ + * Abstract class that bundles and registers <code><extensionActivity></code> and + * <code><extensionAssignOperation></code> implementations related to a particular namespace. + * + * @author Tammo van Lessen (University of Stuttgart) + */ public abstract class AbstractExtensionBundle { - private Map<String, Class<? extends ExtensionOperation>> extensionsByName = new HashMap<String, Class<? extends ExtensionOperation>>(); + private Map<String, Class<? extends ExtensionOperation>> extensionsByName = + new HashMap<String, Class<? extends ExtensionOperation>>(); + + /** + * Returns the extension namespace this bundle provides implementations for. + * + * @return + */ + public abstract String getNamespaceURI(); + + /** + * Register extension operations. + */ + public abstract void registerExtensionActivities(); - /** - * Returns the extension namespace this bundle provides implementations for. - * @return - */ - public abstract String getNamespaceURI(); - - /** - * Register extension operations. - */ - public abstract void registerExtensionActivities(); + /** + * Register an {@link ExtensionOperation} implementation as + * <code><extensionActivity></code>. + * + * @param localName + * @param activity + */ + protected final void registerExtensionOperation(String localName, + Class<? extends ExtensionOperation> operation) { + extensionsByName.put(localName, operation); + } - /** - * Register an {@link ExtensionOperation} implementation as <code><extensionActivity></code>. - * - * @param localName - * @param activity - */ - protected final void registerExtensionOperation(String localName, Class<? extends ExtensionOperation> operation) { - extensionsByName.put(localName, operation); - } - - /** - * Returns a list of the local names of registered extension operations. - */ - public final Set<String> getExtensionOperationNames() { - return Collections.unmodifiableSet(extensionsByName.keySet()); - } + /** + * Returns a list of the local names of registered extension operations. + */ + public final Set<String> getExtensionOperationNames() { + return Collections.unmodifiableSet(extensionsByName.keySet()); + } - public final Class<? extends ExtensionOperation> getExtensionOperationClass(String localName) { - return extensionsByName.get(localName); - } + public final Class<? extends ExtensionOperation> getExtensionOperationClass(String localName) { + return extensionsByName.get(localName); + } - public final ExtensionOperation getExtensionOperationInstance(String localName) throws InstantiationException, IllegalAccessException { - return getExtensionOperationClass(localName).newInstance(); - } + public final ExtensionOperation getExtensionOperationInstance(String localName) + throws InstantiationException, IllegalAccessException { + return getExtensionOperationClass(localName).newInstance(); + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionContext.java ---------------------------------------------------------------------- diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionContext.java b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionContext.java index 2ffbba7..e3cf271 100644 --- a/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionContext.java +++ b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionContext.java @@ -1,20 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.eapi; @@ -29,48 +25,44 @@ import org.w3c.dom.Node; /** - * Context for executing extension activities or extension assign operations. - * Implementations of the {@link ExtensionOperation} class use this interface to access BPEL - * variables, property sets and link status. + * Context for executing extension activities or extension assign operations. Implementations of the + * {@link ExtensionOperation} class use this interface to access BPEL variables, property sets and + * link status. * * @author Tammo van Lessen (University of Stuttgart) */ public interface ExtensionContext { - /** - * Returns a list of variables visible in the current scope. - * - * @return an unmodifiable list of visible variables. - * @throws FaultException - */ - Map<String, OScope.Variable> getVisibleVariables() throws FaultException; - - /** - * Returns a list of links. - * - * @return an unmodifiable list of visible variables. - * @throws FaultException - */ - List<OLink> getLinks() throws FaultException; + /** + * Returns a list of variables visible in the current scope. + * + * @return an unmodifiable list of visible variables. + * @throws FaultException + */ + Map<String, OScope.Variable> getVisibleVariables() throws FaultException; + + /** + * Returns a list of links. + * + * @return an unmodifiable list of visible variables. + * @throws FaultException + */ + List<OLink> getLinks() throws FaultException; - /** + /** * Read the value of a BPEL variable. * - * @param variable - * variable to read - * @param part - * the part (or <code>null</code>) + * @param variable variable to read + * @param part the part (or <code>null</code>) * @return the value of the variable, wrapped in a <code>Node</code> */ Node readVariable(OScope.Variable variable) throws FaultException; - - /** + + /** * Read the value of a BPEL variable. * - * @param variableName - * variable to read - * @param part - * the part (or <code>null</code>) + * @param variableName variable to read + * @param part the part (or <code>null</code>) * @return the value of the variable, wrapped in a <code>Node</code> */ Node readVariable(String variableName) throws FaultException; @@ -78,10 +70,8 @@ public interface ExtensionContext { /** * Write the value into a BPEL variable. * - * @param variable - * variable to write - * @param value - * the value to be stored into the variable + * @param variable variable to write + * @param value the value to be stored into the variable * @return the value of the variable, wrapped in a <code>Node</code> */ void writeVariable(OScope.Variable variable, Node value) throws FaultException; @@ -89,10 +79,8 @@ public interface ExtensionContext { /** * Write the value into a BPEL variable. * - * @param variableName - * variable to write - * @param value - * the value to be stored into the variable + * @param variableName variable to write + * @param value the value to be stored into the variable * @return the value of the variable, wrapped in a <code>Node</code> */ void writeVariable(String variableName, Node value) throws FaultException; @@ -100,29 +88,26 @@ public interface ExtensionContext { /** * Read the value of a BPEL property. * - * @param variable - * variable containing property - * @param property - * property to read + * @param variable variable containing property + * @param property property to read * @return value of the property */ String readMessageProperty(OScope.Variable variable, OProcess.OProperty property) throws FaultException; - + /** * Obtain the status of a control link. * - * @param olink - * link to check - * @return <code>true</code> if the link is active, <code>false</code> - * otherwise. + * @param olink link to check + * @return <code>true</code> if the link is active, <code>false</code> otherwise. */ boolean isLinkActive(OLink olink) throws FaultException; - + /** * Reads the current process instance id. + * * @return instance id */ Long getProcessId(); - + } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionOperation.java ---------------------------------------------------------------------- diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionOperation.java b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionOperation.java index 8bcba6c..28ac629 100644 --- a/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionOperation.java +++ b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionOperation.java @@ -1,20 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.eapi; @@ -22,12 +18,11 @@ import org.apache.ode.bpel.common.FaultException; import org.w3c.dom.Element; /** - * This is the basis interface for implementations of - * <code><extensionAssignOperation></code> and <code><extensionActivity></code> - * nodes. + * This is the basis interface for implementations of <code><extensionAssignOperation></code> + * and <code><extensionActivity></code> nodes. * - * Implementations of this interface must provide a default constructor as they are created - * using reflection. + * Implementations of this interface must provide a default constructor as they are created using + * reflection. * * @see AbstractExtensionBundle * @@ -35,5 +30,5 @@ import org.w3c.dom.Element; */ public interface ExtensionOperation { - void run(ExtensionContext context, Element element) throws FaultException; + void run(ExtensionContext context, Element element) throws FaultException; } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java index 79cf3eb..b71c1be 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java @@ -1,20 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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; @@ -56,7 +52,7 @@ class AssignGenerator extends DefaultActivityGenerator { private static final Logger __log = LoggerFactory.getLogger(AssignGenerator.class); private static final AssignGeneratorMessages __cmsgs = - MessageBundle.getMessages(AssignGeneratorMessages.class); + MessageBundle.getMessages(AssignGeneratorMessages.class); public OActivity newInstance(Activity src) { return new OAssign(_context.getOProcess(), _context.getCurrent()); @@ -65,61 +61,60 @@ class AssignGenerator extends DefaultActivityGenerator { public void compile(OActivity dest, Activity source) { OAssign oassign = (OAssign) dest; AssignActivity ad = (AssignActivity) source; - for (AssignOperation operation : ad.getOperations()) { - if (operation instanceof Copy) { - Copy scopy = (Copy) operation; - OAssign.Copy ocopy = new OAssign.Copy(_context.getOProcess()); - ocopy.setKeepSrcElementName(scopy.isKeepSrcElement()); - ocopy.setIgnoreMissingFromData(scopy.isIgnoreMissingFromData()); - ocopy.setIgnoreUninitializedFromVariable(scopy.isIgnoreUninitializedFromVariable()); - ocopy.setInsertMissingToData(scopy.isInsertMissingToData()); - ocopy.setInsertMissingToData(scopy.isInsertMissingToData()); - ocopy.setDebugInfo(new DebugInfo(_context.getSourceLocation() , scopy.getLineNo() , source.getExtensibilityElements())); - try { - if (scopy.getTo() == null) - throw new CompilationException(__cmsgs.errMissingToSpec().setSource(scopy)); - Object[] toResultType = new Object[1]; - ocopy.setTo(compileTo(scopy.getTo(), toResultType)); + for (AssignOperation operation : ad.getOperations()) { + if (operation instanceof Copy) { + Copy scopy = (Copy) operation; + OAssign.Copy ocopy = new OAssign.Copy(_context.getOProcess()); + ocopy.setKeepSrcElementName(scopy.isKeepSrcElement()); + ocopy.setIgnoreMissingFromData(scopy.isIgnoreMissingFromData()); + ocopy.setIgnoreUninitializedFromVariable(scopy.isIgnoreUninitializedFromVariable()); + ocopy.setInsertMissingToData(scopy.isInsertMissingToData()); + ocopy.setInsertMissingToData(scopy.isInsertMissingToData()); + ocopy.setDebugInfo(new DebugInfo(_context.getSourceLocation(), scopy.getLineNo(), + source.getExtensibilityElements())); + try { + if (scopy.getTo() == null) + throw new CompilationException(__cmsgs.errMissingToSpec().setSource(scopy)); + Object[] toResultType = new Object[1]; + ocopy.setTo(compileTo(scopy.getTo(), toResultType)); - if (scopy.getFrom() == null) - throw new CompilationException(__cmsgs.errMissingFromSpec().setSource(scopy)); - ocopy.setFrom(compileFrom(scopy.getFrom(), toResultType[0])); + if (scopy.getFrom() == null) + throw new CompilationException( + __cmsgs.errMissingFromSpec().setSource(scopy)); + ocopy.setFrom(compileFrom(scopy.getFrom(), toResultType[0])); - verifyCopy(ocopy); - oassign.getOperations().add(ocopy); + verifyCopy(ocopy); + oassign.getOperations().add(ocopy); - } catch (CompilationException ce) { - _context.recoveredFromError(scopy, ce); + } catch (CompilationException ce) { + _context.recoveredFromError(scopy, ce); + } + } else if (operation instanceof ExtensionAssignOperation) { + ExtensionAssignOperation sop = (ExtensionAssignOperation) operation; + OAssign.ExtensionAssignOperation oext = + new OAssign.ExtensionAssignOperation(_context.getOProcess()); + oext.setDebugInfo(new DebugInfo(_context.getSourceLocation(), sop.getLineNo(), + source.getExtensibilityElements())); + try { + if (source.is20Draft()) { + throw new CompilationException(__cmsgs.errExtensibleAssignNotSupported()); + } + Element el = sop.getNestedElement(); + if (el == null) { + throw new CompilationException( + __cmsgs.errMissingExtensionAssignOperationElement().setSource(sop)); + } + if (!_context.isExtensionDeclared(el.getNamespaceURI())) { + throw new CompilationException( + __cmsgs.errUndeclaredExtensionAssignOperation().setSource(sop)); + } + oext.setExtensionName(DOMUtils.getElementQName(el)); + oext.setNestedElement(DOMUtils.domToString(el)); + oassign.getOperations().add(oext); + } catch (CompilationException ce) { + _context.recoveredFromError(sop, ce); + } } - } else if (operation instanceof ExtensionAssignOperation) { - ExtensionAssignOperation sop = (ExtensionAssignOperation) operation; - OAssign.ExtensionAssignOperation oext = new OAssign.ExtensionAssignOperation( - _context.getOProcess()); - oext.setDebugInfo(new DebugInfo(_context.getSourceLocation(), - sop.getLineNo(), source.getExtensibilityElements())); - try { - if (source.is20Draft()) { - throw new CompilationException( - __cmsgs.errExtensibleAssignNotSupported()); - } - Element el = sop.getNestedElement(); - if (el == null) { - throw new CompilationException(__cmsgs - .errMissingExtensionAssignOperationElement() - .setSource(sop)); - } - if (!_context.isExtensionDeclared(el.getNamespaceURI())) { - throw new CompilationException(__cmsgs - .errUndeclaredExtensionAssignOperation() - .setSource(sop)); - } - oext.setExtensionName(DOMUtils.getElementQName(el)); - oext.setNestedElement(DOMUtils.domToString(el)); - oassign.getOperations().add(oext); - } catch (CompilationException ce) { - _context.recoveredFromError(sop, ce); - } - } } } @@ -133,30 +128,39 @@ class AssignGenerator extends DefaultActivityGenerator { __log.debug("verifying copy: " + ocopy); // If direct Message->Message copy - if (ocopy.getTo() instanceof OAssign.VariableRef && ((OAssign.VariableRef) ocopy.getTo()).isMessageRef() - && ocopy.getFrom() instanceof OAssign.VariableRef && ((OAssign.VariableRef) ocopy.getFrom()).isMessageRef()) { + if (ocopy.getTo() instanceof OAssign.VariableRef + && ((OAssign.VariableRef) ocopy.getTo()).isMessageRef() + && ocopy.getFrom() instanceof OAssign.VariableRef + && ((OAssign.VariableRef) ocopy.getFrom()).isMessageRef()) { // Check that the LValue/RValue message types match up. String lvar = ((OAssign.VariableRef) ocopy.getTo()).getVariable().getName(); String rvar = ((OAssign.VariableRef) ocopy.getFrom()).getVariable().getName(); - QName tlvalue = ((OMessageVarType) ((OAssign.VariableRef) ocopy.getTo()).getVariable().getType()).getMessageType(); - QName trvalue = ((OMessageVarType) ((OAssign.VariableRef) ocopy.getFrom()).getVariable().getType()).getMessageType(); + QName tlvalue = ((OMessageVarType) ((OAssign.VariableRef) ocopy.getTo()).getVariable() + .getType()).getMessageType(); + QName trvalue = ((OMessageVarType) ((OAssign.VariableRef) ocopy.getFrom()).getVariable() + .getType()).getMessageType(); if (!tlvalue.equals(trvalue)) - throw new CompilationException(__cmsgs.errMismatchedMessageAssignment(lvar, tlvalue, rvar, trvalue)); + throw new CompilationException( + __cmsgs.errMismatchedMessageAssignment(lvar, tlvalue, rvar, trvalue)); } // If Message->Non-Message copy - else if (ocopy.getFrom() instanceof OAssign.VariableRef && ((OAssign.VariableRef) ocopy.getFrom()).isMessageRef() - && (!(ocopy.getTo() instanceof OAssign.VariableRef) || !((OAssign.VariableRef) ocopy.getTo()).isMessageRef())) { + else if (ocopy.getFrom() instanceof OAssign.VariableRef + && ((OAssign.VariableRef) ocopy.getFrom()).isMessageRef() + && (!(ocopy.getTo() instanceof OAssign.VariableRef) + || !((OAssign.VariableRef) ocopy.getTo()).isMessageRef())) { String rval = ((OAssign.VariableRef) ocopy.getFrom()).getVariable().getName(); throw new CompilationException(__cmsgs.errCopyFromMessageToNonMessage(rval)); } // If Non-Message->Message copy - else if (ocopy.getTo() instanceof OAssign.VariableRef && ((OAssign.VariableRef) ocopy.getTo()).isMessageRef() - && (!(ocopy.getFrom() instanceof OAssign.VariableRef) || !((OAssign.VariableRef) ocopy.getFrom()).isMessageRef())) { + else if (ocopy.getTo() instanceof OAssign.VariableRef + && ((OAssign.VariableRef) ocopy.getTo()).isMessageRef() + && (!(ocopy.getFrom() instanceof OAssign.VariableRef) + || !((OAssign.VariableRef) ocopy.getFrom()).isMessageRef())) { String lval = ((OAssign.VariableRef) ocopy.getTo()).getVariable().getName(); throw new CompilationException(__cmsgs.errCopyToMessageFromNonMessage(lval)); @@ -174,12 +178,15 @@ class AssignGenerator extends DefaultActivityGenerator { if (((OAssign.PartnerLinkRef) ocopy.getFrom()).isIsMyEndpointReference() && !((OAssign.PartnerLinkRef) ocopy.getFrom()).getPartnerLink().hasMyRole()) { String lval = ((OAssign.PartnerLinkRef) ocopy.getFrom()).getPartnerLink().getName(); - throw new CompilationException(__cmsgs.errCopyFromUndeclaredPartnerRole(lval, "myRole")); + throw new CompilationException( + __cmsgs.errCopyFromUndeclaredPartnerRole(lval, "myRole")); } if (!((OAssign.PartnerLinkRef) ocopy.getFrom()).isIsMyEndpointReference() - && !((OAssign.PartnerLinkRef) ocopy.getFrom()).getPartnerLink().hasPartnerRole()) { + && !((OAssign.PartnerLinkRef) ocopy.getFrom()).getPartnerLink() + .hasPartnerRole()) { String lval = ((OAssign.PartnerLinkRef) ocopy.getFrom()).getPartnerLink().getName(); - throw new CompilationException(__cmsgs.errCopyFromUndeclaredPartnerRole(lval, "partnerRole")); + throw new CompilationException( + __cmsgs.errCopyFromUndeclaredPartnerRole(lval, "partnerRole")); } } @@ -197,7 +204,8 @@ class AssignGenerator extends DefaultActivityGenerator { OAssign.PropertyRef pref = new OAssign.PropertyRef(_context.getOProcess()); PropertyVal pval = from.getAsPropertyVal(); pref.setVariable(_context.resolveVariable(pval.getVariable())); - pref.setPropertyAlias(_context.resolvePropertyAlias(pref.getVariable(), pval.getProperty())); + pref.setPropertyAlias( + _context.resolvePropertyAlias(pref.getVariable(), pval.getProperty())); return pref; } else if (from.isVariableVal()) { VariableVal vv = from.getAsVariableVal(); @@ -209,22 +217,27 @@ class AssignGenerator extends DefaultActivityGenerator { rootNodeType = vref.getPart().getType(); } if (vv.getHeader() != null) { - vref.setHeaderPart(_context.resolveHeaderPart(vref.getVariable(), vv.getHeader())); + vref.setHeaderPart( + _context.resolveHeaderPart(vref.getVariable(), vv.getHeader())); if (vref.getHeaderPart() == null) - vref.setHeaderPart(new org.apache.ode.bpel.obj.OMessageVarType.Part(_context.getOProcess() , vv.getHeader() , null)); + vref.setHeaderPart(new org.apache.ode.bpel.obj.OMessageVarType.Part( + _context.getOProcess(), vv.getHeader(), null)); rootNodeType = vref.getHeaderPart().getType(); } if (vv.getLocation() != null && vv.getLocation().getExpression() != null) - vref.setLocation(_context.compileExpr(vv.getLocation(), rootNodeType, requestedResultType, new java.lang.Object[1])); + vref.setLocation(_context.compileExpr(vv.getLocation(), rootNodeType, + requestedResultType, new java.lang.Object[1])); return vref; } else if (from.isPartnerLinkVal()) { PartnerLinkVal plv = from.getAsPartnerLinkVal(); OAssign.PartnerLinkRef plref = new OAssign.PartnerLinkRef(_context.getOProcess()); plref.setPartnerLink(_context.resolvePartnerLink(plv.getPartnerLink())); - plref.setIsMyEndpointReference((plv.getEndpointReference()) == (org.apache.ode.bpel.compiler.bom.PartnerLinkVal.EndpointReference.MYROLE)); + plref.setIsMyEndpointReference((plv + .getEndpointReference()) == (org.apache.ode.bpel.compiler.bom.PartnerLinkVal.EndpointReference.MYROLE)); return plref; } else if (from.getAsExpression() != null) { - return new OAssign.Expression(_context.getOProcess(), _context.compileExpr(from.getAsExpression(), null, requestedResultType, new Object[1])); + return new OAssign.Expression(_context.getOProcess(), _context.compileExpr( + from.getAsExpression(), null, requestedResultType, new Object[1])); } throw new CompilationException(__cmsgs.errUnkownFromSpec().setSource(from)); @@ -237,8 +250,7 @@ class AssignGenerator extends DefaultActivityGenerator { } /** - * Compile an extension to/from-spec. Extension to/from-specs are compiled into - * "DirectRef"s. + * Compile an extension to/from-spec. Extension to/from-specs are compiled into "DirectRef"s. * * @param extVal source representation * @return compiled representation @@ -265,7 +277,8 @@ class AssignGenerator extends DefaultActivityGenerator { if (to.isPropertyVal()) { OAssign.PropertyRef pref = new OAssign.PropertyRef(_context.getOProcess()); pref.setVariable(_context.resolveVariable(to.getAsPropertyVal().getVariable())); - pref.setPropertyAlias(_context.resolvePropertyAlias(pref.getVariable(), to.getAsPropertyVal().getProperty())); + pref.setPropertyAlias(_context.resolvePropertyAlias(pref.getVariable(), + to.getAsPropertyVal().getProperty())); return pref; } else if (to.isVariableVal()) { VariableVal vv = to.getAsVariableVal(); @@ -277,22 +290,26 @@ class AssignGenerator extends DefaultActivityGenerator { rootNodeType = vref.getPart().getType(); } if (to.getAsVariableVal().getHeader() != null) { - vref.setHeaderPart(_context.resolveHeaderPart(vref.getVariable(), vv.getHeader())); + vref.setHeaderPart( + _context.resolveHeaderPart(vref.getVariable(), vv.getHeader())); if (vref.getHeaderPart() == null) - vref.setHeaderPart(new org.apache.ode.bpel.obj.OMessageVarType.Part(_context.getOProcess() , to.getAsVariableVal().getHeader() , null)); + vref.setHeaderPart(new org.apache.ode.bpel.obj.OMessageVarType.Part( + _context.getOProcess(), to.getAsVariableVal().getHeader(), null)); rootNodeType = vref.getHeaderPart().getType(); } resultType[0] = rootNodeType; if (vv.getLocation() != null && vv.getLocation().getExpression() != null) - vref.setLocation(_context.compileExpr(vv.getLocation(), rootNodeType, null, resultType)); + vref.setLocation( + _context.compileExpr(vv.getLocation(), rootNodeType, null, resultType)); return vref; } else if (to.isPartnerLinkVal()) { OAssign.PartnerLinkRef plref = new OAssign.PartnerLinkRef(_context.getOProcess()); - plref.setPartnerLink(_context.resolvePartnerLink(to.getAsPartnerLinkVal().getPartnerLink())); + plref.setPartnerLink( + _context.resolvePartnerLink(to.getAsPartnerLinkVal().getPartnerLink())); return plref; - } else if (to.getAsExpression() != null){ - return new OAssign.LValueExpression(_context.getOProcess(), _context - .compileLValueExpr(to.getAsExpression(), null, null, resultType)); + } else if (to.getAsExpression() != null) { + return new OAssign.LValueExpression(_context.getOProcess(), + _context.compileLValueExpr(to.getAsExpression(), null, null, resultType)); } throw new CompilationException(__cmsgs.errUnknownToSpec().setSource(to)); http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGeneratorMessages.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGeneratorMessages.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGeneratorMessages.java index abef091..9dfa81e 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGeneratorMessages.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGeneratorMessages.java @@ -86,18 +86,21 @@ public class AssignGeneratorMessages extends CompilationMessageBundle { return this.formatCompilationMessage("To-spec format is unrecognized."); } - /**ExtensionAssignOperation's nested element missing*/ - public CompilationMessage errMissingExtensionAssignOperationElement(){ - return this.formatCompilationMessage("Extensibility element in <extensionAssignOperation> is missing."); + /** ExtensionAssignOperation's nested element missing */ + public CompilationMessage errMissingExtensionAssignOperationElement() { + return this.formatCompilationMessage( + "Extensibility element in <extensionAssignOperation> is missing."); } - /**ExtensionAssignOperation's nested element missing*/ - public CompilationMessage errUndeclaredExtensionAssignOperation(){ - return this.formatCompilationMessage("Extension namespace of <extensionAssignOperation> has not been declared."); + /** ExtensionAssignOperation's nested element missing */ + public CompilationMessage errUndeclaredExtensionAssignOperation() { + return this.formatCompilationMessage( + "Extension namespace of <extensionAssignOperation> has not been declared."); } - /**Draft extensibleAssign is not supported.*/ - public CompilationMessage errExtensibleAssignNotSupported(){ - return this.formatCompilationMessage("ExtensibleAssign is not supported, please upgrade to BPEL 2.0 final."); + /** Draft extensibleAssign is not supported. */ + public CompilationMessage errExtensibleAssignNotSupported() { + return this.formatCompilationMessage( + "ExtensibleAssign is not supported, please upgrade to BPEL 2.0 final."); } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java index b29580a..ef4a876 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java @@ -737,9 +737,9 @@ public abstract class BpelCompiler implements CompilerContext { } // compile extensions - for (Extension e : _processDef.getExtensions()) { - compileExtension(e); - } + for (Extension e : _processDef.getExtensions()) { + compileExtension(e); + } OScope procesScope = new OScope(_oprocess, null); procesScope.setName("__PROCESS_SCOPE:" + (process.getName())); @@ -1637,39 +1637,38 @@ public abstract class BpelCompiler implements CompilerContext { if (act instanceof OAssign) { OAssign assign = (OAssign) act; for (OAssign.OAssignOperation operation : assign.getOperations()) { - if (operation instanceof OAssign.Copy) { - OAssign.Copy copy = (OAssign.Copy) operation; - if (copy.getTo() instanceof OAssign.PartnerLinkRef) { - if (((OAssign.PartnerLinkRef) copy.getTo()).getPartnerLink() - .getName().equals(plink)) - return true; - } - } - } + if (operation instanceof OAssign.Copy) { + OAssign.Copy copy = (OAssign.Copy) operation; + if (copy.getTo() instanceof OAssign.PartnerLinkRef) { + if (((OAssign.PartnerLinkRef) copy.getTo()).getPartnerLink().getName() + .equals(plink)) + return true; + } + } + } } } return false; } /** - * Registers a declared extension. Since compilation may take place - * independently of the target engine configuration, the compiler will not - * check whether a extension implementation is registered. - */ - private void compileExtension(Extension ext) { - OProcess.OExtension oextension = new OProcess.OExtension(_oprocess); - oextension.setNamespace(ext.getNamespaceURI()); - oextension.setMustUnderstand(ext.isMustUnderstand()); + * Registers a declared extension. Since compilation may take place independently of the target + * engine configuration, the compiler will not check whether a extension implementation is + * registered. + */ + private void compileExtension(Extension ext) { + OProcess.OExtension oextension = new OProcess.OExtension(_oprocess); + oextension.setNamespace(ext.getNamespaceURI()); + oextension.setMustUnderstand(ext.isMustUnderstand()); - oextension.setDebugInfo(createDebugInfo(_processDef, - "Extension " + ext.getNamespaceURI())); + oextension.setDebugInfo(createDebugInfo(_processDef, "Extension " + ext.getNamespaceURI())); - _declaredExtensionNS.add(ext.getNamespaceURI()); - _oprocess.getDeclaredExtensions().add(oextension); + _declaredExtensionNS.add(ext.getNamespaceURI()); + _oprocess.getDeclaredExtensions().add(oextension); - if (__log.isDebugEnabled()) - __log.debug("Compiled extension " + oextension); - } + if (__log.isDebugEnabled()) + __log.debug("Compiled extension " + oextension); + } public Definition[] getWsdlDefinitions() { Definition[] result = new Definition[_wsdlRegistry.getDefinitions().length]; @@ -1747,9 +1746,9 @@ public abstract class BpelCompiler implements CompilerContext { registerExpressionLanguage(expLangUri, (ExpressionCompiler) cls.newInstance()); } - public boolean isExtensionDeclared(String namespace) { - return _declaredExtensionNS.contains(namespace); - } + public boolean isExtensionDeclared(String namespace) { + return _declaredExtensionNS.contains(namespace); + } public List<OActivity> getActivityStack() { ArrayList<OActivity> rval = new ArrayList<OActivity>(_structureStack._stack); http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivityGeneratorMessages.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivityGeneratorMessages.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivityGeneratorMessages.java index 5971bc8..0aaad5a 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivityGeneratorMessages.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivityGeneratorMessages.java @@ -1,20 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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; @@ -25,19 +21,18 @@ import org.apache.ode.bpel.compiler.api.CompilationMessageBundle; /** * @author Tammo van Lessen (University of Stuttgart) */ -public class ExtensionActivityGeneratorMessages extends - CompilationMessageBundle { +public class ExtensionActivityGeneratorMessages extends CompilationMessageBundle { - /** ExtensionActivity is empty. */ - public CompilationMessage errMissingExtensionActivityElement() { - return this - .formatCompilationMessage("Extensibility element in <extensionActivity> is missing."); - } + /** ExtensionActivity is empty. */ + public CompilationMessage errMissingExtensionActivityElement() { + return this.formatCompilationMessage( + "Extensibility element in <extensionActivity> is missing."); + } - /** Extension namespace is not yet declared. */ - public CompilationMessage errUndeclaredExtensionActivity() { - return this - .formatCompilationMessage("Extension namespace of <extensionActivity> has not been declared."); - } + /** Extension namespace is not yet declared. */ + public CompilationMessage errUndeclaredExtensionActivity() { + return this.formatCompilationMessage( + "Extension namespace of <extensionActivity> has not been declared."); + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivtityGenerator.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivtityGenerator.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivtityGenerator.java index 25b298a..1823c49 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivtityGenerator.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivtityGenerator.java @@ -1,20 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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; @@ -34,48 +30,45 @@ import org.w3c.dom.Element; * @author Tammo van Lessen */ public class ExtensionActivtityGenerator extends DefaultActivityGenerator { - private static final ExtensionActivityGeneratorMessages __cmsgs = MessageBundle - .getMessages(ExtensionActivityGeneratorMessages.class); + private static final ExtensionActivityGeneratorMessages __cmsgs = + MessageBundle.getMessages(ExtensionActivityGeneratorMessages.class); - public void compile(OActivity output, Activity srcx) { - ExtensionActivity src = (ExtensionActivity) srcx; - OExtensionActivity oactivity = (OExtensionActivity) output; - Element child = src.getFirstExtensibilityElement(); - try { - if (child == null) { - throw new CompilationException( - __cmsgs.errMissingExtensionActivityElement()); - } - if (!_context.isExtensionDeclared(child.getNamespaceURI())) { - throw new CompilationException(__cmsgs - .errUndeclaredExtensionActivity().setSource(src)); - } - - oactivity.setExtensionName(DOMUtils.getElementQName(child)); - oactivity.setNestedElement(DOMUtils.domToString(child)); + public void compile(OActivity output, Activity srcx) { + ExtensionActivity src = (ExtensionActivity) srcx; + OExtensionActivity oactivity = (OExtensionActivity) output; + Element child = src.getFirstExtensibilityElement(); + try { + if (child == null) { + throw new CompilationException(__cmsgs.errMissingExtensionActivityElement()); + } + if (!_context.isExtensionDeclared(child.getNamespaceURI())) { + throw new CompilationException( + __cmsgs.errUndeclaredExtensionActivity().setSource(src)); + } - compileChildren(oactivity, (ExtensionActivity) src); + oactivity.setExtensionName(DOMUtils.getElementQName(child)); + oactivity.setNestedElement(DOMUtils.domToString(child)); - } catch (CompilationException e) { - _context.recoveredFromError(src, e); - } - } + compileChildren(oactivity, (ExtensionActivity) src); - public OActivity newInstance(Activity src) { - return new OExtensionActivity(_context.getOProcess(), - _context.getCurrent()); - } + } catch (CompilationException e) { + _context.recoveredFromError(src, e); + } + } - protected void compileChildren(OExtensionActivity dest, - CompositeActivity src) { - for (Activity child : src.getActivities()) { - try { - OActivity compiledChild = _context.compile(child); - dest.getChildren().add(compiledChild); - } catch (CompilationException ce) { - _context.recoveredFromError(child, ce); - } - } - } + public OActivity newInstance(Activity src) { + return new OExtensionActivity(_context.getOProcess(), _context.getCurrent()); + } + + protected void compileChildren(OExtensionActivity dest, CompositeActivity src) { + for (Activity child : src.getActivities()) { + try { + OActivity compiledChild = _context.compile(child); + dest.getChildren().add(compiledChild); + } catch (CompilationException ce) { + _context.recoveredFromError(child, ce); + } + } + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/AssignActivity.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/AssignActivity.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/AssignActivity.java index 8c436f4..e9611fc 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/AssignActivity.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/AssignActivity.java @@ -56,25 +56,24 @@ public class AssignActivity extends Activity { } /** - * Get the list of all assign operation entries (<code>copy</code> - * and <code>extensionAssignOperation</code>) for this activity. + * Get the list of all assign operation entries (<code>copy</code> and + * <code>extensionAssignOperation</code>) for this activity. * * @return assign operation entries */ public List<AssignOperation> getOperations() { - //all children objects - List<BpelObject> children = getChildren(BpelObject.class); - - //aggregate only copy and extensionAssignOperation entries - List<AssignOperation> ops = new ArrayList<AssignOperation>(); - for (BpelObject bo: children) { - if ((bo instanceof Copy) - ||(bo instanceof ExtensionAssignOperation)) { - ops.add((AssignOperation)bo); - } - } + // all children objects + List<BpelObject> children = getChildren(BpelObject.class); - return ops; + // aggregate only copy and extensionAssignOperation entries + List<AssignOperation> ops = new ArrayList<AssignOperation>(); + for (BpelObject bo : children) { + if ((bo instanceof Copy) || (bo instanceof ExtensionAssignOperation)) { + ops.add((AssignOperation) bo); + } + } + + return ops; } /** Marker interface for assign operations */ http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java index f2b64aa..f40f8af 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java @@ -131,10 +131,11 @@ public class BpelObjectFactory { _mappings.put(Bpel20QNames.FINAL_EVENTHANDLERS, BpelObject.class); _mappings.put(Bpel20QNames.FINAL_TARGETS,Targets.class); _mappings.put(Bpel20QNames.FINAL_SOURCES,Sources.class); - _mappings.put(Bpel20QNames.FINAL_EXTENSIONS,Extensions.class); - _mappings.put(Bpel20QNames.FINAL_EXTENSION,Extension.class); - _mappings.put(Bpel20QNames.FINAL_EXTENSION_ACTIVITY,ExtensionActivity.class); - _mappings.put(Bpel20QNames.FINAL_EXTENSION_ASSIGN_OPERATION,ExtensionAssignOperation.class); + _mappings.put(Bpel20QNames.FINAL_EXTENSIONS, Extensions.class); + _mappings.put(Bpel20QNames.FINAL_EXTENSION, Extension.class); + _mappings.put(Bpel20QNames.FINAL_EXTENSION_ACTIVITY, ExtensionActivity.class); + _mappings.put(Bpel20QNames.FINAL_EXTENSION_ASSIGN_OPERATION, + ExtensionAssignOperation.class); // // BPEL 2.0 draft Mappings @@ -211,10 +212,10 @@ public class BpelObjectFactory { _mappings.put(Bpel20QNames.TARGETS,Targets.class); _mappings.put(Bpel20QNames.SOURCES,Sources.class); _mappings.put(Bpel20QNames.RDF_LABEL,RdfLabel.class); - _mappings.put(Bpel20QNames.EXTENSIONS,Extensions.class); - _mappings.put(Bpel20QNames.EXTENSION,Extension.class); - _mappings.put(Bpel20QNames.EXTENSION_ACTIVITY,ExtensionActivity.class); - _mappings.put(Bpel20QNames.EXTENSIBLE_ASSIGN,ExtensionAssignOperation.class); + _mappings.put(Bpel20QNames.EXTENSIONS, Extensions.class); + _mappings.put(Bpel20QNames.EXTENSION, Extension.class); + _mappings.put(Bpel20QNames.EXTENSION_ACTIVITY, ExtensionActivity.class); + _mappings.put(Bpel20QNames.EXTENSIBLE_ASSIGN, ExtensionAssignOperation.class); // // BPEL 1.1 Mappings http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extension.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extension.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extension.java index 2a5a755..afaeb2f 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extension.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extension.java @@ -1,20 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.bom; @@ -27,15 +23,15 @@ import org.w3c.dom.Element; */ public class Extension extends BpelObject { - public Extension(Element el) { - super(el); - } + public Extension(Element el) { + super(el); + } - public boolean isMustUnderstand() { - return getAttribute("mustUnderstand", "no").equals("yes"); - } + public boolean isMustUnderstand() { + return getAttribute("mustUnderstand", "no").equals("yes"); + } - public String getNamespaceURI() { - return getAttribute("namespace", null); - } + public String getNamespaceURI() { + return getAttribute("namespace", null); + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java index 575f401..300d6ad 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java @@ -1,20 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.bom; @@ -24,75 +20,74 @@ import java.util.List; import org.w3c.dom.Element; /** - * BOM representation of the BPEL <code><extensionActivity></code> - * activity. The <code><extensionActivity></code> activity contains a - * nested DOM element that represents the actual extension element. According to - * the BPEL 2.0 PR1 specification, the standards elements and standards - * attributes are not located in the extensionActivity element but in the nested - * element. Therefore the convenient access methods for standards - * attributes/elements are overridden to refer to the nested elements. + * BOM representation of the BPEL <code><extensionActivity></code> activity. The + * <code><extensionActivity></code> activity contains a nested DOM element that represents the + * actual extension element. According to the BPEL 2.0 PR1 specification, the standards elements and + * standards attributes are not located in the extensionActivity element but in the nested element. + * Therefore the convenient access methods for standards attributes/elements are overridden to refer + * to the nested elements. * * @author Tammo van Lessen (University of Stuttgart) */ public class ExtensionActivity extends CompositeActivity { - private Activity _childActivity; + private Activity _childActivity; - public ExtensionActivity(Element el) { - super(el); - _childActivity = null; - Element child = getFirstExtensibilityElement(); - if (child != null) { - _childActivity = new Activity(getFirstExtensibilityElement()); - } - } + public ExtensionActivity(Element el) { + super(el); + _childActivity = null; + Element child = getFirstExtensibilityElement(); + if (child != null) { + _childActivity = new Activity(getFirstExtensibilityElement()); + } + } - @Override - public Expression getJoinCondition() { - if (_childActivity == null) { - return null; - } - return _childActivity.getJoinCondition(); - } + @Override + public Expression getJoinCondition() { + if (_childActivity == null) { + return null; + } + return _childActivity.getJoinCondition(); + } - @Override - public List<LinkSource> getLinkSources() { - if (_childActivity == null) { - return Collections.emptyList(); - } - return _childActivity.getLinkSources(); - } + @Override + public List<LinkSource> getLinkSources() { + if (_childActivity == null) { + return Collections.emptyList(); + } + return _childActivity.getLinkSources(); + } - @Override - public List<LinkTarget> getLinkTargets() { - if (_childActivity == null) { - return Collections.emptyList(); - } - return _childActivity.getLinkTargets(); - } + @Override + public List<LinkTarget> getLinkTargets() { + if (_childActivity == null) { + return Collections.emptyList(); + } + return _childActivity.getLinkTargets(); + } - @Override - public String getName() { - if (_childActivity == null) { - return null; - } - return _childActivity.getName(); - } + @Override + public String getName() { + if (_childActivity == null) { + return null; + } + return _childActivity.getName(); + } - @Override - public SuppressJoinFailure getSuppressJoinFailure() { - if (_childActivity == null) { - return SuppressJoinFailure.NOTSET; - } - return _childActivity.getSuppressJoinFailure(); - } + @Override + public SuppressJoinFailure getSuppressJoinFailure() { + if (_childActivity == null) { + return SuppressJoinFailure.NOTSET; + } + return _childActivity.getSuppressJoinFailure(); + } - @Override - public List<Activity> getActivities() { - if (_childActivity == null) { - return Collections.emptyList(); - } + @Override + public List<Activity> getActivities() { + if (_childActivity == null) { + return Collections.emptyList(); + } - return _childActivity.getChildren(Activity.class); - } + return _childActivity.getChildren(Activity.class); + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java index 9356618..f566025 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java @@ -1,20 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.bom; @@ -29,25 +25,25 @@ import org.w3c.dom.NodeList; * @author Tammo van Lessen (University of Stuttgart) */ public class ExtensionAssignOperation extends BpelObject implements AssignOperation { - private Element _childElement; + private Element _childElement; - public ExtensionAssignOperation(Element el) { - super(el); - } + public ExtensionAssignOperation(Element el) { + super(el); + } - public Element getNestedElement() { - if (_childElement == null) { - NodeList nl = getElement().getChildNodes(); - for (int i = 0; i < nl.getLength(); ++i) { - Node node = nl.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE && - !Bpel20QNames.NS_WSBPEL2_0.equals(node.getNamespaceURI())) { - _childElement = (Element) node; - break; - } - } - } - return _childElement; - } + public Element getNestedElement() { + if (_childElement == null) { + NodeList nl = getElement().getChildNodes(); + for (int i = 0; i < nl.getLength(); ++i) { + Node node = nl.item(i); + if (node.getNodeType() == Node.ELEMENT_NODE + && !Bpel20QNames.NS_WSBPEL2_0.equals(node.getNamespaceURI())) { + _childElement = (Element) node; + break; + } + } + } + return _childElement; + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extensions.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extensions.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extensions.java index 5f7365b..f923017 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extensions.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extensions.java @@ -1,20 +1,16 @@ /* - * 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 + * 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 + * 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. + * 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.bom; @@ -27,8 +23,8 @@ import org.w3c.dom.Element; */ public class Extensions extends BpelObject { - public Extensions(Element el) { - super(el); - } + public Extensions(Element el) { + super(el); + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java b/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java index 429783e..efaeeea 100644 --- a/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java +++ b/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java @@ -303,6 +303,6 @@ class MockCompilerContext implements CompilerContext { } public boolean isExtensionDeclared(String namespace) { - return false; + return false; } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java ---------------------------------------------------------------------- diff --git a/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java b/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java index a828086..3ce00fe 100644 --- a/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java +++ b/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java @@ -387,6 +387,6 @@ public class OdeConfigProperties { } public String getExtensionActivityBundles() { - return getProperty(PROP_EXTENSION_BUNDLES); + return getProperty(PROP_EXTENSION_BUNDLES); } }
