[savara-commits] savara SVN: r295 - branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Jul 3 15:09:30 EDT 2010


Author: objectiser
Date: 2010-07-03 15:09:30 -0400 (Sat, 03 Jul 2010)
New Revision: 295

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.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.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.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java
Log:
SAVARA-113 and SAVARA-114. For WSDL generation, the schema is no longer copied, but instead referenced in place. 114 is fixed, so if URL, it just copies the value into the generated location field.

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-07-02 20:29:50 UTC (rev 294)
+++ branches/1.0.x/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java	2010-07-03 19:09:30 UTC (rev 295)
@@ -374,21 +374,28 @@
 				java.util.StringTokenizer st=new java.util.StringTokenizer(ns.getSchemaLocation());
 				
 				while (st.hasMoreTokens()) {
-					IFile file=cdmResource.getParent().getFile(new Path(st.nextToken()));
+					String location=st.nextToken();
+					IFile file=cdmResource.getParent().getFile(new Path(location));
 					
 					javax.wsdl.Import imp=firstDefn.createImport();
 					
 					imp.setDefinition(defn);
 					imp.setNamespaceURI(ns.getURI());
-					imp.setLocationURI(file.getProjectRelativePath().toPortableString());
 					
+					if (file.exists()) {
+						imp.setLocationURI(file.getProjectRelativePath().toPortableString());
+						
+						// Copy schema file into generated BPEL project
+						IPath artifactPath=bpelFolderPath.append(file.getProjectRelativePath());
+						
+						IFile artifactFile=cdmResource.getProject().getWorkspace().getRoot().getFile(artifactPath);
+
+						copySchema(file, artifactFile, bpelFolderPath);
+					} else {
+						imp.setLocationURI(location);
+					}
+					
 					firstDefn.addImport(imp);					
-					
-					IPath artifactPath=bpelFolderPath.append(file.getProjectRelativePath());
-					
-					IFile artifactFile=cdmResource.getProject().getWorkspace().getRoot().getFile(artifactPath);
-
-					copySchema(file, artifactFile, bpelFolderPath);
 				}
 			}
 		}

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-07-02 20:29:50 UTC (rev 294)
+++ branches/1.0.x/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java	2010-07-03 19:09:30 UTC (rev 295)
@@ -187,27 +187,22 @@
 								java.util.StringTokenizer st=new java.util.StringTokenizer(ns.getSchemaLocation());
 								
 								while (st.hasMoreTokens()) {
-									IFile file=cdmResource.getParent().getFile(new Path(st.nextToken()));
+									String location=st.nextToken();
+									IFile file=cdmResource.getParent().getFile(new Path(location));
 								
 									javax.wsdl.Import imp=defns.get(0).createImport();
 									
 									imp.setDefinition(defn);
 									imp.setNamespaceURI(ns.getURI());
-									imp.setLocationURI(file.getName());
 									
-									defns.get(0).addImport(imp);					
-									
-									IPath artifactPath=wsdlFolderPath.append(file.getName());
-						
-									IFile artifactFile=cdmResource.getProject().getWorkspace().getRoot().getFile(artifactPath);
-	
-									if (artifactFile.exists() == false) {
-										artifactFile.create(null, true,
-												new org.eclipse.core.runtime.NullProgressMonitor());
+									if (file.exists()) {
+										IPath relative=file.getFullPath().makeRelativeTo(wsdlFolderPath);
+										imp.setLocationURI(relative.toPortableString());
+									} else {
+										imp.setLocationURI(location);
 									}
 									
-									artifactFile.setContents(file.getContents(), true, false,
-												new org.eclipse.core.runtime.NullProgressMonitor());
+									defns.get(0).addImport(imp);					
 								}
 							}
 						}

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-07-02 20:29:50 UTC (rev 294)
+++ trunk/tools/eclipse/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java	2010-07-03 19:09:30 UTC (rev 295)
@@ -374,21 +374,28 @@
 				java.util.StringTokenizer st=new java.util.StringTokenizer(ns.getSchemaLocation());
 				
 				while (st.hasMoreTokens()) {
-					IFile file=cdmResource.getParent().getFile(new Path(st.nextToken()));
+					String location=st.nextToken();
+					IFile file=cdmResource.getParent().getFile(new Path(location));
 					
 					javax.wsdl.Import imp=firstDefn.createImport();
 					
 					imp.setDefinition(defn);
 					imp.setNamespaceURI(ns.getURI());
-					imp.setLocationURI(file.getProjectRelativePath().toPortableString());
 					
+					if (file.exists()) {
+						imp.setLocationURI(file.getProjectRelativePath().toPortableString());
+						
+						// Copy schema file into generated BPEL project
+						IPath artifactPath=bpelFolderPath.append(file.getProjectRelativePath());
+						
+						IFile artifactFile=cdmResource.getProject().getWorkspace().getRoot().getFile(artifactPath);
+
+						copySchema(file, artifactFile, bpelFolderPath);
+					} else {
+						imp.setLocationURI(location);
+					}
+					
 					firstDefn.addImport(imp);					
-					
-					IPath artifactPath=bpelFolderPath.append(file.getProjectRelativePath());
-					
-					IFile artifactFile=cdmResource.getProject().getWorkspace().getRoot().getFile(artifactPath);
-
-					copySchema(file, artifactFile, bpelFolderPath);
 				}
 			}
 		}

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-07-02 20:29:50 UTC (rev 294)
+++ trunk/tools/eclipse/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java	2010-07-03 19:09:30 UTC (rev 295)
@@ -187,27 +187,22 @@
 								java.util.StringTokenizer st=new java.util.StringTokenizer(ns.getSchemaLocation());
 								
 								while (st.hasMoreTokens()) {
-									IFile file=cdmResource.getParent().getFile(new Path(st.nextToken()));
+									String location=st.nextToken();
+									IFile file=cdmResource.getParent().getFile(new Path(location));
 								
 									javax.wsdl.Import imp=defns.get(0).createImport();
 									
 									imp.setDefinition(defn);
 									imp.setNamespaceURI(ns.getURI());
-									imp.setLocationURI(file.getName());
 									
-									defns.get(0).addImport(imp);					
-									
-									IPath artifactPath=wsdlFolderPath.append(file.getName());
-						
-									IFile artifactFile=cdmResource.getProject().getWorkspace().getRoot().getFile(artifactPath);
-	
-									if (artifactFile.exists() == false) {
-										artifactFile.create(null, true,
-												new org.eclipse.core.runtime.NullProgressMonitor());
+									if (file.exists()) {
+										IPath relative=file.getFullPath().makeRelativeTo(wsdlFolderPath);
+										imp.setLocationURI(relative.toPortableString());
+									} else {
+										imp.setLocationURI(location);
 									}
 									
-									artifactFile.setContents(file.getContents(), true, false,
-												new org.eclipse.core.runtime.NullProgressMonitor());
+									defns.get(0).addImport(imp);					
 								}
 							}
 						}



More information about the savara-commits mailing list