You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ch...@apache.org on 2006/02/22 00:40:29 UTC

svn commit: r379627 [6/34] - in /incubator/servicemix/trunk: ./ etc/ sandbox/servicemix-wsn-1.2/src/sa/META-INF/ sandbox/servicemix-wsn-1.2/src/su/META-INF/ servicemix-assembly/ servicemix-assembly/src/main/assembly/ servicemix-assembly/src/main/releas...

Modified: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEDeployer.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEDeployer.java (original)
+++ incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEDeployer.java Tue Feb 21 15:40:05 2006
@@ -1,251 +1,251 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.bpe;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.jbi.management.DeploymentException;
-import javax.wsdl.BindingFault;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Message;
-import javax.wsdl.Part;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.ExtensionRegistry;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-
-import org.apache.servicemix.bpe.util.FileSystemJarInputStream;
-import org.apache.servicemix.common.AbstractDeployer;
-import org.apache.servicemix.common.ServiceUnit;
-
-import org.apache.ode.bped.DeployTypeEnum;
-import org.apache.ode.bped.EventDirector;
-import org.apache.ode.bped.IDeployer;
-import org.apache.ode.util.BPException;
-import org.apache.ode.wsdl.extensions.BPEAction;
-import org.apache.ode.wsdl.extensions.BPEActionSerializer;
-import org.apache.ode.wsdl.extensions.BPEFault;
-import org.apache.ode.wsdl.extensions.BPEFaultSerializer;
-import org.apache.ode.wsdl.extensions.BPEInput;
-import org.apache.ode.wsdl.extensions.BPEInputSerializer;
-import org.apache.ode.wsdl.extensions.BPELProperty;
-import org.apache.ode.wsdl.extensions.BPELPropertyAlias;
-import org.apache.ode.wsdl.extensions.BPELPropertyAliasSerializer;
-import org.apache.ode.wsdl.extensions.BPELPropertySerializer;
-import org.apache.ode.wsdl.extensions.BPEOutput;
-import org.apache.ode.wsdl.extensions.BPEOutputSerializer;
-import org.apache.ode.wsdl.extensions.BPEVariableMap;
-import org.apache.ode.wsdl.extensions.BPEVariableMapSerializer;
-import org.apache.ode.wsdl.extensions.ExtentionConstants;
-
-public class BPEDeployer extends AbstractDeployer {
-
-    protected FilenameFilter filter;
-    
-	public BPEDeployer(BPEComponent component) {
-		super(component);
-        filter = new BpelFilter();
-	}
-
-	public boolean canDeploy(String serviceUnitName, String serviceUnitRootPath) {
-        File[] bpels = new File(serviceUnitRootPath).listFiles(filter);
-        return bpels != null && bpels.length == 1;
-	}
-
-	public ServiceUnit deploy(String serviceUnitName, String serviceUnitRootPath) throws DeploymentException {
-		try {
-			EventDirector ed = ((BPEComponent) component).getEventDirector();
-			IDeployer deployer = ed.getDeployer(DeployTypeEnum.BPEL);
-			deployer.loadDefinition(new FileSystemJarInputStream(new File(serviceUnitRootPath)), false);
-			// Build the Service Unit
-			BPEServiceUnit su = new BPEServiceUnit();
-			su.setComponent(component);
-            su.setName(serviceUnitName);
-            su.setRootPath(serviceUnitRootPath);
-			Definition rootDef = loadMainWsdl(serviceUnitRootPath);
-            checkDefinition(rootDef);
-			for (Iterator it = rootDef.getServices().values().iterator(); it.hasNext();) {
-				Service svc = (Service) it.next();
-				for (Iterator it2 = svc.getPorts().values().iterator(); it2.hasNext();) {
-					Port pt = (Port) it2.next();
-					BPEEndpoint ep = new BPEEndpoint();
-					ep.setServiceUnit(su);
-					ep.setInterfaceName(pt.getBinding().getPortType().getQName());
-					ep.setService(svc.getQName());
-					ep.setEndpoint(pt.getName());
-                    // Retrieve wsdl
-					su.addEndpoint(ep);
-				}
-			}
-			return su;
-		} catch (BPException e) {
-			throw new DeploymentException(e);
-		} catch (IOException e) {
-			throw new DeploymentException(e);
-		} catch (WSDLException e) {
-			throw new DeploymentException(e);
-		}
-	}
-
-	protected void checkDefinition(Definition rootDef) throws DeploymentException {
-        // Check that messages have only one part named "payload"
-        Collection msgs = rootDef.getMessages().values();
-        for (Iterator iter = msgs.iterator(); iter.hasNext();) {
-            Message msg = (Message) iter.next();
-            if (msg.getParts().size() > 1) {
-                throw failure("deploy", 
-                        "WSDL Message '" + msg.getQName() + "' has more than one part", null);
-            } else if (msg.getParts().size() == 1) {
-                Part part = (Part) msg.getParts().values().iterator().next();
-                if (!part.getName().equals(BPEComponent.PART_PAYLOAD)) {
-                    throw failure("deploy", 
-                            "WSDL Message '" + msg.getQName() + "' part should be named 'payload'", null);
-                }
-            }
-        }
-        // Check imported wsdls
-        Collection imports = rootDef.getImports().values();
-        for (Iterator iter = imports.iterator(); iter.hasNext();) {
-            List imps = (List) iter.next();
-            for (Iterator iterator = imps.iterator(); iterator.hasNext();) {
-                Import imp = (Import) iterator.next();
-                checkDefinition(imp.getDefinition());
-            }
-        }
-    }
-
-    private Definition loadMainWsdl(String serviceUnitRootPath) throws WSDLException {
-        File[] bpels = new File(serviceUnitRootPath).listFiles(filter);
-        String bpel = bpels[0].getAbsolutePath();
-        String wsdl = bpel.substring(0, bpel.length() - 4) + "wsdl";
-		WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
-	
-		reader.setFeature("javax.wsdl.verbose",true);
-		reader.setFeature("javax.wsdl.importDocuments",true);
-					
-		reader.setExtensionRegistry(getExtentionRegistry());
-	
-		// Parse the document and include any imported WSDL documents
-		Definition ret = reader.readWSDL(null, wsdl);
-		return ret;
-	}
-	
-	private ExtensionRegistry getExtentionRegistry() {
-		
-		// Use IBM's implementation as a base registry. They have implemented
-		// extensibility objects for SOAP,HTTP,MIME and we should not
-		// loose these functions.
-		ExtensionRegistry er = new com.ibm.wsdl.extensions.PopulatedExtensionRegistry();
-		
-		BPELPropertySerializer bpelPropSerializer = new BPELPropertySerializer();
-		BPELPropertyAliasSerializer bpelPropAliasSerializer = new BPELPropertyAliasSerializer();
-		BPEActionSerializer bpeActionSerializer = new BPEActionSerializer();
-		BPEInputSerializer bpeInputSerializer = new BPEInputSerializer();
-		BPEOutputSerializer bpeOutputSerializer = new BPEOutputSerializer();
-		BPEFaultSerializer bpeFaultSerializer = new BPEFaultSerializer();
-		BPEVariableMapSerializer bpeVariableSerializer = new BPEVariableMapSerializer();
-
-		// Register the BPEL extension points
-		er.registerSerializer(Definition.class,
-						   ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
-						   bpelPropSerializer);
-		er.registerDeserializer(Definition.class,
-							 ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
-							 bpelPropSerializer);
-		er.mapExtensionTypes(Definition.class,
-						  ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
-							BPELProperty.class);
-		er.registerSerializer(Definition.class,
-						   ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
-						   bpelPropAliasSerializer);
-		er.registerDeserializer(Definition.class,
-							 ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
-							 bpelPropAliasSerializer);
-		er.mapExtensionTypes(Definition.class,
-						  ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
-							BPELPropertyAlias.class);
-							
-		// register the BPE extension points
-		er.registerSerializer(BindingOperation.class,
-							ExtentionConstants.Q_ELEM_BPE_ACTION,
-							bpeActionSerializer);
-		er.registerDeserializer(BindingOperation.class,
-							ExtentionConstants.Q_ELEM_BPE_ACTION,
-							bpeActionSerializer);
-		er.mapExtensionTypes(BindingOperation.class,
-							ExtentionConstants.Q_ELEM_BPE_ACTION,
-							BPEAction.class);
-		er.registerSerializer(BindingInput.class,
-							ExtentionConstants.Q_ELEM_BPE_INPUT,
-							bpeInputSerializer);
-		er.registerDeserializer(BindingInput.class,
-							ExtentionConstants.Q_ELEM_BPE_INPUT,
-							bpeInputSerializer);
-		er.mapExtensionTypes(BindingInput.class,
-							ExtentionConstants.Q_ELEM_BPE_INPUT,
-							BPEInput.class);
-		er.registerSerializer(BindingOutput.class,
-							ExtentionConstants.Q_ELEM_BPE_OUTPUT,
-							bpeOutputSerializer);
-		er.registerDeserializer(BindingOutput.class,
-							ExtentionConstants.Q_ELEM_BPE_OUTPUT,
-							bpeOutputSerializer);
-		er.mapExtensionTypes(BindingOutput.class,
-							ExtentionConstants.Q_ELEM_BPE_OUTPUT,
-							BPEOutput.class);	
-		
-		er.registerSerializer(BindingFault.class,
-							ExtentionConstants.Q_ELEM_BPE_FAULT,
-							bpeFaultSerializer);
-		er.registerDeserializer(BindingFault.class,
-							ExtentionConstants.Q_ELEM_BPE_FAULT,
-							bpeFaultSerializer);
-		er.mapExtensionTypes(BindingFault.class,
-							ExtentionConstants.Q_ELEM_BPE_FAULT,
-							BPEFault.class);						
-		
-		er.registerSerializer(Definition.class,
-							ExtentionConstants.Q_ELEM_BPE_VAR,
-							bpeVariableSerializer);
-		er.registerDeserializer(Definition.class,
-							ExtentionConstants.Q_ELEM_BPE_VAR,
-							bpeVariableSerializer);
-		er.mapExtensionTypes(Definition.class,
-							ExtentionConstants.Q_ELEM_BPE_VAR,
-							BPEVariableMap.class);
-							
-		return er;
-	}
-	
-    public static class BpelFilter implements FilenameFilter {
-
-        public boolean accept(File dir, String name) {
-            return name.endsWith(".bpel");
-        }
-        
-    }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.bpe;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jbi.management.DeploymentException;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import org.apache.servicemix.bpe.util.FileSystemJarInputStream;
+import org.apache.servicemix.common.AbstractDeployer;
+import org.apache.servicemix.common.ServiceUnit;
+
+import org.apache.ode.bped.DeployTypeEnum;
+import org.apache.ode.bped.EventDirector;
+import org.apache.ode.bped.IDeployer;
+import org.apache.ode.util.BPException;
+import org.apache.ode.wsdl.extensions.BPEAction;
+import org.apache.ode.wsdl.extensions.BPEActionSerializer;
+import org.apache.ode.wsdl.extensions.BPEFault;
+import org.apache.ode.wsdl.extensions.BPEFaultSerializer;
+import org.apache.ode.wsdl.extensions.BPEInput;
+import org.apache.ode.wsdl.extensions.BPEInputSerializer;
+import org.apache.ode.wsdl.extensions.BPELProperty;
+import org.apache.ode.wsdl.extensions.BPELPropertyAlias;
+import org.apache.ode.wsdl.extensions.BPELPropertyAliasSerializer;
+import org.apache.ode.wsdl.extensions.BPELPropertySerializer;
+import org.apache.ode.wsdl.extensions.BPEOutput;
+import org.apache.ode.wsdl.extensions.BPEOutputSerializer;
+import org.apache.ode.wsdl.extensions.BPEVariableMap;
+import org.apache.ode.wsdl.extensions.BPEVariableMapSerializer;
+import org.apache.ode.wsdl.extensions.ExtentionConstants;
+
+public class BPEDeployer extends AbstractDeployer {
+
+    protected FilenameFilter filter;
+    
+	public BPEDeployer(BPEComponent component) {
+		super(component);
+        filter = new BpelFilter();
+	}
+
+	public boolean canDeploy(String serviceUnitName, String serviceUnitRootPath) {
+        File[] bpels = new File(serviceUnitRootPath).listFiles(filter);
+        return bpels != null && bpels.length == 1;
+	}
+
+	public ServiceUnit deploy(String serviceUnitName, String serviceUnitRootPath) throws DeploymentException {
+		try {
+			EventDirector ed = ((BPEComponent) component).getEventDirector();
+			IDeployer deployer = ed.getDeployer(DeployTypeEnum.BPEL);
+			deployer.loadDefinition(new FileSystemJarInputStream(new File(serviceUnitRootPath)), false);
+			// Build the Service Unit
+			BPEServiceUnit su = new BPEServiceUnit();
+			su.setComponent(component);
+            su.setName(serviceUnitName);
+            su.setRootPath(serviceUnitRootPath);
+			Definition rootDef = loadMainWsdl(serviceUnitRootPath);
+            checkDefinition(rootDef);
+			for (Iterator it = rootDef.getServices().values().iterator(); it.hasNext();) {
+				Service svc = (Service) it.next();
+				for (Iterator it2 = svc.getPorts().values().iterator(); it2.hasNext();) {
+					Port pt = (Port) it2.next();
+					BPEEndpoint ep = new BPEEndpoint();
+					ep.setServiceUnit(su);
+					ep.setInterfaceName(pt.getBinding().getPortType().getQName());
+					ep.setService(svc.getQName());
+					ep.setEndpoint(pt.getName());
+                    // Retrieve wsdl
+					su.addEndpoint(ep);
+				}
+			}
+			return su;
+		} catch (BPException e) {
+			throw new DeploymentException(e);
+		} catch (IOException e) {
+			throw new DeploymentException(e);
+		} catch (WSDLException e) {
+			throw new DeploymentException(e);
+		}
+	}
+
+	protected void checkDefinition(Definition rootDef) throws DeploymentException {
+        // Check that messages have only one part named "payload"
+        Collection msgs = rootDef.getMessages().values();
+        for (Iterator iter = msgs.iterator(); iter.hasNext();) {
+            Message msg = (Message) iter.next();
+            if (msg.getParts().size() > 1) {
+                throw failure("deploy", 
+                        "WSDL Message '" + msg.getQName() + "' has more than one part", null);
+            } else if (msg.getParts().size() == 1) {
+                Part part = (Part) msg.getParts().values().iterator().next();
+                if (!part.getName().equals(BPEComponent.PART_PAYLOAD)) {
+                    throw failure("deploy", 
+                            "WSDL Message '" + msg.getQName() + "' part should be named 'payload'", null);
+                }
+            }
+        }
+        // Check imported wsdls
+        Collection imports = rootDef.getImports().values();
+        for (Iterator iter = imports.iterator(); iter.hasNext();) {
+            List imps = (List) iter.next();
+            for (Iterator iterator = imps.iterator(); iterator.hasNext();) {
+                Import imp = (Import) iterator.next();
+                checkDefinition(imp.getDefinition());
+            }
+        }
+    }
+
+    private Definition loadMainWsdl(String serviceUnitRootPath) throws WSDLException {
+        File[] bpels = new File(serviceUnitRootPath).listFiles(filter);
+        String bpel = bpels[0].getAbsolutePath();
+        String wsdl = bpel.substring(0, bpel.length() - 4) + "wsdl";
+		WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+	
+		reader.setFeature("javax.wsdl.verbose",true);
+		reader.setFeature("javax.wsdl.importDocuments",true);
+					
+		reader.setExtensionRegistry(getExtentionRegistry());
+	
+		// Parse the document and include any imported WSDL documents
+		Definition ret = reader.readWSDL(null, wsdl);
+		return ret;
+	}
+	
+	private ExtensionRegistry getExtentionRegistry() {
+		
+		// Use IBM's implementation as a base registry. They have implemented
+		// extensibility objects for SOAP,HTTP,MIME and we should not
+		// loose these functions.
+		ExtensionRegistry er = new com.ibm.wsdl.extensions.PopulatedExtensionRegistry();
+		
+		BPELPropertySerializer bpelPropSerializer = new BPELPropertySerializer();
+		BPELPropertyAliasSerializer bpelPropAliasSerializer = new BPELPropertyAliasSerializer();
+		BPEActionSerializer bpeActionSerializer = new BPEActionSerializer();
+		BPEInputSerializer bpeInputSerializer = new BPEInputSerializer();
+		BPEOutputSerializer bpeOutputSerializer = new BPEOutputSerializer();
+		BPEFaultSerializer bpeFaultSerializer = new BPEFaultSerializer();
+		BPEVariableMapSerializer bpeVariableSerializer = new BPEVariableMapSerializer();
+
+		// Register the BPEL extension points
+		er.registerSerializer(Definition.class,
+						   ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
+						   bpelPropSerializer);
+		er.registerDeserializer(Definition.class,
+							 ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
+							 bpelPropSerializer);
+		er.mapExtensionTypes(Definition.class,
+						  ExtentionConstants.Q_ELEM_BPEL_PROPERTY,
+							BPELProperty.class);
+		er.registerSerializer(Definition.class,
+						   ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
+						   bpelPropAliasSerializer);
+		er.registerDeserializer(Definition.class,
+							 ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
+							 bpelPropAliasSerializer);
+		er.mapExtensionTypes(Definition.class,
+						  ExtentionConstants.Q_ELEM_BPEL_PROPERTY_ALIAS,
+							BPELPropertyAlias.class);
+							
+		// register the BPE extension points
+		er.registerSerializer(BindingOperation.class,
+							ExtentionConstants.Q_ELEM_BPE_ACTION,
+							bpeActionSerializer);
+		er.registerDeserializer(BindingOperation.class,
+							ExtentionConstants.Q_ELEM_BPE_ACTION,
+							bpeActionSerializer);
+		er.mapExtensionTypes(BindingOperation.class,
+							ExtentionConstants.Q_ELEM_BPE_ACTION,
+							BPEAction.class);
+		er.registerSerializer(BindingInput.class,
+							ExtentionConstants.Q_ELEM_BPE_INPUT,
+							bpeInputSerializer);
+		er.registerDeserializer(BindingInput.class,
+							ExtentionConstants.Q_ELEM_BPE_INPUT,
+							bpeInputSerializer);
+		er.mapExtensionTypes(BindingInput.class,
+							ExtentionConstants.Q_ELEM_BPE_INPUT,
+							BPEInput.class);
+		er.registerSerializer(BindingOutput.class,
+							ExtentionConstants.Q_ELEM_BPE_OUTPUT,
+							bpeOutputSerializer);
+		er.registerDeserializer(BindingOutput.class,
+							ExtentionConstants.Q_ELEM_BPE_OUTPUT,
+							bpeOutputSerializer);
+		er.mapExtensionTypes(BindingOutput.class,
+							ExtentionConstants.Q_ELEM_BPE_OUTPUT,
+							BPEOutput.class);	
+		
+		er.registerSerializer(BindingFault.class,
+							ExtentionConstants.Q_ELEM_BPE_FAULT,
+							bpeFaultSerializer);
+		er.registerDeserializer(BindingFault.class,
+							ExtentionConstants.Q_ELEM_BPE_FAULT,
+							bpeFaultSerializer);
+		er.mapExtensionTypes(BindingFault.class,
+							ExtentionConstants.Q_ELEM_BPE_FAULT,
+							BPEFault.class);						
+		
+		er.registerSerializer(Definition.class,
+							ExtentionConstants.Q_ELEM_BPE_VAR,
+							bpeVariableSerializer);
+		er.registerDeserializer(Definition.class,
+							ExtentionConstants.Q_ELEM_BPE_VAR,
+							bpeVariableSerializer);
+		er.mapExtensionTypes(Definition.class,
+							ExtentionConstants.Q_ELEM_BPE_VAR,
+							BPEVariableMap.class);
+							
+		return er;
+	}
+	
+    public static class BpelFilter implements FilenameFilter {
+
+        public boolean accept(File dir, String name) {
+            return name.endsWith(".bpel");
+        }
+        
+    }
+}

Propchange: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEDeployer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEEndpoint.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEEndpoint.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEEndpoint.java (original)
+++ incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEEndpoint.java Tue Feb 21 15:40:05 2006
@@ -1,160 +1,160 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.bpe;
-
-import javax.jbi.component.ComponentContext;
-import javax.jbi.messaging.DeliveryChannel;
-import javax.jbi.messaging.ExchangeStatus;
-import javax.jbi.messaging.Fault;
-import javax.jbi.messaging.InOnly;
-import javax.jbi.messaging.InOptionalOut;
-import javax.jbi.messaging.InOut;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.jbi.messaging.RobustInOnly;
-import javax.jbi.messaging.MessageExchange.Role;
-import javax.jbi.servicedesc.ServiceEndpoint;
-import javax.xml.transform.dom.DOMSource;
-
-import org.apache.servicemix.common.Endpoint;
-import org.apache.servicemix.common.ExchangeProcessor;
-import org.apache.servicemix.jbi.jaxp.SourceTransformer;
-import org.w3c.dom.Document;
-
-import org.apache.ode.bped.EventDirector;
-import org.apache.ode.client.IFormattableValue;
-import org.apache.ode.event.BPELStaticKey;
-import org.apache.ode.event.IResponseMessage;
-import org.apache.ode.event.SimpleRequestMessageEvent;
-import org.apache.ode.interaction.IInteraction;
-import org.apache.ode.interaction.InvocationFactory;
-import org.apache.ode.interaction.XMLInteractionObject;
-import org.apache.ode.scope.service.BPRuntimeException;
-
-public class BPEEndpoint extends Endpoint implements ExchangeProcessor {
-
-    protected ServiceEndpoint activated;
-    protected DeliveryChannel channel;
-    protected SourceTransformer transformer = new SourceTransformer();
-	
-	public Role getRole() {
-		return Role.PROVIDER;
-	}
-
-	public void activate() throws Exception {
-        logger = this.serviceUnit.getComponent().getLogger();
-        ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
-        activated = ctx.activateEndpoint(service, endpoint);
-        channel = ctx.getDeliveryChannel();
-	}
-
-	public void deactivate() throws Exception {
-        ServiceEndpoint ep = activated;
-        activated = null;
-        ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
-        ctx.deactivateEndpoint(ep);
-	}
-
-	public ExchangeProcessor getProcessor() {
-		return this;
-	}
-
-	public void process(MessageExchange exchange) throws Exception {
-        if (exchange.getStatus() == ExchangeStatus.DONE) {
-            return;
-        } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
-            exchange.setStatus(ExchangeStatus.DONE);
-            channel.send(exchange);
-            return;
-        }
-		BPELStaticKey bsk = new BPELStaticKey();
-		bsk.setTargetNamespace(getInterfaceName().getNamespaceURI());
-		bsk.setPortType(getInterfaceName().getLocalPart());
-		if (exchange.getOperation() != null) {
-			bsk.setOperation(exchange.getOperation().getLocalPart());
-		}
-		SimpleRequestMessageEvent msg = new SimpleRequestMessageEvent();
-		msg.setStaticKey(bsk);
-		XMLInteractionObject interaction = new XMLInteractionObject();
-		interaction.setDocument((Document) transformer.toDOMNode(exchange.getMessage("in")));
-		msg.setPart(BPEComponent.PART_PAYLOAD, interaction);
-        
-        EventDirector ed = ((BPEComponent) getServiceUnit().getComponent()).getEventDirector();
-        try {
-            IResponseMessage response = ed.sendEvent(msg, true);
-            IInteraction payload = response.getPart(BPEComponent.PART_PAYLOAD);
-            if (response.getFault() != null) {
-                Exception e = response.getFault().getFaultException();
-                if (e != null) {
-                    throw e;
-                }
-                // TODO: handle simple fault
-                throw new BPRuntimeException(response.getFault().getFaultString(), "");
-            } else if (exchange instanceof InOnly || exchange instanceof RobustInOnly) {
-                if (payload != null) {
-                    throw new UnsupportedOperationException("Did not expect return value for in-only or robust-in-only");
-                }
-                exchange.setStatus(ExchangeStatus.DONE);
-                channel.send(exchange);
-            } else if (exchange instanceof InOptionalOut) {
-                if (payload == null) {
-                    exchange.setStatus(ExchangeStatus.DONE);
-                    channel.send(exchange);
-                } else {
-                    IFormattableValue value = (IFormattableValue) payload.invoke(InvocationFactory.newInstance().createGetObjectInvocation());
-                    Document doc = (Document) value.getValueAs(Document.class);
-                    NormalizedMessage out = exchange.createMessage();
-                    out.setContent(new DOMSource(doc));
-                    exchange.setMessage(out, "out");
-                    channel.send(exchange);
-                }
-            } else if (exchange instanceof InOut) {
-                if (payload == null) {
-                    throw new UnsupportedOperationException("Expected return data for in-out"); 
-                }
-                IFormattableValue value = (IFormattableValue) payload.invoke(InvocationFactory.newInstance().createGetObjectInvocation());
-                Document doc = (Document) value.getValueAs(Document.class);
-                NormalizedMessage out = exchange.createMessage();
-                out.setContent(new DOMSource(doc));
-                exchange.setMessage(out, "out");
-                channel.send(exchange);
-            } else {
-                throw new UnsupportedOperationException("Unhandled mep: " + exchange.getPattern());
-            }
-        } catch (BPRuntimeException e) {
-            IInteraction payload = (IInteraction) e.getPartMessage(BPEComponent.PART_PAYLOAD);
-            if (payload != null) {
-                Fault fault = exchange.createFault();
-                IFormattableValue value = (IFormattableValue) payload.invoke(InvocationFactory.newInstance().createGetObjectInvocation());
-                Document doc = (Document) value.getValueAs(Document.class);
-                fault.setContent(new DOMSource(doc));
-                exchange.setFault(fault);
-            } else {
-                exchange.setError(e);
-            }
-            exchange.setStatus(ExchangeStatus.ERROR);
-            channel.send(exchange);
-        }
-	}
-
-	public void start() throws Exception {
-	}
-
-	public void stop() throws Exception {
-	}
-
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.bpe;
+
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.Fault;
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.InOptionalOut;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.jbi.messaging.RobustInOnly;
+import javax.jbi.messaging.MessageExchange.Role;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.transform.dom.DOMSource;
+
+import org.apache.servicemix.common.Endpoint;
+import org.apache.servicemix.common.ExchangeProcessor;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.w3c.dom.Document;
+
+import org.apache.ode.bped.EventDirector;
+import org.apache.ode.client.IFormattableValue;
+import org.apache.ode.event.BPELStaticKey;
+import org.apache.ode.event.IResponseMessage;
+import org.apache.ode.event.SimpleRequestMessageEvent;
+import org.apache.ode.interaction.IInteraction;
+import org.apache.ode.interaction.InvocationFactory;
+import org.apache.ode.interaction.XMLInteractionObject;
+import org.apache.ode.scope.service.BPRuntimeException;
+
+public class BPEEndpoint extends Endpoint implements ExchangeProcessor {
+
+    protected ServiceEndpoint activated;
+    protected DeliveryChannel channel;
+    protected SourceTransformer transformer = new SourceTransformer();
+	
+	public Role getRole() {
+		return Role.PROVIDER;
+	}
+
+	public void activate() throws Exception {
+        logger = this.serviceUnit.getComponent().getLogger();
+        ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
+        activated = ctx.activateEndpoint(service, endpoint);
+        channel = ctx.getDeliveryChannel();
+	}
+
+	public void deactivate() throws Exception {
+        ServiceEndpoint ep = activated;
+        activated = null;
+        ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
+        ctx.deactivateEndpoint(ep);
+	}
+
+	public ExchangeProcessor getProcessor() {
+		return this;
+	}
+
+	public void process(MessageExchange exchange) throws Exception {
+        if (exchange.getStatus() == ExchangeStatus.DONE) {
+            return;
+        } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+            exchange.setStatus(ExchangeStatus.DONE);
+            channel.send(exchange);
+            return;
+        }
+		BPELStaticKey bsk = new BPELStaticKey();
+		bsk.setTargetNamespace(getInterfaceName().getNamespaceURI());
+		bsk.setPortType(getInterfaceName().getLocalPart());
+		if (exchange.getOperation() != null) {
+			bsk.setOperation(exchange.getOperation().getLocalPart());
+		}
+		SimpleRequestMessageEvent msg = new SimpleRequestMessageEvent();
+		msg.setStaticKey(bsk);
+		XMLInteractionObject interaction = new XMLInteractionObject();
+		interaction.setDocument((Document) transformer.toDOMNode(exchange.getMessage("in")));
+		msg.setPart(BPEComponent.PART_PAYLOAD, interaction);
+        
+        EventDirector ed = ((BPEComponent) getServiceUnit().getComponent()).getEventDirector();
+        try {
+            IResponseMessage response = ed.sendEvent(msg, true);
+            IInteraction payload = response.getPart(BPEComponent.PART_PAYLOAD);
+            if (response.getFault() != null) {
+                Exception e = response.getFault().getFaultException();
+                if (e != null) {
+                    throw e;
+                }
+                // TODO: handle simple fault
+                throw new BPRuntimeException(response.getFault().getFaultString(), "");
+            } else if (exchange instanceof InOnly || exchange instanceof RobustInOnly) {
+                if (payload != null) {
+                    throw new UnsupportedOperationException("Did not expect return value for in-only or robust-in-only");
+                }
+                exchange.setStatus(ExchangeStatus.DONE);
+                channel.send(exchange);
+            } else if (exchange instanceof InOptionalOut) {
+                if (payload == null) {
+                    exchange.setStatus(ExchangeStatus.DONE);
+                    channel.send(exchange);
+                } else {
+                    IFormattableValue value = (IFormattableValue) payload.invoke(InvocationFactory.newInstance().createGetObjectInvocation());
+                    Document doc = (Document) value.getValueAs(Document.class);
+                    NormalizedMessage out = exchange.createMessage();
+                    out.setContent(new DOMSource(doc));
+                    exchange.setMessage(out, "out");
+                    channel.send(exchange);
+                }
+            } else if (exchange instanceof InOut) {
+                if (payload == null) {
+                    throw new UnsupportedOperationException("Expected return data for in-out"); 
+                }
+                IFormattableValue value = (IFormattableValue) payload.invoke(InvocationFactory.newInstance().createGetObjectInvocation());
+                Document doc = (Document) value.getValueAs(Document.class);
+                NormalizedMessage out = exchange.createMessage();
+                out.setContent(new DOMSource(doc));
+                exchange.setMessage(out, "out");
+                channel.send(exchange);
+            } else {
+                throw new UnsupportedOperationException("Unhandled mep: " + exchange.getPattern());
+            }
+        } catch (BPRuntimeException e) {
+            IInteraction payload = (IInteraction) e.getPartMessage(BPEComponent.PART_PAYLOAD);
+            if (payload != null) {
+                Fault fault = exchange.createFault();
+                IFormattableValue value = (IFormattableValue) payload.invoke(InvocationFactory.newInstance().createGetObjectInvocation());
+                Document doc = (Document) value.getValueAs(Document.class);
+                fault.setContent(new DOMSource(doc));
+                exchange.setFault(fault);
+            } else {
+                exchange.setError(e);
+            }
+            exchange.setStatus(ExchangeStatus.ERROR);
+            channel.send(exchange);
+        }
+	}
+
+	public void start() throws Exception {
+	}
+
+	public void stop() throws Exception {
+	}
+
+
+}

