Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 296538 - Publish to the server does not preserve sub-directories
Summary: Publish to the server does not preserve sub-directories
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BPEL (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: BPEL Runtime Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-30 21:35 EST by Terry CLA
Modified: 2022-10-03 11:11 EDT (History)
2 users (show)

See Also:


Attachments
Patch to preserve the folder structure (3.09 KB, patch)
2009-11-30 21:37 EST, Terry CLA
no flags Details | Diff
Patch to preserve the folder structure (2.12 KB, patch)
2009-11-30 21:41 EST, Terry CLA
bbrodt: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Terry CLA 2009-11-30 21:35:34 EST
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091105 Fedora/3.5.5-1.fc12 Firefox/3.5.5
Build Identifier: Build id: M20090917-0800

We store some WSDL and XSD files in subfolders of the process, but the "Publish to the server" button does not preserve the directory structure.

Reproducible: Always

Steps to Reproduce:
1. Create sub-folders in the process folder
2. Click "Publish to the server"
3. All the files in the sub-folder are deployed directly into the process folder
Comment 1 Terry CLA 2009-11-30 21:37:30 EST
Created attachment 153410 [details]
Patch to preserve the folder structure
Comment 2 Terry CLA 2009-11-30 21:40:08 EST
Comment on attachment 153410 [details]
Patch to preserve the folder structure

Index: src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java,v
retrieving revision 1.2
diff -u -r1.2 OdeBPELPublisher.java
--- src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java	11 Nov 2009 19:03:09 -0000	1.2
+++ src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java	1 Dec 2009 02:42:59 -0000
@@ -63,7 +63,7 @@
 				
 				if (doesDeploymentDescriptorExist(files)){
 					
-					String currentDeployDir = createDeploymentDestination(module);
+					File currentDeployDir = new File(createDeploymentDestination(module));
 					
 					for (IFile file : files) {
 
@@ -73,7 +73,7 @@
 					}
 
 					//remove <project>.deployed to kick the redeployment
-					new File(new File(currentDeployDir).getParent(), new File(currentDeployDir).getName() + ".deployed").delete();
+					new File(currentDeployDir.getParent(), currentDeployDir.getName() + ".deployed").delete();
 
 					result[i] = new Status(IStatus.OK, OdePlugin.PLUGIN_ID, 1,
 							"Deployment successful", null);
@@ -203,15 +203,18 @@
 		return dir.delete();
 	}
 
-	private void copyFileToDeploymentDestination(IFile ifile, String toDeployDir) {
+	private void copyFileToDeploymentDestination(IFile ifile, File toDeployDir) {
 
-		String from = ifile.getFullPath().toOSString();
-		String fileName = ifile.getName();
-		String wspath = ifile.getWorkspace().getRoot().getLocation().toOSString();
+		String toDeployDirName = toDeployDir.getName();
+		String absoluteFilename = ifile.getFullPath().toPortableString();
+		String fileName = absoluteFilename.substring(absoluteFilename
+				.lastIndexOf(toDeployDirName)
+				+ 1 + toDeployDirName.length());
 
 		//bugzilla 284658
 		File srcFile = ifile.getLocation().toFile();
-		File targetFile = new File(toDeployDir + System.getProperty("file.separator") + fileName);
+		File targetFile = new File(toDeployDir, fileName);
+		targetFile.getParentFile().mkdirs();
 		
 		if (srcFile != null && srcFile.exists()) {
Comment 3 Terry CLA 2009-11-30 21:40:47 EST
Comment on attachment 153410 [details]
Patch to preserve the folder structure

Index: src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java,v
retrieving revision 1.2
diff -u -r1.2 OdeBPELPublisher.java
--- src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java	11 Nov 2009 19:03:09 -0000	1.2
+++ src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java	1 Dec 2009 02:42:59 -0000
@@ -63,7 +63,7 @@
 				
 				if (doesDeploymentDescriptorExist(files)){
 					
-					String currentDeployDir = createDeploymentDestination(module);
+					File currentDeployDir = new File(createDeploymentDestination(module));
 					
 					for (IFile file : files) {
 
@@ -73,7 +73,7 @@
 					}
 
 					//remove <project>.deployed to kick the redeployment
-					new File(new File(currentDeployDir).getParent(), new File(currentDeployDir).getName() + ".deployed").delete();
+					new File(currentDeployDir.getParent(), currentDeployDir.getName() + ".deployed").delete();
 
 					result[i] = new Status(IStatus.OK, OdePlugin.PLUGIN_ID, 1,
 							"Deployment successful", null);
@@ -203,15 +203,18 @@
 		return dir.delete();
 	}
 
-	private void copyFileToDeploymentDestination(IFile ifile, String toDeployDir) {
+	private void copyFileToDeploymentDestination(IFile ifile, File toDeployDir) {
 
-		String from = ifile.getFullPath().toOSString();
-		String fileName = ifile.getName();
-		String wspath = ifile.getWorkspace().getRoot().getLocation().toOSString();
+		String toDeployDirName = toDeployDir.getName();
+		String absoluteFilename = ifile.getFullPath().toPortableString();
+		String fileName = absoluteFilename.substring(absoluteFilename
+				.lastIndexOf(toDeployDirName)
+				+ 1 + toDeployDirName.length());
 
 		//bugzilla 284658
 		File srcFile = ifile.getLocation().toFile();
-		File targetFile = new File(toDeployDir + System.getProperty("file.separator") + fileName);
+		File targetFile = new File(toDeployDir, fileName);
+		targetFile.getParentFile().mkdirs();
 		
 		if (srcFile != null && srcFile.exists()) {
Comment 4 Terry CLA 2009-11-30 21:41:14 EST
Created attachment 153411 [details]
Patch to preserve the folder structure
Comment 5 Simon Moser CLA 2009-12-07 11:50:13 EST
reviewed, tested and released the fix to CVS HEAD stream
Comment 6 Robert Brodt CLA 2012-04-18 14:57:17 EDT
Comment on attachment 153411 [details]
Patch to preserve the folder structure

Updated iplog flag for v1.0 release review.