[savara-commits] savara SVN: r286 - branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change and 6 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Jun 29 11:06:33 EDT 2010


Author: objectiser
Date: 2010-06-29 11:06:31 -0400 (Tue, 29 Jun 2010)
New Revision: 286

Added:
   branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGeneratorUtil.java
   trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGeneratorUtil.java
Removed:
   branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/GeneratorUtil.java
   trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/GeneratorUtil.java
Modified:
   branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
   branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java
   branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java
   branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java
   branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java
   trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
   trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java
   trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java
   trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java
   trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java
Log:
SAVARA-112 - fixed message type.

Modified: branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
===================================================================
--- branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java	2010-06-29 13:44:20 UTC (rev 285)
+++ branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -33,7 +33,7 @@
 import org.jboss.savara.tools.bpel.model.*;
 import org.jboss.savara.tools.bpel.model.component.PartnerLink;
 import org.jboss.savara.tools.bpel.util.XMLUtils;
-import org.jboss.savara.tools.wsdl.generator.GeneratorUtil;
+import org.jboss.savara.tools.wsdl.generator.WSDLGeneratorUtil;
 import org.jboss.savara.tools.wsdl.generator.soap.*;
 import org.scribble.contract.model.Contract;
 import org.scribble.contract.model.Interface;
@@ -249,7 +249,7 @@
 							localcm.getModelName().getRole().getName()+".bpel");
 			
 			IFile bpelFile=proj.getProject().getWorkspace().getRoot().getFile(bpelPath);
-			GeneratorUtil.createFolder(bpelFile);
+			WSDLGeneratorUtil.createFolder(bpelFile);
 			
 			bpelFile.create(null, true,
 					new org.eclipse.core.runtime.NullProgressMonitor());
@@ -295,7 +295,7 @@
 
 			IFolder wsdlFolder=proj.getProject().getWorkspace().getRoot().getFolder(bpelFolderPath);
 			
