[297653]  the major implementation of converting j2ee deployment to the new flat virtual component APIs
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/ChildModuleReference.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/ChildModuleReference.java
index e2d83d9..f48af99 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/ChildModuleReference.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/ChildModuleReference.java
@@ -12,7 +12,10 @@
 
 import java.io.File;
 
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
 import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
 import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
 
@@ -39,11 +42,13 @@
  *
  */
 public class ChildModuleReference implements IChildModuleReference {
+	private IProject project;
 	private File file;
 	private IVirtualComponent component;
 	private IVirtualReference reference;
 	private IPath uri;
-	public ChildModuleReference(IFlatFile f) {
+	public ChildModuleReference(IProject project, IFlatFile f) {
+		this.project = project;
 		this.file = f == null ? null : (File)f.getAdapter(File.class);
 		if( f != null && file != null ) {
 			this.uri = f.getModuleRelativePath().append(f.getName());
@@ -53,6 +58,7 @@
 	public ChildModuleReference(IVirtualReference reference, IPath root) {
 		this.reference = reference;
 		this.component = reference.getReferencedComponent();
+		this.project = this.component.getProject();
 		if( component.isBinary() ) {
 			File f = (File)component.getAdapter(File.class);
 			if( f.exists() && f.isFile()) {
@@ -79,7 +85,11 @@
 	 * @return
 	 */
 	public IVirtualComponent getComponent() {
-		return component;
+		if( component != null ) 
+			return component;
+		if( file != null ) 
+			return new VirtualArchiveComponent(project, VirtualArchiveComponent.LIBARCHIVETYPE + "/" + file.getAbsolutePath(), new Path("/"));
+		return null;
 	}
 	
 	/**
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlatVirtualComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlatVirtualComponent.java
index 65ab8f9..81894ba 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlatVirtualComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlatVirtualComponent.java
@@ -32,18 +32,6 @@
 			private static final long serialVersionUID = 1L;
 	}
 	
-	/**
-	 * An options key listing the export participants.
-	 * The value must be a List<IExportUtilParticipant>, 
-	 *  or simply an IExportUtilParticipant
-	 */
-	public static String PARTICIPANT_LIST = "org.eclipse.wst.common.componentcore.export.participantList";
-	
-	/**
-	 * The ExportModel (this) being used
-	 */
-	public static String EXPORT_MODEL = "org.eclipse.wst.common.componentcore.export.exportModel";
-	
 	private FlatComponentTaskModel dataModel;
 	private IVirtualComponent component;
 	private IFlattenParticipant[] participants;
@@ -181,7 +169,7 @@
 	public boolean shouldAddComponentFile(IVirtualComponent current, IFlatFile file) {
 		for( int i = 0; i < participants.length; i++ ) {
 			if( participants[i].isChildModule(component, dataModel, file)) {
-				ChildModuleReference child = new ChildModuleReference(file);
+				ChildModuleReference child = new ChildModuleReference(current.getProject(), file);
 				children.add(child); 
 				return false;
 			} else if( !participants[i].shouldAddExportableFile(component, current, dataModel, file))
@@ -202,12 +190,14 @@
 				if( !isChildModule(reference)) {
 					addUsedReference(vc, reference, root.append(reference.getRuntimePath()));
 				} else {
+					boolean duplicate = false;
 					ChildModuleReference cm = new ChildModuleReference(reference, root);
 					for( IChildModuleReference tmp : children ) {
 						if( tmp.getRelativeURI().equals(cm.getRelativeURI()))
-							return;
+							duplicate = true;
 					}
-					children.add(cm);
+					if( !duplicate )
+						children.add(cm);
 				}
 			}
     	}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlatVirtualComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlatVirtualComponent.java
index caf8d99..e6ed33f 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlatVirtualComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlatVirtualComponent.java
@@ -13,6 +13,19 @@
 import org.eclipse.core.runtime.CoreException;
 
 public interface IFlatVirtualComponent {
+	
+	/**
+	 * An options key listing the export participants.
+	 * The value must be a List<IExportUtilParticipant>, 
+	 *  or simply an IExportUtilParticipant
+	 */
+	public static String PARTICIPANT_LIST = "org.eclipse.wst.common.componentcore.export.participantList";
+	
+	/**
+	 * The ExportModel (this) being used
+	 */
+	public static String EXPORT_MODEL = "org.eclipse.wst.common.componentcore.export.exportModel";
+
 	public IFlatResource[] fetchResources() throws CoreException;
 	public IChildModuleReference[] getChildModules() throws CoreException;
 }
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/VirtualComponentFlattenUtility.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/VirtualComponentFlattenUtility.java
index dda9492..b18f82e 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/VirtualComponentFlattenUtility.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/VirtualComponentFlattenUtility.java
@@ -117,11 +117,16 @@
 		}
 		if( mf != null ) {
 			if (handler == null || handler.shouldAddComponentFile(current, mf)) {
-				if( mf.getModuleRelativePath().isEmpty() )
+				if( mf.getModuleRelativePath().isEmpty()) {
+					members.remove(mf);
 					members.add(mf);
+				}
 				else {
 					IFlatFolder moduleParent = VirtualComponentFlattenUtility.ensureParentExists(members, mf.getModuleRelativePath(), null);
-					VirtualComponentFlattenUtility.addMembersToModuleFolder((FlatFolder)moduleParent, new IFlatResource[] {mf});
+					List tempParentMembers = new ArrayList(Arrays.asList(moduleParent.members()));
+					tempParentMembers.remove(mf);
+					tempParentMembers.add(mf);
+					moduleParent.setMembers((IFlatResource[]) tempParentMembers.toArray(new IFlatResource[tempParentMembers.size()]));
 				}
 			}
 		}
@@ -188,7 +193,7 @@
 	    			startsWith(moduleSegments, pathSegments) && pathSegments.length > moduleSegments.length &&
 	    			exportableResource.getName().equals(pathSegments[moduleSegments.length > 0 ? moduleSegments.length : 0]))	    	  
     			if (((FlatFolder)exportableResource).members()!=null)
-    				return getExistingModuleResource(Arrays.asList(((FlatFolder)exportableResource).members()),path);		
+    				return getExistingModuleResource(Arrays.asList(((FlatFolder)exportableResource).members()),path);
     	}
     	return null;
     }