Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326576

Summary: When importing an EAR archive, the Component file's Archive names and Deployment Paths are incorrect
Product: [WebTools] WTP Java EE Tools Reporter: Scott Huff <shuff>
Component: jst.j2eeAssignee: Scott Huff <shuff>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: ccc, jsholl
Version: 3.2Flags: cbridgha: review+
Target Milestone: 3.2.2 P   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch file alters EARComponentImportOperation.java
none
Patch file alters EARComponentImportOperation.java
none
ArchiveName and DeployPath fix ccc: iplog+

Description Scott Huff CLA 2010-09-29 14:57:20 EDT
Created attachment 179884 [details]
Patch file alters EARComponentImportOperation.java

If the deploy-path of any modules are modified before exporting a project as an Ear, when you later import the EAR, you will see that the generated archiveName fields in the 'org.eclipse.wst.common.component' file are set to the full path of the module and the deploy-path is always set to the default, '/'.

Steps to recreate:
1) Create an EAR 5 project with all default modules and with a DD
2) Open the application.xml file and modify all the URIs to include a folder (i.e. /1/TestEAR5Web.war, /2/TestEAR5EJB.jar, etc)
3) Export the EAR project.
4) Import the EAR file. (You will see that the archiveName fields in the 'org.eclipse.wst.common.component' file are generated as full paths, ie: '1/TestEAR5Web.war' and the deploy-paths are set to '/')



Proposed patch:
Changes the value passed to the TARGET_COMPONENTS_TO_URI_MAP to the last segment
   of the full uri path (the file name), this map is used by getArchiveName and
   was previously being passed the full uri path.
Sets the TARGET_COMPONENTS_DEPLOY_PATH_MAP to a mapping of each component to each
   components uri minus the file name ... previously the deploy path map field
   was never being set, and when checked, the defualt "/" was used when nothing
   was found.
Comment 1 Scott Huff CLA 2010-09-29 15:42:17 EDT
Review requests removed, issues found in proposed patch
Comment 2 Scott Huff CLA 2010-09-30 11:24:54 EDT
While investigating the problems in this patch it was discovered that, in EARComponentImportOperation.java, a check (line 153) of whether or not a component is already in the DD or not, is incorrect; At import, all components are currently treated as if they are not already in the DD.

To Recreate:
-Create a new Ear project with a DD and all default modules.
-Export the Ear, then Import the Ear.
-Compare the component file and the aplication.xml, the module id entries are missing from the component file.
Comment 3 Scott Huff CLA 2010-09-30 11:27:32 EDT
Created attachment 179971 [details]
Patch file alters EARComponentImportOperation.java

new proposed patch:
-Fixes problems with original patch
-Fixes the newly discovered issue of missing module IDs
Comment 4 Chuck Bridgham CLA 2010-09-30 13:19:01 EDT
approve
Comment 5 Scott Huff CLA 2010-09-30 14:59:45 EDT
Created attachment 179989 [details]
ArchiveName and DeployPath fix

It has been decided that the issue involving the component ID not being added to the component file will be separated out and targeted for 802 for a more in depth rewrite of this import code. As such, a new patch has been posted here, rolling back to the patch fixes addressing the problems with the first proposed patch, but excluding the added fix for the missing component ID.
Comment 6 Jason Sholl CLA 2010-10-01 09:57:14 EDT
code checked into both 32M and HEAD for WTP 3.2.3 and 3.3 respectively.
Comment 7 Carl Anderson CLA 2010-10-09 08:21:38 EDT
Committed to R3_2_2_patches