-			GeneratorUtil.createFolder(wsdlFolder);
+			WSDLGeneratorUtil.createFolder(wsdlFolder);
 			
 			// Generate definition
 			java.util.List<javax.wsdl.Definition> defns=generator.generateDefinitions(contract,
@@ -347,7 +347,7 @@
 					
 					IFile wsdlFile=proj.getProject().getWorkspace().getRoot().getFile(wsdlPath);
 					
-					GeneratorUtil.createFolder(wsdlFile);
+					WSDLGeneratorUtil.createFolder(wsdlFile);
 					
 					if (wsdlFile.exists() == false) {
 						wsdlFile.create(null, true,
@@ -397,7 +397,7 @@
 	protected void copySchema(IFile srcXSDFile, IFile targetXSDFile, IPath bpelFolderPath) throws Exception {
 
 		if (targetXSDFile.exists() == false) {
-			GeneratorUtil.createFolder(targetXSDFile.getParent());
+			WSDLGeneratorUtil.createFolder(targetXSDFile.getParent());
 
 			targetXSDFile.create(null, true,
 					new org.eclipse.core.runtime.NullProgressMonitor());
@@ -552,7 +552,7 @@
 		
 		IFile wsdlFile=proj.getProject().getWorkspace().getRoot().getFile(wsdlPath);
 		
-		GeneratorUtil.createFolder(wsdlFile);
+		WSDLGeneratorUtil.createFolder(wsdlFile);
 		
 		wsdlFile.create(null, true,
 				new org.eclipse.core.runtime.NullProgressMonitor());
@@ -658,7 +658,7 @@
 		
 		IFile wsdlFile=proj.getProject().getWorkspace().getRoot().getFile(wsdlPath);
 		
-		GeneratorUtil.createFolder(wsdlFile);
+		WSDLGeneratorUtil.createFolder(wsdlFile);
 		
 		wsdlFile.create(null, true,
 				new org.eclipse.core.runtime.NullProgressMonitor());

Modified: branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java
===================================================================
--- branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java	2010-06-29 13:44:20 UTC (rev 285)
+++ branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -17,9 +17,12 @@
  */
 package org.jboss.savara.tools.bpel.model.change;
 
+import javax.xml.namespace.QName;
+
 import org.jboss.savara.tools.bpel.model.*;
 import org.jboss.savara.tools.bpel.model.component.*;
 import org.jboss.savara.tools.bpel.model.util.*;
+import org.jboss.savara.tools.wsdl.generator.WSDLGeneratorUtil;
 import org.scribble.model.*;
 import org.scribble.model.change.*;
 import org.scribble.contract.model.Contract;
@@ -343,12 +346,20 @@
 				var = new org.jboss.savara.tools.bpel.model.component.Variable(bpelModel);
 				var.setName(varName);
 				
-				String mesgType=InteractionPatterns.getMessageTypeLocalPart(interaction);
-				String namespace=InteractionPatterns.getMessageTypeNameSpace(interaction);
+				QName qname=null;
+				if (InteractionUtil.isRequest(interaction)) {
+					qname = WSDLGeneratorUtil.getRequestMessageType(contract.getNamespace(),
+										interaction.getMessageSignature().getOperation());
+				} else {
+					qname = WSDLGeneratorUtil.getResponseMessageType(contract.getNamespace(),
+										interaction.getMessageSignature().getOperation());
+				}
 
+				String mesgType=qname.getLocalPart();
+				
 				// Find namespace prefix
-				if (namespace != null) {
-					String pfix=bpelModel.getBPELProcess().addNamespace(namespace);
+				if (qname.getNamespaceURI() != null) {
+					String pfix=bpelModel.getBPELProcess().addNamespace(qname.getNamespaceURI());
 					
 					if (pfix != null) {
 						mesgType = pfix+":"+mesgType;

Modified: branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java
===================================================================
--- branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java	2010-06-29 13:44:20 UTC (rev 285)
+++ branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -17,9 +17,12 @@
  */
 package org.jboss.savara.tools.bpel.model.change;
 
+import javax.xml.namespace.QName;
+
 import org.jboss.savara.tools.bpel.model.*;
 import org.jboss.savara.tools.bpel.model.component.*;
 import org.jboss.savara.tools.bpel.model.util.InteractionUtil;
+import org.jboss.savara.tools.wsdl.generator.WSDLGeneratorUtil;
 import org.scribble.model.*;
 import org.scribble.model.change.*;
 import org.scribble.contract.model.Contract;
@@ -155,7 +158,7 @@
 
 								// Create variable
 								if (varName != null) {
-									createVariable(varName, (Interaction)act, bpelModel);
+									createVariable(context, varName, (Interaction)act, bpelModel);
 								}
 							}
 						}
@@ -310,7 +313,7 @@
 				
 				// Create variable
 				if (varName != null) {
-					createVariable(varName, recv, bpelModel);
+					createVariable(context, varName, recv, bpelModel);
 				}
 				
 				// Check if create instance
@@ -384,7 +387,8 @@
 	 * @param interaction The interaction associated with the variable
 	 * @param bpelModel The BPEL model
 	 */
-	protected void createVariable(String varName, Interaction interaction, BPELLanguageModel bpelModel) {
+	protected void createVariable(ModelChangeContext context, String varName,
+						Interaction interaction, BPELLanguageModel bpelModel) {
 		org.jboss.savara.tools.bpel.model.component.Variable var=
 					bpelModel.getBPELProcess().getVariable(varName);
 
@@ -392,15 +396,36 @@
 			var = new org.jboss.savara.tools.bpel.model.component.Variable(bpelModel);
 			var.setName(varName);
 			
-			String mesgType=InteractionPatterns.getMessageTypeLocalPart(interaction);
-			String namespace=InteractionPatterns.getMessageTypeNameSpace(interaction);
-	
+			Role roleType=null;
+			Contract contract=null;
+			
+			if (InteractionUtil.isRequest(interaction)) {
+				roleType = interaction.getToRole();
+			} else {
+				roleType = interaction.getFromRole();
+			}
+			
+			if (roleType != null) {
+				contract = ModelChangeUtils.getContract(context, roleType.getName());
+			}
+
+			QName qname=null;
+			if (InteractionUtil.isRequest(interaction)) {
+				qname = WSDLGeneratorUtil.getRequestMessageType(contract.getNamespace(),
+									interaction.getMessageSignature().getOperation());
+			} else {
+				qname = WSDLGeneratorUtil.getResponseMessageType(contract.getNamespace(),
+									interaction.getMessageSignature().getOperation());
+			}
+
+			String mesgType=qname.getLocalPart();
+			
 			// Find namespace prefix
-			if (namespace != null) {
-				String prefix=bpelModel.getBPELProcess().addNamespace(namespace);
+			if (qname.getNamespaceURI() != null) {
+				String pfix=bpelModel.getBPELProcess().addNamespace(qname.getNamespaceURI());
 				
-				if (prefix != null) {
-					mesgType = prefix+":"+mesgType;
+				if (pfix != null) {
+					mesgType = pfix+":"+mesgType;
 				}
 			}
 			

Modified: branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java
===================================================================
--- branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java	2010-06-29 13:44:20 UTC (rev 285)
+++ branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -30,7 +30,7 @@
 import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.ui.IObjectActionDelegate;
 import org.eclipse.ui.IWorkbenchPart;
-import org.jboss.savara.tools.wsdl.generator.GeneratorUtil;
+import org.jboss.savara.tools.wsdl.generator.WSDLGeneratorUtil;
 import org.jboss.savara.tools.wsdl.generator.soap.*;
 
 import org.scribble.contract.model.Contract;
@@ -141,7 +141,7 @@
 
 			IFolder wsdlFolder=cdmResource.getProject().getWorkspace().getRoot().getFolder(wsdlFolderPath);
 			
-			GeneratorUtil.createFolder(wsdlFolder);
+			WSDLGeneratorUtil.createFolder(wsdlFolder);
 			
 			// Generate definition
 			java.util.List<javax.wsdl.Definition> defns=generator.generateDefinitions(contract,

Deleted: branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/GeneratorUtil.java
===================================================================
--- branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/GeneratorUtil.java	2010-06-29 13:44:20 UTC (rev 285)
+++ branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/GeneratorUtil.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.jboss.savara.tools.wsdl.generator;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-
-/**
- * This class provides general utility functions for
- * use when generating artefacts.
- */
-public class GeneratorUtil {
-
-	/**
-	 * This method checks whether the folder exists,
-	 * and if not attempts to create it.
-	 * 
-	 * @param res The current resource
-	 */
-	public static void createFolder(IResource res) {
-		if (res instanceof IFolder) {
-			IFolder folder=(IFolder)res;
-			
-			if (folder.exists() == false) {
-				createFolder(folder.getParent());
-
-				try {
-					folder.create(true, true,
-							new org.eclipse.core.runtime.NullProgressMonitor());
-				} catch(Exception e) {
-					e.printStackTrace();
-				}
-			}
-		} else if (res.getParent() != null) {
-			createFolder(res.getParent());
-		}
-	}
-
-}

Modified: branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java
===================================================================
--- branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java	2010-06-29 13:44:20 UTC (rev 285)
+++ branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -297,8 +297,8 @@
 			
 			ret.setName(mep.getOperation());
 			
-			QName msgname=new QName(portType.getQName().getNamespaceURI(),
-								mep.getOperation()+"Request");
+			QName msgname=WSDLGeneratorUtil.getRequestMessageType(portType.getQName().getNamespaceURI(),
+								mep.getOperation());
 			
 			javax.wsdl.Message mesg=getMessage(wsdls, contract, msgname,
 								mep.getTypes(), wsdlBinding);
@@ -313,8 +313,8 @@
 			if (mep instanceof RequestResponseMEP) {
 				RequestResponseMEP rr=(RequestResponseMEP)mep;
 				
-				msgname=new QName(portType.getQName().getNamespaceURI(),
-								mep.getOperation()+"Response");
+				msgname=WSDLGeneratorUtil.getResponseMessageType(portType.getQName().getNamespaceURI(),
+								mep.getOperation());
 			
 				javax.wsdl.Message om=getMessage(wsdls, contract, msgname,
 									rr.getResponseTypes(), wsdlBinding);
@@ -329,8 +329,8 @@
 					for (int i=0; i < rr.getFaultDetails().size(); i++) {
 						FaultDetails fd=rr.getFaultDetails().get(i);
 						
-						msgname = new QName(portType.getQName().getNamespaceURI(),
-										mep.getOperation()+"Fault"+(i+1));
+						msgname = WSDLGeneratorUtil.getFaultMessageType(portType.getQName().getNamespaceURI(),
+												fd.getName());
 					
 						javax.wsdl.Message fm=getMessage(wsdls, contract, msgname,
 											fd.getTypes(), wsdlBinding);

Copied: branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGeneratorUtil.java (from rev 278, branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/GeneratorUtil.java)
===================================================================
--- branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGeneratorUtil.java	                        (rev 0)
+++ branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGeneratorUtil.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.savara.tools.wsdl.generator;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+
+/**
+ * This class provides general utility functions for
+ * use when generating artefacts.
+ */
+public class WSDLGeneratorUtil {
+
+	private static final String RESPONSE = "Response";
+	private static final String FAULT = "Fault";
+	private static final String REQUEST = "Request";
+
+	/**
+	 * This method checks whether the folder exists,
+	 * and if not attempts to create it.
+	 * 
+	 * @param res The current resource
+	 */
+	public static void createFolder(IResource res) {
+		if (res instanceof IFolder) {
+			IFolder folder=(IFolder)res;
+			
+			if (folder.exists() == false) {
+				createFolder(folder.getParent());
+
+				try {
+					folder.create(true, true,
+							new org.eclipse.core.runtime.NullProgressMonitor());
+				} catch(Exception e) {
+					e.printStackTrace();
+				}
+			}
+		} else if (res.getParent() != null) {
+			createFolder(res.getParent());
+		}
+	}
+
+	/**
+	 * This method returns the request message type QName.
+	 * 
+	 * @param intfNamespace The interface namespace
+	 * @param op The operation name
+	 * @return The request message type
+	 */
+	public static javax.xml.namespace.QName getRequestMessageType(String intfNamespace, String op) {
+		return(new javax.xml.namespace.QName(intfNamespace, op+REQUEST));
+	}
+
+	/**
+	 * This method returns the response message type QName.
+	 * 
+	 * @param intfNamespace The interface namespace
+	 * @param op The operation name
+	 * @return The response message type
+	 */
+	public static javax.xml.namespace.QName getResponseMessageType(String intfNamespace, String op) {
+		return(new javax.xml.namespace.QName(intfNamespace, op+RESPONSE));
+	}
+
+	/**
+	 * This method returns the fault message type QName.
+	 * 
+	 * @param intfNamespace The interface namespace
+	 * @param faultName The fault name
+	 * @return The fault message type
+	 */
+	public static javax.xml.namespace.QName getFaultMessageType(String intfNamespace, String faultName) {
+		return(new javax.xml.namespace.QName(intfNamespace, faultName+FAULT));
+	}
+}

Modified: trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
===================================================================
--- trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java	2010-06-29 13:44:20 UTC (rev 285)
+++ trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -33,7 +33,7 @@
 import org.jboss.savara.tools.bpel.model.*;
 import org.jboss.savara.tools.bpel.model.component.PartnerLink;
 import org.jboss.savara.tools.bpel.util.XMLUtils;
-import org.jboss.savara.tools.wsdl.generator.GeneratorUtil;
+import org.jboss.savara.tools.wsdl.generator.WSDLGeneratorUtil;
 import org.jboss.savara.tools.wsdl.generator.soap.*;
 import org.scribble.contract.model.Contract;
 import org.scribble.contract.model.Interface;
@@ -249,7 +249,7 @@
 							localcm.getModelName().getRole().getName()+".bpel");
 			
 			IFile bpelFile=proj.getProject().getWorkspace().getRoot().getFile(bpelPath);
-			GeneratorUtil.createFolder(bpelFile);
+			WSDLGeneratorUtil.createFolder(bpelFile);
 			
 			bpelFile.create(null, true,
 					new org.eclipse.core.runtime.NullProgressMonitor());
@@ -295,7 +295,7 @@
 
 			IFolder wsdlFolder=proj.getProject().getWorkspace().getRoot().getFolder(bpelFolderPath);
 			
-			GeneratorUtil.createFolder(wsdlFolder);
+			WSDLGeneratorUtil.createFolder(wsdlFolder);
 			
 			// Generate definition
 			java.util.List<javax.wsdl.Definition> defns=generator.generateDefinitions(contract,
@@ -347,7 +347,7 @@
 					
 					IFile wsdlFile=proj.getProject().getWorkspace().getRoot().getFile(wsdlPath);
 					
-					GeneratorUtil.createFolder(wsdlFile);
+					WSDLGeneratorUtil.createFolder(wsdlFile);
 					
 					if (wsdlFile.exists() == false) {
 						wsdlFile.create(null, true,
@@ -397,7 +397,7 @@
 	protected void copySchema(IFile srcXSDFile, IFile targetXSDFile, IPath bpelFolderPath) throws Exception {
 
 		if (targetXSDFile.exists() == false) {
-			GeneratorUtil.createFolder(targetXSDFile.getParent());
+			WSDLGeneratorUtil.createFolder(targetXSDFile.getParent());
 
 			targetXSDFile.create(null, true,
 					new org.eclipse.core.runtime.NullProgressMonitor());
@@ -552,7 +552,7 @@
 		
 		IFile wsdlFile=proj.getProject().getWorkspace().getRoot().getFile(wsdlPath);
 		
-		GeneratorUtil.createFolder(wsdlFile);
+		WSDLGeneratorUtil.createFolder(wsdlFile);
 		
 		wsdlFile.create(null, true,
 				new org.eclipse.core.runtime.NullProgressMonitor());
@@ -658,7 +658,7 @@
 		
 		IFile wsdlFile=proj.getProject().getWorkspace().getRoot().getFile(wsdlPath);
 		
-		GeneratorUtil.createFolder(wsdlFile);
+		WSDLGeneratorUtil.createFolder(wsdlFile);
 		
 		wsdlFile.create(null, true,
 				new org.eclipse.core.runtime.NullProgressMonitor());

Modified: trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java
===================================================================
--- trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java	2010-06-29 13:44:20 UTC (rev 285)
+++ trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -17,9 +17,12 @@
  */
 package org.jboss.savara.tools.bpel.model.change;
 
+import javax.xml.namespace.QName;
+
 import org.jboss.savara.tools.bpel.model.*;
 import org.jboss.savara.tools.bpel.model.component.*;
 import org.jboss.savara.tools.bpel.model.util.*;
+import org.jboss.savara.tools.wsdl.generator.WSDLGeneratorUtil;
 import org.scribble.model.*;
 import org.scribble.model.change.*;
 import org.scribble.contract.model.Contract;
@@ -343,12 +346,20 @@
 				var = new org.jboss.savara.tools.bpel.model.component.Variable(bpelModel);
 				var.setName(varName);
 				
-				String mesgType=InteractionPatterns.getMessageTypeLocalPart(interaction);
-				String namespace=InteractionPatterns.getMessageTypeNameSpace(interaction);
+				QName qname=null;
+				if (InteractionUtil.isRequest(interaction)) {
+					qname = WSDLGeneratorUtil.getRequestMessageType(contract.getNamespace(),
+										interaction.getMessageSignature().getOperation());
+				} else {
+					qname = WSDLGeneratorUtil.getResponseMessageType(contract.getNamespace(),
+										interaction.getMessageSignature().getOperation());
+				}
 
+				String mesgType=qname.getLocalPart();
+				
 				// Find namespace prefix
-				if (namespace != null) {
-					String pfix=bpelModel.getBPELProcess().addNamespace(namespace);
+				if (qname.getNamespaceURI() != null) {
+					String pfix=bpelModel.getBPELProcess().addNamespace(qname.getNamespaceURI());
 					
 					if (pfix != null) {
 						mesgType = pfix+":"+mesgType;

Modified: trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java
===================================================================
--- trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java	2010-06-29 13:44:20 UTC (rev 285)
+++ trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -17,9 +17,12 @@
  */
 package org.jboss.savara.tools.bpel.model.change;
 
+import javax.xml.namespace.QName;
+
 import org.jboss.savara.tools.bpel.model.*;
 import org.jboss.savara.tools.bpel.model.component.*;
 import org.jboss.savara.tools.bpel.model.util.InteractionUtil;
+import org.jboss.savara.tools.wsdl.generator.WSDLGeneratorUtil;
 import org.scribble.model.*;
 import org.scribble.model.change.*;
 import org.scribble.contract.model.Contract;
@@ -155,7 +158,7 @@
 
 								// Create variable
 								if (varName != null) {
-									createVariable(varName, (Interaction)act, bpelModel);
+									createVariable(context, varName, (Interaction)act, bpelModel);
 								}
 							}
 						}
@@ -310,7 +313,7 @@
 				
 				// Create variable
 				if (varName != null) {
-					createVariable(varName, recv, bpelModel);
+					createVariable(context, varName, recv, bpelModel);
 				}
 				
 				// Check if create instance
@@ -384,7 +387,8 @@
 	 * @param interaction The interaction associated with the variable
 	 * @param bpelModel The BPEL model
 	 */
-	protected void createVariable(String varName, Interaction interaction, BPELLanguageModel bpelModel) {
+	protected void createVariable(ModelChangeContext context, String varName,
+						Interaction interaction, BPELLanguageModel bpelModel) {
 		org.jboss.savara.tools.bpel.model.component.Variable var=
 					bpelModel.getBPELProcess().getVariable(varName);
 
@@ -392,15 +396,36 @@
 			var = new org.jboss.savara.tools.bpel.model.component.Variable(bpelModel);
 			var.setName(varName);
 			
-			String mesgType=InteractionPatterns.getMessageTypeLocalPart(interaction);
-			String namespace=InteractionPatterns.getMessageTypeNameSpace(interaction);
-	
+			Role roleType=null;
+			Contract contract=null;
+			
+			if (InteractionUtil.isRequest(interaction)) {
+				roleType = interaction.getToRole();
+			} else {
+				roleType = interaction.getFromRole();
+			}
+			
+			if (roleType != null) {
+				contract = ModelChangeUtils.getContract(context, roleType.getName());
+			}
+
+			QName qname=null;
+			if (InteractionUtil.isRequest(interaction)) {
+				qname = WSDLGeneratorUtil.getRequestMessageType(contract.getNamespace(),
+									interaction.getMessageSignature().getOperation());
+			} else {
+				qname = WSDLGeneratorUtil.getResponseMessageType(contract.getNamespace(),
+									interaction.getMessageSignature().getOperation());
+			}
+
+			String mesgType=qname.getLocalPart();
+			
 			// Find namespace prefix
-			if (namespace != null) {
-				String prefix=bpelModel.getBPELProcess().addNamespace(namespace);
+			if (qname.getNamespaceURI() != null) {
+				String pfix=bpelModel.getBPELProcess().addNamespace(qname.getNamespaceURI());
 				
-				if (prefix != null) {
-					mesgType = prefix+":"+mesgType;
+				if (pfix != null) {
+					mesgType = pfix+":"+mesgType;
 				}
 			}
 			

Modified: trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java
===================================================================
--- trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java	2010-06-29 13:44:20 UTC (rev 285)
+++ trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -30,7 +30,7 @@
 import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.ui.IObjectActionDelegate;
 import org.eclipse.ui.IWorkbenchPart;
-import org.jboss.savara.tools.wsdl.generator.GeneratorUtil;
+import org.jboss.savara.tools.wsdl.generator.WSDLGeneratorUtil;
 import org.jboss.savara.tools.wsdl.generator.soap.*;
 
 import org.scribble.contract.model.Contract;
@@ -141,7 +141,7 @@
 
 			IFolder wsdlFolder=cdmResource.getProject().getWorkspace().getRoot().getFolder(wsdlFolderPath);
 			
-			GeneratorUtil.createFolder(wsdlFolder);
+			WSDLGeneratorUtil.createFolder(wsdlFolder);
 			
 			// Generate definition
 			java.util.List<javax.wsdl.Definition> defns=generator.generateDefinitions(contract,

Deleted: trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/GeneratorUtil.java
===================================================================
--- trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/GeneratorUtil.java	2010-06-29 13:44:20 UTC (rev 285)
+++ trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/GeneratorUtil.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.jboss.savara.tools.wsdl.generator;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-
-/**
- * This class provides general utility functions for
- * use when generating artefacts.
- */
-public class GeneratorUtil {
-
-	/**
-	 * This method checks whether the folder exists,
-	 * and if not attempts to create it.
-	 * 
-	 * @param res The current resource
-	 */
-	public static void createFolder(IResource res) {
-		if (res instanceof IFolder) {
-			IFolder folder=(IFolder)res;
-			
-			if (folder.exists() == false) {
-				createFolder(folder.getParent());
-
-				try {
-					folder.create(true, true,
-							new org.eclipse.core.runtime.NullProgressMonitor());
-				} catch(Exception e) {
-					e.printStackTrace();
-				}
-			}
-		} else if (res.getParent() != null) {
-			createFolder(res.getParent());
-		}
-	}
-
-}

Modified: trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java
===================================================================
--- trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java	2010-06-29 13:44:20 UTC (rev 285)
+++ trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -297,8 +297,8 @@
 			
 			ret.setName(mep.getOperation());
 			
-			QName msgname=new QName(portType.getQName().getNamespaceURI(),
-								mep.getOperation()+"Request");
+			QName msgname=WSDLGeneratorUtil.getRequestMessageType(portType.getQName().getNamespaceURI(),
+								mep.getOperation());
 			
 			javax.wsdl.Message mesg=getMessage(wsdls, contract, msgname,
 								mep.getTypes(), wsdlBinding);
@@ -313,8 +313,8 @@
 			if (mep instanceof RequestResponseMEP) {
 				RequestResponseMEP rr=(RequestResponseMEP)mep;
 				
-				msgname=new QName(portType.getQName().getNamespaceURI(),
-								mep.getOperation()+"Response");
+				msgname=WSDLGeneratorUtil.getResponseMessageType(portType.getQName().getNamespaceURI(),
+								mep.getOperation());
 			
 				javax.wsdl.Message om=getMessage(wsdls, contract, msgname,
 									rr.getResponseTypes(), wsdlBinding);
@@ -329,8 +329,8 @@
 					for (int i=0; i < rr.getFaultDetails().size(); i++) {
 						FaultDetails fd=rr.getFaultDetails().get(i);
 						
-						msgname = new QName(portType.getQName().getNamespaceURI(),
-										mep.getOperation()+"Fault"+(i+1));
+						msgname = WSDLGeneratorUtil.getFaultMessageType(portType.getQName().getNamespaceURI(),
+												fd.getName());
 					
 						javax.wsdl.Message fm=getMessage(wsdls, contract, msgname,
 											fd.getTypes(), wsdlBinding);

Added: trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGeneratorUtil.java
===================================================================
--- trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGeneratorUtil.java	                        (rev 0)
+++ trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGeneratorUtil.java	2010-06-29 15:06:31 UTC (rev 286)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.savara.tools.wsdl.generator;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+
+/**
+ * This class provides general utility functions for
+ * use when generating artefacts.
+ */
+public class WSDLGeneratorUtil {
+
+	private static final String RESPONSE = "Response";
+	private static final String FAULT = "Fault";
+	private static final String REQUEST = "Request";
+
+	/**
+	 * This method checks whether the folder exists,
+	 * and if not attempts to create it.
+	 * 
+	 * @param res The current resource
+	 */
+	public static void createFolder(IResource res) {
+		if (res instanceof IFolder) {
+			IFolder folder=(IFolder)res;
+			
+			if (folder.exists() == false) {
+				createFolder(folder.getParent());
+
+				try {
+					folder.create(true, true,
+							new org.eclipse.core.runtime.NullProgressMonitor());
+				} catch(Exception e) {
+					e.printStackTrace();
+				}
+			}
+		} else if (res.getParent() != null) {
+			createFolder(res.getParent());
+		}
+	}
+
+	/**
+	 * This method returns the request message type QName.
+	 * 
+	 * @param intfNamespace The interface namespace
+	 * @param op The operation name
+	 * @return The request message type
+	 */
+	public static javax.xml.namespace.QName getRequestMessageType(String intfNamespace, String op) {
+		return(new javax.xml.namespace.QName(intfNamespace, op+REQUEST));
+	}
+
+	/**
+	 * This method returns the response message type QName.
+	 * 
+	 * @param intfNamespace The interface namespace
+	 * @param op The operation name
+	 * @return The response message type
+	 */
+	public static javax.xml.namespace.QName getResponseMessageType(String intfNamespace, String op) {
+		return(new javax.xml.namespace.QName(intfNamespace, op+RESPONSE));
+	}
+
+	/**
+	 * This method returns the fault message type QName.
+	 * 
+	 * @param intfNamespace The interface namespace
+	 * @param faultName The fault name
+	 * @return The fault message type
+	 */
+	public static javax.xml.namespace.QName getFaultMessageType(String intfNamespace, String faultName) {
+		return(new javax.xml.namespace.QName(intfNamespace, faultName+FAULT));
+	}
+}



More information about the savara-commits mailing list