Propchange: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPELifeCycle.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPELifeCycle.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPELifeCycle.java (original)
+++ incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPELifeCycle.java Tue Feb 21 15:40:05 2006
@@ -1,46 +1,46 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.bpe;
-
-import org.apache.servicemix.common.BaseComponent;
-import org.apache.servicemix.common.BaseLifeCycle;
-
-import org.apache.ode.bped.EventDirector;
-import org.apache.ode.bped.EventDirectorFactory;
-import org.apache.ode.util.BPEProperties;
-
-public class BPELifeCycle extends BaseLifeCycle {
-
-    public static final String IM_ENGINE_PROPERTY_FILE_NAME = "bpeEngine.properties";
-    
-    private EventDirector eventDirector;
-    
-	public BPELifeCycle(BaseComponent component) {
-		super(component);
-	}
-
-    public EventDirector getEventDirector() {
-        return eventDirector;
-    }
-
-    protected void doInit() throws Exception {
-        BPEProperties props = BPEProperties.getCachedProperties();
-        props.load(getClass().getClassLoader().getResourceAsStream(IM_ENGINE_PROPERTY_FILE_NAME));
-        eventDirector = EventDirectorFactory.createEventDirector(props);
-        super.doInit();
-    }
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.bpe;
+
+import org.apache.servicemix.common.BaseComponent;
+import org.apache.servicemix.common.BaseLifeCycle;
+
+import org.apache.ode.bped.EventDirector;
+import org.apache.ode.bped.EventDirectorFactory;
+import org.apache.ode.util.BPEProperties;
+
+public class BPELifeCycle extends BaseLifeCycle {
+
+    public static final String IM_ENGINE_PROPERTY_FILE_NAME = "bpeEngine.properties";
+    
+    private EventDirector eventDirector;
+    
+	public BPELifeCycle(BaseComponent component) {
+		super(component);
+	}
+
+    public EventDirector getEventDirector() {
+        return eventDirector;
+    }
+
+    protected void doInit() throws Exception {
+        BPEProperties props = BPEProperties.getCachedProperties();
+        props.load(getClass().getClassLoader().getResourceAsStream(IM_ENGINE_PROPERTY_FILE_NAME));
+        eventDirector = EventDirectorFactory.createEventDirector(props);
+        super.doInit();
+    }
+
+}

Propchange: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPELifeCycle.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEServiceUnit.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEServiceUnit.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEServiceUnit.java (original)
+++ incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEServiceUnit.java Tue Feb 21 15:40:05 2006
@@ -1,22 +1,22 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.bpe;
-
-import org.apache.servicemix.common.ServiceUnit;
-
-public class BPEServiceUnit extends ServiceUnit {
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.bpe;
+
+import org.apache.servicemix.common.ServiceUnit;
+
+public class BPEServiceUnit extends ServiceUnit {
+
+}

Propchange: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/BPEServiceUnit.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/external/JbiExternalAction.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/external/JbiExternalAction.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/external/JbiExternalAction.java (original)
+++ incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/external/JbiExternalAction.java Tue Feb 21 15:40:05 2006
@@ -1,130 +1,130 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.bpe.external;
-
-import java.util.Enumeration;
-import java.util.Properties;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.ode.action.bpel.ExternalServiceAction;
-import org.apache.ode.context.resolver.ContextResolver;
-import org.apache.ode.definition.IPMDProcess;
-import org.apache.ode.deployment.bpel.BPELAttributes;
-import org.apache.ode.deployment.bpel.WSDLOperationKey;
-import org.apache.ode.engine.IEvaluationContext;
-import org.apache.ode.engine.IProcessCallBack;
-import org.apache.ode.instance.IPMIProcess;
-import org.apache.ode.util.BPException;
-
-public class JbiExternalAction extends ExternalServiceAction {
-
-    private static Log log = LogFactory.getLog(JbiExternalAction.class);
-    
-    public static final String SM_NS = "http://servicemix.apache.org/schemas/bpe/1.0";
-    
-    public static final String SM_ENDPOINT = "endpoint";
-    public static final String SM_SERVICE = "service";
-    public static final String SM_MEP = "mep";
-    
-    public JbiExternalAction() {
-        super();
-    }
-    
-    public void init(Properties props) throws BPException {
-        if (log.isDebugEnabled()) {
-            log.debug("init");
-        }
-        extractInformations(props);
-        // Do not store informations about operation
-        props.remove(ExternalServiceAction.OPERATION_KEY);
-        super.init(props);
-        if (log.isDebugEnabled()) {
-            log.debug("properties: " + props);
-        }
-    }
-    
-    protected void extractInformations(Properties properties) {
-        Properties extProps = (Properties) properties.get(EXT_ACTION_PROPS);
-        BPELAttributes attrs = (BPELAttributes) properties.get(INVOKE_ATTRIBUTES);
-        WSDLOperationKey opKey = (WSDLOperationKey) properties.get(ExternalServiceAction.OPERATION_KEY);
-        extProps.setProperty(JbiInvokeAction.INTERFACE_NAMESPACE, opKey.getNameSpace());
-        extProps.setProperty(JbiInvokeAction.INTERFACE_LOCALNAME, opKey.getPortType());
-        extProps.setProperty(JbiInvokeAction.OPERATION_NAMESPACE, opKey.getNameSpace());
-        extProps.setProperty(JbiInvokeAction.OPERATION_LOCALNAME, opKey.getOperationName());
-        for (Enumeration en = attrs.propertyNames(); en.hasMoreElements();) {
-            String qn = (String) en.nextElement();
-            String uri = attrs.getURI(qn);
-            String val = attrs.getProperty(qn);
-            if (SM_NS.equals(uri)) {
-                if (qn.indexOf(':') > 0) {
-                    qn = qn.substring(qn.indexOf(':') + 1);
-                }
-                if (SM_ENDPOINT.equals(qn)) {
-                    String[] parts = split3(val);
-                    extProps.setProperty(JbiInvokeAction.SERVICE_NAMESPACE, parts[0]);
-                    extProps.setProperty(JbiInvokeAction.SERVICE_LOCALNAME, parts[1]);
-                    extProps.setProperty(JbiInvokeAction.ENDPOINT_NAME, parts[2]);
-                } else if (SM_SERVICE.equals(qn)) {
-                    String[] parts = split2(val);
-                    extProps.setProperty(JbiInvokeAction.SERVICE_NAMESPACE, parts[0]);
-                    extProps.setProperty(JbiInvokeAction.SERVICE_LOCALNAME, parts[1]);
-                } else if (SM_MEP.equals(qn)) {
-                    extProps.setProperty(JbiInvokeAction.MEP, val);
-                }
-            }
-        }
-    }
-
-    protected String[] split3(String uri) {
-        char sep;
-        if (uri.indexOf('/') > 0) {
-            sep = '/';
-        } else {
-            sep = ':';
-        }
-        int idx1 = uri.lastIndexOf(sep);
-        int idx2 = uri.lastIndexOf(sep, idx1 - 1);
-        String epName = uri.substring(idx1 + 1);
-        String svcName = uri.substring(idx2 + 1, idx1);
-        String nsUri   = uri.substring(0, idx2);
-        return new String[] { nsUri, svcName, epName };
-    }
-    
-    protected String[] split2(String uri) {
-        char sep;
-        if (uri.indexOf('/') > 0) {
-            sep = '/';
-        } else {
-            sep = ':';
-        }
-        int idx1 = uri.lastIndexOf(sep);
-        String svcName = uri.substring(idx1 + 1);
-        String nsUri   = uri.substring(0, idx1);
-        return new String[] { nsUri, svcName };
-    }
-    
-    public boolean execute(
-            ContextResolver resolver,
-            IEvaluationContext ec,
-            IProcessCallBack pcb,
-            IPMIProcess processInstance,
-            IPMDProcess processDefinition)
-            throws BPException {
-        return super.execute(resolver, ec, pcb, processInstance, processDefinition);
-    }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.bpe.external;
+
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.ode.action.bpel.ExternalServiceAction;
+import org.apache.ode.context.resolver.ContextResolver;
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.deployment.bpel.BPELAttributes;
+import org.apache.ode.deployment.bpel.WSDLOperationKey;
+import org.apache.ode.engine.IEvaluationContext;
+import org.apache.ode.engine.IProcessCallBack;
+import org.apache.ode.instance.IPMIProcess;
+import org.apache.ode.util.BPException;
+
+public class JbiExternalAction extends ExternalServiceAction {
+
+    private static Log log = LogFactory.getLog(JbiExternalAction.class);
+    
+    public static final String SM_NS = "http://servicemix.apache.org/schemas/bpe/1.0";
+    
+    public static final String SM_ENDPOINT = "endpoint";
+    public static final String SM_SERVICE = "service";
+    public static final String SM_MEP = "mep";
+    
+    public JbiExternalAction() {
+        super();
+    }
+    
+    public void init(Properties props) throws BPException {
+        if (log.isDebugEnabled()) {
+            log.debug("init");
+        }
+        extractInformations(props);
+        // Do not store informations about operation
+        props.remove(ExternalServiceAction.OPERATION_KEY);
+        super.init(props);
+        if (log.isDebugEnabled()) {
+            log.debug("properties: " + props);
+        }
+    }
+    
+    protected void extractInformations(Properties properties) {
+        Properties extProps = (Properties) properties.get(EXT_ACTION_PROPS);
+        BPELAttributes attrs = (BPELAttributes) properties.get(INVOKE_ATTRIBUTES);
+        WSDLOperationKey opKey = (WSDLOperationKey) properties.get(ExternalServiceAction.OPERATION_KEY);
+        extProps.setProperty(JbiInvokeAction.INTERFACE_NAMESPACE, opKey.getNameSpace());
+        extProps.setProperty(JbiInvokeAction.INTERFACE_LOCALNAME, opKey.getPortType());
+        extProps.setProperty(JbiInvokeAction.OPERATION_NAMESPACE, opKey.getNameSpace());
+        extProps.setProperty(JbiInvokeAction.OPERATION_LOCALNAME, opKey.getOperationName());
+        for (Enumeration en = attrs.propertyNames(); en.hasMoreElements();) {
+            String qn = (String) en.nextElement();
+            String uri = attrs.getURI(qn);
+            String val = attrs.getProperty(qn);
+            if (SM_NS.equals(uri)) {
+                if (qn.indexOf(':') > 0) {
+                    qn = qn.substring(qn.indexOf(':') + 1);
+                }
+                if (SM_ENDPOINT.equals(qn)) {
+                    String[] parts = split3(val);
+                    extProps.setProperty(JbiInvokeAction.SERVICE_NAMESPACE, parts[0]);
+                    extProps.setProperty(JbiInvokeAction.SERVICE_LOCALNAME, parts[1]);
+                    extProps.setProperty(JbiInvokeAction.ENDPOINT_NAME, parts[2]);
+                } else if (SM_SERVICE.equals(qn)) {
+                    String[] parts = split2(val);
+                    extProps.setProperty(JbiInvokeAction.SERVICE_NAMESPACE, parts[0]);
+                    extProps.setProperty(JbiInvokeAction.SERVICE_LOCALNAME, parts[1]);
+                } else if (SM_MEP.equals(qn)) {
+                    extProps.setProperty(JbiInvokeAction.MEP, val);
+                }
+            }
+        }
+    }
+
+    protected String[] split3(String uri) {
+        char sep;
+        if (uri.indexOf('/') > 0) {
+            sep = '/';
+        } else {
+            sep = ':';
+        }
+        int idx1 = uri.lastIndexOf(sep);
+        int idx2 = uri.lastIndexOf(sep, idx1 - 1);
+        String epName = uri.substring(idx1 + 1);
+        String svcName = uri.substring(idx2 + 1, idx1);
+        String nsUri   = uri.substring(0, idx2);
+        return new String[] { nsUri, svcName, epName };
+    }
+    
+    protected String[] split2(String uri) {
+        char sep;
+        if (uri.indexOf('/') > 0) {
+            sep = '/';
+        } else {
+            sep = ':';
+        }
+        int idx1 = uri.lastIndexOf(sep);
+        String svcName = uri.substring(idx1 + 1);
+        String nsUri   = uri.substring(0, idx1);
+        return new String[] { nsUri, svcName };
+    }
+    
+    public boolean execute(
+            ContextResolver resolver,
+            IEvaluationContext ec,
+            IProcessCallBack pcb,
+            IPMIProcess processInstance,
+            IPMDProcess processDefinition)
+            throws BPException {
+        return super.execute(resolver, ec, pcb, processInstance, processDefinition);
+    }
+}

Propchange: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/external/JbiExternalAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/external/JbiInvokeAction.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/external/JbiInvokeAction.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/external/JbiInvokeAction.java (original)
+++ incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/external/JbiInvokeAction.java Tue Feb 21 15:40:05 2006
@@ -1,290 +1,290 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.bpe.external;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Properties;
-
-import javax.jbi.messaging.DeliveryChannel;
-import javax.jbi.messaging.ExchangeStatus;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessageExchangeFactory;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.xml.namespace.QName;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.servicemix.bpe.BPEComponent;
-import org.apache.servicemix.bpe.BPELifeCycle;
-import org.apache.servicemix.common.ExchangeProcessor;
-import org.apache.servicemix.jbi.jaxp.BytesSource;
-import org.apache.servicemix.jbi.jaxp.SourceTransformer;
-import org.apache.servicemix.jbi.jaxp.StringSource;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import org.apache.ode.action.external.ActionSystemException;
-import org.apache.ode.action.external.IExternalAction;
-import org.apache.ode.action.external.IURIResolver;
-import org.apache.ode.client.IFormattableValue;
-import org.apache.ode.interaction.XMLInteractionObject;
-import org.apache.ode.scope.service.BPRuntimeException;
-
-public class JbiInvokeAction implements IExternalAction, ExchangeProcessor {
-
-    public static final String INTERFACE_NAMESPACE = "interfaceNamespace";
-    public static final String INTERFACE_LOCALNAME = "interfaceLocalName";
-    public static final String OPERATION_NAMESPACE = "operationNamespace";
-    public static final String OPERATION_LOCALNAME = "operationLocalName";
-    public static final String SERVICE_NAMESPACE = "serviceNamespace";
-    public static final String SERVICE_LOCALNAME = "serviceLocalName";
-    public static final String ENDPOINT_NAME = "endpointName";
-    public static final String ACTION = "action";
-    public static final String ENDPOINT = "endpoint";
-    public static final String MEP = "mep";
-    
-    private static Log log = LogFactory.getLog(JbiInvokeAction.class);
-    
-    private Properties properties;
-    private DeliveryChannel channel;
-    private MessageExchangeFactory factory;
-    private BPEComponent component;
-    private QName interfaceName;
-    private QName serviceName;
-    private String endpointName;
-    private QName operationName;
-    private URI mep;
-    private SourceTransformer transformer;
-    
-	/**
-	 * Generated serial version UID
-	 */
-	private static final long serialVersionUID = -8522450752525724302L;
-    
-    public JbiInvokeAction() {
-        transformer = new SourceTransformer();
-    }
-
-	public void init(Properties props) throws BPRuntimeException, ActionSystemException {
-        if (log.isDebugEnabled()) {
-            log.debug("init");
-        }
-        this.properties = props;
-        component = BPEComponent.getInstance();
-        if (component == null) {
-            throw new BPRuntimeException("BPEComponent has not been created", "");
-        }
-        try {
-            channel = ((BPELifeCycle) component.getLifeCycle()).getContext().getDeliveryChannel();
-            factory = channel.createExchangeFactory();
-        } catch (MessagingException e) {
-            throw new BPRuntimeException("Could not retrieve DeliveryChannel", e);
-        } 
-        extractInformations();
-        if (serviceName == null && interfaceName == null) { 
-            throw new BPRuntimeException("Interface, Service or Endpoint should be specified", "");
-        }
-        if (log.isDebugEnabled()) {
-            log.debug("properties: " + props);
-        }
-	}
-
-	protected void extractInformations() {
-        String action = properties.getProperty(ACTION);
-        if (action != null) {
-            String[] parts = split(action);
-            interfaceName = new QName(parts[0], parts[1]);
-            operationName = new QName(parts[0], parts[2]);
-        } else {
-            String interfaceNamespace = properties.getProperty(INTERFACE_NAMESPACE);
-            String interfaceLocalName = properties.getProperty(INTERFACE_LOCALNAME);
-            if (interfaceLocalName != null) {
-                interfaceName = new QName(interfaceNamespace, interfaceLocalName);
-            }
-            String operationNamespace = properties.getProperty(OPERATION_NAMESPACE);
-            String operationLocalName = properties.getProperty(OPERATION_LOCALNAME);
-            if (operationLocalName != null) {
-                operationName = new QName(operationNamespace, operationLocalName);
-            }
-        }
-        String endpoint = properties.getProperty(ENDPOINT); 
-        if (endpoint != null) {
-            String[] parts = split(action);
-            serviceName = new QName(parts[0], parts[1]);
-            endpointName = parts[2];
-        } else {
-            String serviceNamespace = properties.getProperty(SERVICE_NAMESPACE);
-            String serviceLocalName = properties.getProperty(SERVICE_LOCALNAME);
-            if (serviceLocalName != null) {
-                serviceName = new QName(serviceNamespace, serviceLocalName);
-            }
-            endpointName = properties.getProperty(ENDPOINT_NAME);
-        }
-        String mep = properties.getProperty(MEP);
-        if (mep == null) {
-            mep = "in-out"; 
-        }
-        this.mep = URI.create("http://www.w3.org/2004/08/wsdl/" + mep);
-    }
-
-    public void execute(HashMap input, HashMap output, IURIResolver resolver)
-			throws BPRuntimeException, ActionSystemException {
-        if (log.isDebugEnabled()) {
-            log.debug("execute");
-        }
-        Object payload = input.get(BPEComponent.PART_PAYLOAD);
-        Source inputSource = getSourceFromPayload(payload);
-        // Create and send exchange
-        try {
-            // TODO: need to configure mep
-            MessageExchange me = factory.createExchange(this.mep);
-            me.setInterfaceName(interfaceName);
-            me.setService(serviceName);
-            // TODO: set endpoint
-            me.setOperation(operationName);
-            NormalizedMessage nm = me.createMessage();
-            me.setMessage(nm, "in");
-            nm.setContent(inputSource);
-            boolean res = channel.sendSync(me);
-            if (!res) {
-                throw new ActionSystemException("Timeout on sending message");
-            }
-            if (me.getStatus() == ExchangeStatus.ACTIVE) {
-                nm = me.getMessage("out");
-                if (nm != null) {
-                    try {
-                        XMLInteractionObject result = new XMLInteractionObject();
-                        result.setDocument((Document) transformer.toDOMNode(nm));
-                        output.put(BPEComponent.PART_PAYLOAD, result);
-                    } catch (Exception e) {
-                        throw new ActionSystemException(e);
-                    }
-                }
-                me.setStatus(ExchangeStatus.DONE);
-                channel.send(me);
-            } else if (me.getStatus() == ExchangeStatus.ERROR) {
-                // Extract fault or error
-                if (me.getFault() != null) {
-                    Document fault;
-                    try {
-                        fault = (Document) transformer.toDOMNode(me.getFault());
-                    } catch (Exception e) {
-                        throw new ActionSystemException(e);
-                    }
-                    me.setStatus(ExchangeStatus.DONE);
-                    channel.send(me);
-                    Element e = fault.getDocumentElement();
-                    BPRuntimeException bpre = new BPRuntimeException(e.getLocalName(), "");
-                    bpre.setNameSpace(e.getNamespaceURI());
-                    XMLInteractionObject interaction = new XMLInteractionObject();
-                    interaction.setDocument(fault);
-                    bpre.addPartMessage("payload", interaction);
-                    throw bpre;
-                    /*
-                    try {
-                        XMLInteractionObject result = new XMLInteractionObject();
-                        result.setDocument((Document) transformer.toDOMNode(me.getFault()));
-                        output.put(BPEComponent.PART_PAYLOAD, result);
-                    } catch (Exception e) {
-                        throw new ActionSystemException(e);
-                    }
-                    me.setStatus(ExchangeStatus.DONE);
-                    channel.send(me);
-                    */
-                } else {
-                    Exception error = me.getError();
-                    me.setStatus(ExchangeStatus.DONE);
-                    channel.send(me);
-                    throw new BPRuntimeException("Unknown", error);
-                }
-            }
-        } catch (MessagingException e) {
-            throw new ActionSystemException(e);
-        }
-        if (log.isDebugEnabled()) {
-            log.debug("Request: " + payload);
-            log.debug("Response: " + output.get("payload"));
-        }
-	}
-
-    protected Source getSourceFromPayload(Object payload) {
-        Source inputSource;
-        if (payload instanceof IFormattableValue) {
-            IFormattableValue value = (IFormattableValue) payload;
-            if (value.supportsGetValueAs(Document.class)) {
-                Document doc = (Document) value.getValueAs(Document.class);
-                inputSource = new DOMSource(doc);
-            } else if (value.supportsGetValueAs(byte[].class)) {
-                byte[] data = (byte[]) value.getValueAs(byte[].class);
-                inputSource = new BytesSource(data);
-            } else if (value.supportsGetValueAs(String.class)) {
-                String data = (String) value.getValueAs(String.class);
-                inputSource = new StringSource(data);
-            } else {
-                throw new UnsupportedOperationException("Unable to retrieve value");
-            }
-        } else if (payload instanceof Document) {
-            inputSource = new DOMSource((Document) payload);
-        } else if (payload instanceof byte[]) {
-            inputSource = new BytesSource((byte[]) payload);
-        } else if (payload instanceof String) {
-            inputSource = new StringSource((String) payload);
-        } else {
-            throw new UnsupportedOperationException("Unable to retrieve value");
-        }
-        return inputSource;
-    }
-    
-	public void release() {
-        if (log.isDebugEnabled()) {
-            log.debug("release");
-        }
-	}
-
-    public void process(MessageExchange exchange) throws Exception {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void start() throws Exception {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void stop() throws Exception {
-        // TODO Auto-generated method stub
-        
-    }
-
-    protected String[] split(String uri) {
-        char sep;
-        if (uri.indexOf('/') > 0) {
-            sep = '/';
-        } else {
-            sep = ':';
-        }
-        int idx1 = uri.lastIndexOf(sep);
-        int idx2 = uri.lastIndexOf(sep, idx1 - 1);
-        String epName = uri.substring(idx1 + 1);
-        String svcName = uri.substring(idx2 + 1, idx1);
-        String nsUri   = uri.substring(0, idx2);
-        return new String[] { nsUri, svcName, epName };
-    }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.bpe.external;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Properties;
+
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessageExchangeFactory;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.bpe.BPEComponent;
+import org.apache.servicemix.bpe.BPELifeCycle;
+import org.apache.servicemix.common.ExchangeProcessor;
+import org.apache.servicemix.jbi.jaxp.BytesSource;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.ode.action.external.ActionSystemException;
+import org.apache.ode.action.external.IExternalAction;
+import org.apache.ode.action.external.IURIResolver;
+import org.apache.ode.client.IFormattableValue;
+import org.apache.ode.interaction.XMLInteractionObject;
+import org.apache.ode.scope.service.BPRuntimeException;
+
+public class JbiInvokeAction implements IExternalAction, ExchangeProcessor {
+
+    public static final String INTERFACE_NAMESPACE = "interfaceNamespace";
+    public static final String INTERFACE_LOCALNAME = "interfaceLocalName";
+    public static final String OPERATION_NAMESPACE = "operationNamespace";
+    public static final String OPERATION_LOCALNAME = "operationLocalName";
+    public static final String SERVICE_NAMESPACE = "serviceNamespace";
+    public static final String SERVICE_LOCALNAME = "serviceLocalName";
+    public static final String ENDPOINT_NAME = "endpointName";
+    public static final String ACTION = "action";
+    public static final String ENDPOINT = "endpoint";
+    public static final String MEP = "mep";
+    
+    private static Log log = LogFactory.getLog(JbiInvokeAction.class);
+    
+    private Properties properties;
+    private DeliveryChannel channel;
+    private MessageExchangeFactory factory;
+    private BPEComponent component;
+    private QName interfaceName;
+    private QName serviceName;
+    private String endpointName;
+    private QName operationName;
+    private URI mep;
+    private SourceTransformer transformer;
+    
+	/**
+	 * Generated serial version UID
+	 */
+	private static final long serialVersionUID = -8522450752525724302L;
+    
+    public JbiInvokeAction() {
+        transformer = new SourceTransformer();
+    }
+
+	public void init(Properties props) throws BPRuntimeException, ActionSystemException {
+        if (log.isDebugEnabled()) {
+            log.debug("init");
+        }
+        this.properties = props;
+        component = BPEComponent.getInstance();
+        if (component == null) {
+            throw new BPRuntimeException("BPEComponent has not been created", "");
+        }
+        try {
+            channel = ((BPELifeCycle) component.getLifeCycle()).getContext().getDeliveryChannel();
+            factory = channel.createExchangeFactory();
+        } catch (MessagingException e) {
+            throw new BPRuntimeException("Could not retrieve DeliveryChannel", e);
+        } 
+        extractInformations();
+        if (serviceName == null && interfaceName == null) { 
+            throw new BPRuntimeException("Interface, Service or Endpoint should be specified", "");
+        }
+        if (log.isDebugEnabled()) {
+            log.debug("properties: " + props);
+        }
+	}
+
+	protected void extractInformations() {
+        String action = properties.getProperty(ACTION);
+        if (action != null) {
+            String[] parts = split(action);
+            interfaceName = new QName(parts[0], parts[1]);
+            operationName = new QName(parts[0], parts[2]);
+        } else {
+            String interfaceNamespace = properties.getProperty(INTERFACE_NAMESPACE);
+            String interfaceLocalName = properties.getProperty(INTERFACE_LOCALNAME);
+            if (interfaceLocalName != null) {
+                interfaceName = new QName(interfaceNamespace, interfaceLocalName);
+            }
+            String operationNamespace = properties.getProperty(OPERATION_NAMESPACE);
+            String operationLocalName = properties.getProperty(OPERATION_LOCALNAME);
+            if (operationLocalName != null) {
+                operationName = new QName(operationNamespace, operationLocalName);
+            }
+        }
+        String endpoint = properties.getProperty(ENDPOINT); 
+        if (endpoint != null) {
+            String[] parts = split(action);
+            serviceName = new QName(parts[0], parts[1]);
+            endpointName = parts[2];
+        } else {
+            String serviceNamespace = properties.getProperty(SERVICE_NAMESPACE);
+            String serviceLocalName = properties.getProperty(SERVICE_LOCALNAME);
+            if (serviceLocalName != null) {
+                serviceName = new QName(serviceNamespace, serviceLocalName);
+            }
+            endpointName = properties.getProperty(ENDPOINT_NAME);
+        }
+        String mep = properties.getProperty(MEP);
+        if (mep == null) {
+            mep = "in-out"; 
+        }
+        this.mep = URI.create("http://www.w3.org/2004/08/wsdl/" + mep);
+    }
+
+    public void execute(HashMap input, HashMap output, IURIResolver resolver)
+			throws BPRuntimeException, ActionSystemException {
+        if (log.isDebugEnabled()) {
+            log.debug("execute");
+        }
+        Object payload = input.get(BPEComponent.PART_PAYLOAD);
+        Source inputSource = getSourceFromPayload(payload);
+        // Create and send exchange
+        try {
+            // TODO: need to configure mep
+            MessageExchange me = factory.createExchange(this.mep);
+            me.setInterfaceName(interfaceName);
+            me.setService(serviceName);
+            // TODO: set endpoint
+            me.setOperation(operationName);
+            NormalizedMessage nm = me.createMessage();
+            me.setMessage(nm, "in");
+            nm.setContent(inputSource);
+            boolean res = channel.sendSync(me);
+            if (!res) {
+                throw new ActionSystemException("Timeout on sending message");
+            }
+            if (me.getStatus() == ExchangeStatus.ACTIVE) {
+                nm = me.getMessage("out");
+                if (nm != null) {
+                    try {
+                        XMLInteractionObject result = new XMLInteractionObject();
+                        result.setDocument((Document) transformer.toDOMNode(nm));
+                        output.put(BPEComponent.PART_PAYLOAD, result);
+                    } catch (Exception e) {
+                        throw new ActionSystemException(e);
+                    }
+                }
+                me.setStatus(ExchangeStatus.DONE);
+                channel.send(me);
+            } else if (me.getStatus() == ExchangeStatus.ERROR) {
+                // Extract fault or error
+                if (me.getFault() != null) {
+                    Document fault;
+                    try {
+                        fault = (Document) transformer.toDOMNode(me.getFault());
+                    } catch (Exception e) {
+                        throw new ActionSystemException(e);
+                    }
+                    me.setStatus(ExchangeStatus.DONE);
+                    channel.send(me);
+                    Element e = fault.getDocumentElement();
+                    BPRuntimeException bpre = new BPRuntimeException(e.getLocalName(), "");
+                    bpre.setNameSpace(e.getNamespaceURI());
+                    XMLInteractionObject interaction = new XMLInteractionObject();
+                    interaction.setDocument(fault);
+                    bpre.addPartMessage("payload", interaction);
+                    throw bpre;
+                    /*
+                    try {
+                        XMLInteractionObject result = new XMLInteractionObject();
+                        result.setDocument((Document) transformer.toDOMNode(me.getFault()));
+                        output.put(BPEComponent.PART_PAYLOAD, result);
+                    } catch (Exception e) {
+                        throw new ActionSystemException(e);
+                    }
+                    me.setStatus(ExchangeStatus.DONE);
+                    channel.send(me);
+                    */
+                } else {
+                    Exception error = me.getError();
+                    me.setStatus(ExchangeStatus.DONE);
+                    channel.send(me);
+                    throw new BPRuntimeException("Unknown", error);
+                }
+            }
+        } catch (MessagingException e) {
+            throw new ActionSystemException(e);
+        }
+        if (log.isDebugEnabled()) {
+            log.debug("Request: " + payload);
+            log.debug("Response: " + output.get("payload"));
+        }
+	}
+
+    protected Source getSourceFromPayload(Object payload) {
+        Source inputSource;
+        if (payload instanceof IFormattableValue) {
+            IFormattableValue value = (IFormattableValue) payload;
+            if (value.supportsGetValueAs(Document.class)) {
+                Document doc = (Document) value.getValueAs(Document.class);
+                inputSource = new DOMSource(doc);
+            } else if (value.supportsGetValueAs(byte[].class)) {
+                byte[] data = (byte[]) value.getValueAs(byte[].class);
+                inputSource = new BytesSource(data);
+            } else if (value.supportsGetValueAs(String.class)) {
+                String data = (String) value.getValueAs(String.class);
+                inputSource = new StringSource(data);
+            } else {
+                throw new UnsupportedOperationException("Unable to retrieve value");
+            }
+        } else if (payload instanceof Document) {
+            inputSource = new DOMSource((Document) payload);
+        } else if (payload instanceof byte[]) {
+            inputSource = new BytesSource((byte[]) payload);
+        } else if (payload instanceof String) {
+            inputSource = new StringSource((String) payload);
+        } else {
+            throw new UnsupportedOperationException("Unable to retrieve value");
+        }
+        return inputSource;
+    }
+    
+	public void release() {
+        if (log.isDebugEnabled()) {
+            log.debug("release");
+        }
+	}
+
+    public void process(MessageExchange exchange) throws Exception {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void start() throws Exception {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void stop() throws Exception {
+        // TODO Auto-generated method stub
+        
+    }
+
+    protected String[] split(String uri) {
+        char sep;
+        if (uri.indexOf('/') > 0) {
+            sep = '/';
+        } else {
+            sep = ':';
+        }
+        int idx1 = uri.lastIndexOf(sep);
+        int idx2 = uri.lastIndexOf(sep, idx1 - 1);
+        String epName = uri.substring(idx1 + 1);
+        String svcName = uri.substring(idx2 + 1, idx1);
+        String nsUri   = uri.substring(0, idx2);
+        return new String[] { nsUri, svcName, epName };
+    }
+}

Propchange: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/external/JbiInvokeAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/timer/BPETimerJdk.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/timer/BPETimerJdk.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/timer/BPETimerJdk.java (original)
+++ incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/timer/BPETimerJdk.java Tue Feb 21 15:40:05 2006
@@ -1,59 +1,59 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.bpe.timer;
-
-import java.util.Date;
-import java.util.TimerTask;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.servicemix.bpe.BPEComponent;
-
-import org.apache.ode.bped.EventDirector;
-import org.apache.ode.event.ITimerEvent;
-import org.apache.ode.timerservice.IBPETimer;
-
-public class BPETimerJdk extends TimerTask implements IBPETimer {
-
-    private static Log log = LogFactory.getLog(BPETimerJdk.class);
-    
-    private ITimerEvent te;
-    
-    public BPETimerJdk(ITimerEvent te) {
-        this.te = te;
-    }
-
-    public Object getId() {
-        return te.getProcId();
-    }
-
-    public ITimerEvent getTimerEvent() {
-        return te;
-    }
-
-    public void run() {
-        try {
-            if (log.isDebugEnabled()) {
-                log.debug("Timer " + te + " elapsed at " + new Date());
-            }
-            EventDirector ed = BPEComponent.getInstance().getEventDirector();
-            ed.getIInternalEventDirector().sendEvent(this, true);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.bpe.timer;
+
+import java.util.Date;
+import java.util.TimerTask;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.bpe.BPEComponent;
+
+import org.apache.ode.bped.EventDirector;
+import org.apache.ode.event.ITimerEvent;
+import org.apache.ode.timerservice.IBPETimer;
+
+public class BPETimerJdk extends TimerTask implements IBPETimer {
+
+    private static Log log = LogFactory.getLog(BPETimerJdk.class);
+    
+    private ITimerEvent te;
+    
+    public BPETimerJdk(ITimerEvent te) {
+        this.te = te;
+    }
+
+    public Object getId() {
+        return te.getProcId();
+    }
+
+    public ITimerEvent getTimerEvent() {
+        return te;
+    }
+
+    public void run() {
+        try {
+            if (log.isDebugEnabled()) {
+                log.debug("Timer " + te + " elapsed at " + new Date());
+            }
+            EventDirector ed = BPEComponent.getInstance().getEventDirector();
+            ed.getIInternalEventDirector().sendEvent(this, true);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+}

Propchange: incubator/servicemix/trunk/servicemix-bpe/src/main/java/org/apache/servicemix/bpe/timer/BPETimerJdk.java
------------------------------------------------------------------------------
    svn:eol-style = native