Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 80180 Details for
Bug 206086
Improved archive support for EE5
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
initial patch
206086.txt (text/plain), 50.32 KB, created by
Jason Sholl
on 2007-10-11 16:37:49 EDT
(
hide
)
Description:
initial patch
Filename:
MIME Type:
Creator:
Jason Sholl
Created:
2007-10-11 16:37:49 EDT
Size:
50.32 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.j2ee >Index: archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveWrapper.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveWrapper.java,v >retrieving revision 1.4 >diff -u -r1.4 ArchiveWrapper.java >--- archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveWrapper.java 14 Aug 2007 03:20:09 -0000 1.4 >+++ archiveops/org/eclipse/jst/j2ee/internal/archive/ArchiveWrapper.java 11 Oct 2007 20:36:29 -0000 >@@ -28,6 +28,7 @@ > import org.eclipse.jst.j2ee.ejb.EJBJar; > import org.eclipse.jst.j2ee.internal.J2EEConstants; > import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; >+import org.eclipse.jst.j2ee.internal.archive.operations.EARArchiveOpsResourceHandler; > import org.eclipse.jst.javaee.application.Application; > import org.eclipse.jst.javaee.application.Module; > import org.eclipse.jst.jee.archive.ArchiveModelLoadException; >@@ -38,6 +39,8 @@ > > public class ArchiveWrapper { > >+ //TODO remove commonArchive; possibly remove this entire class and >+ //code directly to IArchive > private Archive commonArchive = null; > private IArchive archive = null; > private JavaEEQuickPeek jqp = null; >@@ -333,14 +336,29 @@ > if (archive != null) { > IArchive earArchive = archive.getArchive(); > if(earArchive.containsArchiveResource(new Path(J2EEConstants.APPLICATION_DD_URI))){ >- Application application; >- try { >- application = (Application) earArchive.getModelObject(); >- String moduleName = archive.getPath().toString(); >- Module module = (Module) application.getFirstModule(moduleName); >- cachedWebContextRoot[0] = module.getWeb().getContextRoot(); >- } catch (ArchiveModelLoadException e) { >- Logger.getLogger().logError(e); >+ JavaEEQuickPeek earJQP = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(earArchive); >+ if(earJQP.getJavaEEVersion() == JavaEEQuickPeek.JEE_5_0_ID){ >+ try { >+ Application application = (Application) earArchive.getModelObject(); >+ String moduleName = archive.getPath().toString(); >+ Module module = (Module) application.getFirstModule(moduleName); >+ cachedWebContextRoot[0] = module.getWeb().getContextRoot(); >+ } catch (ArchiveModelLoadException e) { >+ Logger.getLogger().logError(e); >+ } >+ } else { >+ try{ >+ org.eclipse.jst.j2ee.application.Application application = (org.eclipse.jst.j2ee.application.Application)earArchive.getModelObject(); >+ String moduleName = archive.getPath().toString(); >+ org.eclipse.jst.j2ee.application.WebModule module = (org.eclipse.jst.j2ee.application.WebModule)application.getFirstModule(moduleName); >+ if(module == null){ >+ cachedWebContextRoot[0] = null; >+ } else { >+ cachedWebContextRoot[0] = module.getContextRoot(); >+ } >+ } catch (ArchiveModelLoadException e) { >+ Logger.getLogger().logError(e); >+ } > } > } else { > //J2EE spec 8.3.1.3.c (pg 149) >@@ -386,29 +404,36 @@ > if (archive != null) { > try { > JavaEEQuickPeek jqp = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(ejbWrapper.archive); >- String clientJar = null; >+ String clientJarName = null; > if(jqp.getVersion() == J2EEVersionConstants.EJB_3_0_ID){ > if(ejbWrapper.archive.containsArchiveResource(new Path(J2EEConstants.EJBJAR_DD_URI))){ > org.eclipse.jst.javaee.ejb.EJBJar edd = (org.eclipse.jst.javaee.ejb.EJBJar) ejbWrapper.archive.getModelObject(); >- clientJar = edd.getEjbClientJar(); >+ clientJarName = edd.getEjbClientJar(); > } > } else { > EJBJar jar = (EJBJar)ejbWrapper.archive.getModelObject(); > if (jar != null) { >- clientJar = jar.getEjbClientJar(); >+ clientJarName = jar.getEjbClientJar(); > } > } > >- if (null != clientJar) { >- IArchiveResource ar = archive.getArchiveResource(new Path(clientJar)); >- if (ar.getType() == IArchiveResource.ARCHIVE_TYPE) { >- cachedEJBClientArchiveWrapper[0] = new ArchiveWrapper((IArchive) ar); >- } else { >- try { >- cachedEJBClientArchiveWrapper[0] = new ArchiveWrapper(archive.getNestedArchive(ar)); >- } catch (ArchiveOpenFailureException e) { >- Logger.getLogger().logError(e); >+ if (null != clientJarName) { >+ IPath clientJarPath = new Path(clientJarName); >+ if(archive.containsArchiveResource(clientJarPath)){ >+ IArchiveResource clientJar = archive.getArchiveResource(clientJarPath); >+ if(null != clientJar){ >+ if (clientJar.getType() == IArchiveResource.ARCHIVE_TYPE) { >+ cachedEJBClientArchiveWrapper[0] = new ArchiveWrapper((IArchive) clientJar); >+ } else { >+ try { >+ cachedEJBClientArchiveWrapper[0] = new ArchiveWrapper(archive.getNestedArchive(clientJar)); >+ } catch (ArchiveOpenFailureException e) { >+ Logger.getLogger().logError(e); >+ } >+ } > } >+ } else { >+ Logger.getLogger().logWarning(EARArchiveOpsResourceHandler.bind(EARArchiveOpsResourceHandler.MISSING_CLIENT_JAR, new Object[] {clientJarName, ejbWrapper.getName(), archive.getPath()})); > } > } > return cachedEJBClientArchiveWrapper[0]; >@@ -475,4 +500,5 @@ > fail(); > return null; > } >+ > } >\ No newline at end of file >Index: archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveSaveAdapter.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveSaveAdapter.java,v >retrieving revision 1.4 >diff -u -r1.4 J2EEComponentArchiveSaveAdapter.java >--- archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveSaveAdapter.java 10 Jul 2007 21:39:48 -0000 1.4 >+++ archiveops/org/eclipse/jst/j2ee/internal/archive/J2EEComponentArchiveSaveAdapter.java 11 Oct 2007 20:36:29 -0000 >@@ -141,13 +141,6 @@ > return super.getProjectRelativePath(aFile); > } > >- protected IPath getOutputPathForFile(IArchiveResource aFile) { >- if (endsWithClassType(aFile.getPath().lastSegment())) { >- return importedClassesFolder.getFile(getImportedClassesURI(aFile)).getProjectRelativePath(); >- } >- return super.getProjectRelativePath(aFile); >- } >- > protected IPath getImportedClassesURI(IArchiveResource aFile) { > return aFile.getPath(); > } >Index: archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFArchiveAdapterHelper.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFArchiveAdapterHelper.java,v >retrieving revision 1.2 >diff -u -r1.2 JavaEEEMFArchiveAdapterHelper.java >--- archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFArchiveAdapterHelper.java 22 May 2007 19:43:47 -0000 1.2 >+++ archiveops/org/eclipse/jst/j2ee/internal/archive/JavaEEEMFArchiveAdapterHelper.java 11 Oct 2007 20:36:29 -0000 >@@ -185,6 +185,7 @@ > if (isTranslator) { > try { > Constructor constructor = resourceFactory.getClass().getConstructor(RendererFactory.class); >+ EMF2SAXRendererFactory.INSTANCE.setValidating(false); > resourceFactory = (Resource.Factory) constructor.newInstance(EMF2SAXRendererFactory.INSTANCE); > } catch (SecurityException e) { > ArchiveUtil.warn(e); >Index: archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveSaveAdapter.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveSaveAdapter.java,v >retrieving revision 1.2 >diff -u -r1.2 WebComponentArchiveSaveAdapter.java >--- archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveSaveAdapter.java 7 Jun 2007 19:28:10 -0000 1.2 >+++ archiveops/org/eclipse/jst/j2ee/internal/archive/WebComponentArchiveSaveAdapter.java 11 Oct 2007 20:36:29 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.jst.j2ee.internal.archive; > >+import java.io.FileNotFoundException; >+import java.util.HashMap; > import java.util.Map; > > import org.eclipse.core.resources.IFile; >@@ -17,13 +19,15 @@ > import org.eclipse.core.runtime.Path; > import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants; > import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil; >-import org.eclipse.jst.jee.archive.IArchive; >+import org.eclipse.jst.jee.archive.IArchiveResource; > import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; > import org.eclipse.wst.common.componentcore.resources.IVirtualFile; > import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; > > public class WebComponentArchiveSaveAdapter extends J2EEComponentArchiveSaveAdapter { > >+ private IPath IMPORTED_CLASSES_PATH = new Path("/" + ArchiveConstants.WEBAPP_CLASSES_URI); >+ > public WebComponentArchiveSaveAdapter(IVirtualComponent vComponent) { > super(vComponent); > } >@@ -32,36 +36,37 @@ > return false; // never add to classpath because the web app container will pick this up. > } > >- protected String getImportedClassesURI(IArchive aFile){ >- return aFile.getPath().lastSegment().toString(); >- >+ protected IPath getImportedClassesURI(IArchiveResource aFile){ >+ return aFile.getPath().makeRelative().removeFirstSegments(IMPORTED_CLASSES_PATH.segmentCount()); > } > > protected IPath getImportedClassesRuntimePath() { >- return new Path("/" + ArchiveConstants.WEBAPP_CLASSES_URI); >+ return IMPORTED_CLASSES_PATH; > } >- >- protected IPath getOutputPathForFile(IArchive aFile) { >+ >+ protected IPath getProjectRelativePath(IArchiveResource aFile) { > if (null != nonStandardSourceFiles && nonStandardSourceFiles.containsKey(aFile)) { >+ IPath path = nonStandardSourceFiles.get(aFile); > IVirtualFolder rootFolder = vComponent.getRootFolder(); >- IVirtualFile vFile = rootFolder.getFile((String) nonStandardSourceFiles.get(aFile)); >+ IVirtualFile vFile = rootFolder.getFile(path); > IFile iFile = vFile.getUnderlyingFile(); > return iFile.getProjectRelativePath(); > } >- return super.getOutputPathForFile(aFile); >+ return super.getProjectRelativePath(aFile); > } > > /** > * This map handles the case when a java source file is not in the same place as the .class > * file. For example if all the source files were contained in WEB-INF/source > */ >- protected Map nonStandardSourceFiles; >+ protected Map<IArchiveResource, IPath> nonStandardSourceFiles; > >- protected boolean isClassWithoutSource(IArchive aFile) { >+ protected boolean isClassWithoutSource(IArchiveResource aFile) { > String javaUri = ArchiveUtil.classUriToJavaUri(aFile.getPath().toString()); > if (javaUri == null) >- return false; >- if (archive.containsArchiveResource(aFile.getPath())) { >+ return true; >+ IPath javaPath = new Path(javaUri); >+ if (archive.containsArchiveResource(javaPath)) { > return false; > } > // see if it is a JSP >@@ -70,22 +75,41 @@ > int _index = lastSlash == -1 ? ArchiveConstants.WEBAPP_CLASSES_URI.length() : lastSlash + 1; > if (jspUri.charAt(_index) == '_') { > jspUri = jspUri.substring(ArchiveConstants.WEBAPP_CLASSES_URI.length(), _index) + jspUri.substring(_index + 1) + ArchiveUtil.DOT_JSP; >- if (archive.containsArchiveResource(aFile.getPath())) { >+ IPath jspPath = new Path(jspUri); >+ if (archive.containsArchiveResource(jspPath)) { > return false; > } > } > >- // see if the source is in another directory >- /*File sourceFile = ((WARFile) archive).getSourceFile(aFile); >- if (null == sourceFile) { >- return true; >- }*/ >- /*if (nonStandardSourceFiles == null) { >- nonStandardSourceFiles = new HashMap(); >+ //This is to handle archives created by an earlier version >+ //The format was to include the source files in a directory called source in WEB-INF >+ //Example: class is in WEB-INF/classes/test/Foo.class >+ // source is in WEB-INF/source/test/Foo.java >+ if(javaPath.segmentCount() > 2 && javaPath.segment(0).equals("WEB-INF") && javaPath.segment(1).equals("classes")){ >+ String alternateJavaUri = javaUri.replaceFirst("classes", "source"); >+ IPath alternateJavaPath = new Path(alternateJavaUri); >+ if (archive.containsArchiveResource(alternateJavaPath)){ >+ IArchiveResource sourceFile; >+ try { >+ sourceFile = archive.getArchiveResource(alternateJavaPath); >+ if(sourceFile != null){ >+ if (nonStandardSourceFiles == null) { >+ nonStandardSourceFiles = new HashMap<IArchiveResource, IPath>(); >+ } >+ if (!nonStandardSourceFiles.containsKey(sourceFile)) { >+ nonStandardSourceFiles.put(sourceFile, javaPath); >+ } >+ return false; >+ } >+ } catch (FileNotFoundException e) { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } >+ >+ } >+ > } >- if (!nonStandardSourceFiles.containsKey(sourceFile)) { >- nonStandardSourceFiles.put(sourceFile, javaUri); >- }*/ >- return false; >+ >+ return true; > } > } >Index: earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java,v >retrieving revision 1.25 >diff -u -r1.25 EARComponentImportDataModelProvider.java >--- earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java 18 Jul 2007 19:59:37 -0000 1.25 >+++ earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java 11 Oct 2007 20:36:29 -0000 >@@ -158,7 +158,8 @@ > if (NESTED_MODULE_ROOT.equals(propertyName)) { > updateModuleRoot(); > } else if (FILE_NAME.equals(propertyName)) { >- setProperty(MODULE_MODELS_LIST, getModuleModels()); >+ List nestedModels = getModuleModels(); >+ setProperty(MODULE_MODELS_LIST, nestedModels); > updateModuleRoot(); > setProperty(UTILITY_LIST, null); > >@@ -168,8 +169,20 @@ > IDataModel earFacetDataModel = map.getFacetDataModel(J2EEProjectUtilities.ENTERPRISE_APPLICATION); > > JavaEEQuickPeek quickPeek = getArchiveWrapper().getJavaEEQuickPeek(); >- int version = quickPeek.getVersion(); >- String versionText = J2EEVersionUtil.getJ2EETextVersion(version); >+ int minimumVersion = quickPeek.getVersion(); >+ if(nestedModels != null){ >+ //increase the JavaEE facet version to accommodate the highest module version >+ for(int i=0;i<nestedModels.size(); i++){ >+ IDataModel nestedModel = (IDataModel)nestedModels.get(i); >+ ArchiveWrapper nestedWrapper = (ArchiveWrapper)nestedModel.getProperty(ARCHIVE_WRAPPER); >+ int nestedEEVersion = nestedWrapper.getJavaEEQuickPeek().getJavaEEVersion(); >+ if(nestedEEVersion > minimumVersion){ >+ minimumVersion = nestedEEVersion; >+ } >+ } >+ } >+ >+ String versionText = J2EEVersionUtil.getJ2EETextVersion(minimumVersion); > earFacetDataModel.setStringProperty(IFacetDataModelProperties.FACET_VERSION_STR, versionText); > } > >Index: earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java,v >retrieving revision 1.26 >diff -u -r1.26 J2EEArtifactImportDataModelProvider.java >--- earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java 14 Aug 2007 03:20:08 -0000 1.26 >+++ earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java 11 Oct 2007 20:36:29 -0000 >@@ -198,33 +198,17 @@ > > protected ArchiveWrapper openArchiveWrapper(String uri) throws OpenFailureException, ArchiveOpenFailureException{ > IArchive archive = null; >- boolean isEE5 = false; >- try{ >- IPath path = new Path(uri); >- archive = JavaEEArchiveUtilities.INSTANCE.openArchive(path); >- archive.getArchiveOptions().setOption(JavaEEArchiveUtilities.DISCRIMINATE_EJB_ANNOTATIONS, Boolean.TRUE); >- archive.setPath(path); >- JavaEEQuickPeek jqp = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archive); >- >- if(jqp.getJavaEEVersion() == J2EEConstants.UNKNOWN && jqp.getType() == J2EEConstants.UNKNOWN){ >- handleUnknownType(jqp); >- } >- >- if(jqp.getJavaEEVersion() == J2EEConstants.JEE_5_0_ID){ >- isEE5 = true; >- return new ArchiveWrapper(archive); >- } else { >- Archive commonArchive = openArchive(uri); >- if (null != commonArchive) { >- commonArchive.setSaveFilter(getSaveFilter()); >- } >- return new ArchiveWrapper(commonArchive); >- } >- } finally { >- if(!isEE5){ >- JavaEEArchiveUtilities.INSTANCE.closeArchive(archive); >- } >+ IPath path = new Path(uri); >+ archive = JavaEEArchiveUtilities.INSTANCE.openArchive(path); >+ archive.getArchiveOptions().setOption(JavaEEArchiveUtilities.DISCRIMINATE_EJB_ANNOTATIONS, Boolean.TRUE); >+ archive.setPath(path); >+ JavaEEQuickPeek jqp = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archive); >+ >+ if(jqp.getJavaEEVersion() == J2EEConstants.UNKNOWN && jqp.getType() == J2EEConstants.UNKNOWN){ >+ handleUnknownType(jqp); > } >+ >+ return new ArchiveWrapper(archive); > } > /** > * This method allows subclasses to handle an unknown archive type. >Index: earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java,v >retrieving revision 1.30 >diff -u -r1.30 AddComponentToEnterpriseApplicationOp.java >--- earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java 7 Jun 2007 19:28:12 -0000 1.30 >+++ earproject/org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp.java 11 Oct 2007 20:36:29 -0000 >@@ -29,6 +29,7 @@ > import org.eclipse.jem.util.UIContextDetermination; > import org.eclipse.jem.util.logger.proxy.Logger; > import org.eclipse.jst.j2ee.internal.J2EEConstants; >+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; > import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater; > import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; > import org.eclipse.jst.j2ee.model.IEARModelProvider; >@@ -154,7 +155,7 @@ > ICommonModule newModule = null; > final IVirtualComponent ear = (IVirtualComponent) this.model.getProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT); > final IProject earpj = ear.getProject(); >- boolean useNewModel = J2EEProjectUtilities.isJEEProject(earpj); >+ boolean useNewModel = J2EEProjectUtilities.getJ2EEDDProjectVersion(earpj).equals(J2EEVersionConstants.VERSION_5_0_TEXT); > if (J2EEProjectUtilities.isDynamicWebProject(wc.getProject())) { > Properties props = wc.getMetaProperties(); > String contextroot = ""; //$NON-NLS-1$ >Index: archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java,v >retrieving revision 1.33 >diff -u -r1.33 J2EEArtifactImportOperation.java >--- archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java 7 Jun 2007 19:28:15 -0000 1.33 >+++ archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java 11 Oct 2007 20:36:29 -0000 >@@ -24,6 +24,7 @@ > import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties; > import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper; > import org.eclipse.jst.j2ee.internal.archive.ComponentArchiveSaveAdapter; >+import org.eclipse.jst.j2ee.internal.archive.ConnectorComponentArchiveSaveAdapter; > import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater; > import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler; > import org.eclipse.jst.jee.archive.ArchiveOptions; >@@ -85,7 +86,9 @@ > * @throws ExecutionException > */ > protected void doExecute(IProgressMonitor monitor) throws ExecutionException { >- virtualComponent = createVirtualComponent(model.getNestedModel(IJ2EEComponentImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION), new SubProgressMonitor(monitor, PROJECT_CREATION_WORK)); >+ IDataModel nestedModel = model.getNestedModel(IJ2EEComponentImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION); >+ IProgressMonitor subMonitor = new SubProgressMonitor(monitor, PROJECT_CREATION_WORK); >+ virtualComponent = createVirtualComponent(nestedModel, subMonitor); > > try { > importModuleFile(new SubProgressMonitor(monitor, archiveWrapper.getSize())); >@@ -117,7 +120,7 @@ > } > > protected ComponentArchiveSaveAdapter getArchiveSaveAdapter(IVirtualComponent virtualComponent){ >- return null; >+ return new ConnectorComponentArchiveSaveAdapter(virtualComponent); > } > > /** >Index: archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARArchiveOpsResourceHandler.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARArchiveOpsResourceHandler.java,v >retrieving revision 1.2 >diff -u -r1.2 EARArchiveOpsResourceHandler.java >--- archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARArchiveOpsResourceHandler.java 9 Nov 2005 20:56:02 -0000 1.2 >+++ archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARArchiveOpsResourceHandler.java 11 Oct 2007 20:36:29 -0000 >@@ -15,7 +15,7 @@ > public final class EARArchiveOpsResourceHandler extends NLS { > > private static final String BUNDLE_NAME = "eararchiveops";//$NON-NLS-1$ >- >+ > private EARArchiveOpsResourceHandler() { > // Do not instantiate > } >@@ -40,6 +40,7 @@ > public static String _jar_UI_; > public static String Updating_manifest_Class_Path__attributes_UI_; > public static String _preDeploy_ERROR_; >+ public static String MISSING_CLIENT_JAR; > > static { > NLS.initializeMessages(BUNDLE_NAME, EARArchiveOpsResourceHandler.class); >Index: archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java,v >retrieving revision 1.29 >diff -u -r1.29 EARComponentImportOperation.java >--- archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java 7 Jun 2007 19:28:15 -0000 1.29 >+++ archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java 11 Oct 2007 20:36:29 -0000 >@@ -22,8 +22,6 @@ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.SubProgressMonitor; > import org.eclipse.jem.util.logger.proxy.Logger; >-import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider; >-import org.eclipse.jst.j2ee.application.internal.operations.IAddComponentToEnterpriseApplicationDataModelProperties; > import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile; > import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants; > import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy; >@@ -36,6 +34,7 @@ > import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties; > import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties; > import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties; >+import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider; > import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; > import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; > import org.eclipse.wst.common.frameworks.datamodel.IDataModel; >@@ -142,10 +141,10 @@ > componentToURIMap.put(component, nestedArchive.getPath().toString()); > } > if (componentToAdd.size() > 0) { >- IDataModel addComponentsDM = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider()); >+ IDataModel addComponentsDM = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider()); > addComponentsDM.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, virtualComponent); > addComponentsDM.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, componentToAdd); >- addComponentsDM.setProperty(IAddComponentToEnterpriseApplicationDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, componentToURIMap); >+ addComponentsDM.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, componentToURIMap); > addComponentsDM.getDefaultOperation().execute(new SubProgressMonitor(monitor, LINK_COMPONENTS_WORK), info); > } > } finally { >Index: earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java,v >retrieving revision 1.11 >diff -u -r1.11 EARVirtualComponent.java >--- earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java 26 Jul 2007 15:36:14 -0000 1.11 >+++ earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java 11 Oct 2007 20:36:29 -0000 >@@ -102,6 +102,8 @@ > } else { > if (referencedIVirtualComponent.isBinary()) { > archiveName = getJarURI(referencedComponent, referencedIVirtualComponent); >+ } else if(referencedComponent.getArchiveName() != null){ >+ archiveName = referencedComponent.getArchiveName(); > } else { > IProject referencedProject = referencedIVirtualComponent.getProject(); > // If dependent object is not set, assume >Index: j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java,v >retrieving revision 1.58.2.1 >diff -u -r1.58.2.1 J2EEProjectUtilities.java >--- j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java 2 Oct 2007 14:52:14 -0000 1.58.2.1 >+++ j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java 11 Oct 2007 20:36:29 -0000 >@@ -74,12 +74,14 @@ > import org.eclipse.jst.j2ee.project.facet.IJavaProjectMigrationDataModelProperties; > import org.eclipse.jst.j2ee.project.facet.JavaProjectMigrationDataModelProvider; > import org.eclipse.jst.j2ee.project.facet.JavaProjectMigrationOperation; >+import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek; > import org.eclipse.jst.server.core.FacetUtil; > import org.eclipse.wst.common.componentcore.ComponentCore; > import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil; > import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities; > import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; > import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; >+import org.eclipse.wst.common.componentcore.resources.IVirtualFile; > import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; > import org.eclipse.wst.common.componentcore.resources.IVirtualReference; > import org.eclipse.wst.common.componentcore.resources.IVirtualResource; >@@ -714,6 +716,72 @@ > } > return ""; //$NON-NLS-1$ > } >+ /** >+ * Returns the J2EE Module version based on the DD XML file >+ * @param project >+ * @return version String >+ */ >+ public static String getJ2EEDDProjectVersion(IProject project) { >+ int type = J2EEVersionConstants.UNKNOWN; >+ String ddURI = null; >+ if (J2EEProjectUtilities.isEARProject(project)) { >+ type = J2EEVersionConstants.APPLICATION_TYPE; >+ ddURI = J2EEConstants.APPLICATION_DD_URI; >+ } else if (J2EEProjectUtilities.isEJBProject(project)) { >+ type = J2EEVersionConstants.EJB_TYPE; >+ ddURI = J2EEConstants.EJBJAR_DD_URI; >+ } else if (J2EEProjectUtilities.isApplicationClientProject(project)) { >+ type = J2EEVersionConstants.APPLICATION_CLIENT_TYPE; >+ ddURI = J2EEConstants.APP_CLIENT_DD_URI; >+ } else if (J2EEProjectUtilities.isJCAProject(project)) { >+ type = J2EEVersionConstants.CONNECTOR_TYPE; >+ ddURI = J2EEConstants.RAR_DD_URI; >+ } else if (J2EEProjectUtilities.isDynamicWebProject(project)) { >+ type = J2EEVersionConstants.WEB_TYPE; >+ ddURI = J2EEConstants.WEBAPP_DD_URI; >+ } >+ >+ if(type != J2EEVersionConstants.UNKNOWN){ >+ IVirtualComponent comp = ComponentCore.createComponent(project); >+ if (comp != null) { >+ IVirtualFile vFile = comp.getRootFolder().getFile(new Path(ddURI)); >+ if(vFile.exists()){ >+ InputStream in= null; >+ try{ >+ in = vFile.getUnderlyingFile().getContents(); >+ JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(in); >+ int vers = (quickPeek.getVersion() == J2EEVersionConstants.UNKNOWN) ? getJEEVersion(project) : quickPeek.getVersion(); >+ return J2EEVersionUtil.convertVersionIntToString(vers); >+ } catch (CoreException e) { >+ Logger.getLogger().logError(e); >+ } finally { >+ if(in != null){ >+ try { >+ in.close(); >+ } catch (IOException e) { >+ Logger.getLogger().logError(e); >+ } >+ } >+ } >+ >+ } >+ } >+ } >+ >+ return null; >+ } >+ >+ >+ private static int getJEEVersion(IProject project) { >+ if (isEARProject(project) || isApplicationClientProject(project)) >+ return J2EEVersionConstants.VERSION_5_0; >+ if (isEJBProject(project)) >+ return J2EEVersionConstants.VERSION_3_0; >+ if (isDynamicWebProject(project)) >+ return J2EEVersionConstants.VERSION_2_5; >+ return J2EEVersionConstants.UNKNOWN; >+ >+ } > > public static IRuntime getServerRuntime(IProject project) throws CoreException { > if (project == null) >@@ -727,6 +795,11 @@ > return FacetUtil.getRuntime(runtime); > } > >+ /** >+ * Returns the J2EE Module version based on the project Facet installed >+ * @param project >+ * @return version String >+ */ > public static String getJ2EEProjectVersion(IProject project) { > String type = getJ2EEProjectType(project); > IFacetedProject facetedProject = null; >Index: property_files/eararchiveops.properties >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee/property_files/eararchiveops.properties,v >retrieving revision 1.3 >diff -u -r1.3 eararchiveops.properties >--- property_files/eararchiveops.properties 1 Dec 2005 22:21:38 -0000 1.3 >+++ property_files/eararchiveops.properties 11 Oct 2007 20:36:29 -0000 >@@ -33,3 +33,4 @@ > _jar_UI_=.jar > Updating_manifest_Class_Path__attributes_UI_=Updating manifest Class-Path: attributes > _preDeploy_ERROR_=IWAE0002E {0}.preDeploy >+MISSING_CLIENT_JAR=EJB Client Jar \"{0}\" for EJB Jar \"{1}\" missing from EAR \"{2}\". >#P org.eclipse.jst.j2ee.ejb >Index: ejbcreation/org/eclipse/jst/j2ee/ejb/componentcore/util/EJBArtifactEdit.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee.ejb/ejbcreation/org/eclipse/jst/j2ee/ejb/componentcore/util/EJBArtifactEdit.java,v >retrieving revision 1.45 >diff -u -r1.45 EJBArtifactEdit.java >--- ejbcreation/org/eclipse/jst/j2ee/ejb/componentcore/util/EJBArtifactEdit.java 11 Aug 2007 15:27:21 -0000 1.45 >+++ ejbcreation/org/eclipse/jst/j2ee/ejb/componentcore/util/EJBArtifactEdit.java 11 Oct 2007 20:36:30 -0000 >@@ -369,7 +369,8 @@ > aResource.setID(ejbJar, J2EEConstants.EJBJAR_ID); > // TODO add more mandatory elements > try { >- aResource.saveIfNecessary(); >+ if (aResource.isModified()) >+ aResource.saveIfNecessary(); > } catch (Exception e) { > // TODO Auto-generated catch block > e.printStackTrace(); >#P org.eclipse.jst.j2ee.tests >Index: j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/j2ee/verifiers/JEEImportDataModelVerifier.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/tests/org.eclipse.jst.j2ee.tests/j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/j2ee/verifiers/JEEImportDataModelVerifier.java,v >retrieving revision 1.2 >diff -u -r1.2 JEEImportDataModelVerifier.java >--- j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/j2ee/verifiers/JEEImportDataModelVerifier.java 10 Jul 2007 21:18:15 -0000 1.2 >+++ j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/j2ee/verifiers/JEEImportDataModelVerifier.java 11 Oct 2007 20:36:30 -0000 >@@ -8,9 +8,8 @@ > > import java.util.ArrayList; > import java.util.Collection; >-import java.util.HashMap; > import java.util.List; >-import java.util.Map; >+import java.util.StringTokenizer; > > import junit.framework.Assert; > >@@ -113,7 +112,7 @@ > AssertWarn.warnEquals("Archive type did not match imported project type", getExportType(), type); > } > >- String sProjVersion = J2EEProjectUtilities.getJ2EEProjectVersion(project); >+ String sProjVersion = J2EEProjectUtilities.getJ2EEDDProjectVersion(project); > int iProjVersion = J2EEVersionUtil.convertVersionStringToInt(sProjVersion); > int iVersionConstant = archiveQuickPeek.getVersion(); > if(iProjVersion != iVersionConstant){ >@@ -127,6 +126,37 @@ > Assert.assertTrue("A project with name, " + project.getName() + ", should have been created by import", project.exists()); > } > >+ >+ protected boolean isClassWithoutSource(IArchive archive, IArchiveResource aFile) { >+ String javaUri = classUriToJavaUri(aFile.getPath().toString()); >+ if (javaUri == null) >+ return false; >+ return !archive.containsArchiveResource(new Path(javaUri)); >+ } >+ >+ protected final String DOT_CLASS = ".class"; //$NON-NLS-1$ >+ >+ protected final String DOT_JAVA = ".java"; //$NON-NLS-1$ >+ >+ public String classUriToJavaUri(String classUri) { >+ if (classUri == null || !classUri.endsWith(DOT_CLASS)) >+ return null; >+ >+ String truncated = truncateIgnoreCase(classUri, DOT_CLASS); >+ StringTokenizer tok = new StringTokenizer(truncated, "$"); //$NON-NLS-1$ >+ return tok.nextToken().concat(DOT_JAVA); >+ } >+ >+ /** >+ * Return a substring of the first parameter, up to the last index of the >+ * second >+ */ >+ public static String truncateIgnoreCase(String aString, String trailingSubString) { >+ int index = aString.toLowerCase().lastIndexOf(trailingSubString.toLowerCase()); >+ if (index != -1) >+ return aString.substring(0, index); >+ return aString; >+ } > private void verifyAllFilesImported(IArchive archive) throws Exception { > List<IArchiveResource> resources = archive.getArchiveResources(); > IPath resourcePath = null; >@@ -137,15 +167,14 @@ > IFolder rootFolder = (IFolder)rootVirtFolder.getUnderlyingFolder(); > Assert.assertTrue("The root folder " + rootFolder.getName() + " should exist in the project" , rootFolder.exists()); > >- //when the foreach loops is done the classesMap will contain only thouse classes that were imported, >+ // when the for loops is done the classes will contain only those classes that were imported, > // the sourceResources list will contain a list of all of the java source resources, >- // the otherResources list will contain all other resources that arnt nested archives, >+ // the otherResources list will contain all other resources that are not nested archives, > // and any nested archive in this archive will have been set as a nested archive in 'archive' >- Map<String,IArchiveResource> classesMap = new HashMap<String,IArchiveResource>(); >+ List<IArchiveResource> classes = new ArrayList<IArchiveResource>(); > List<IArchiveResource> sourceResources = new ArrayList<IArchiveResource>(); > List<IArchiveResource> otherResources = new ArrayList<IArchiveResource>(); > >- String fileName = null; > String extension = null; > for(IArchiveResource resource : resources) { > resourcePath = resource.getPath(); >@@ -154,18 +183,12 @@ > case IArchiveResource.FILE_TYPE : > extension = resourcePath.getFileExtension(); > >- if(extension.equals(CLASS_EXTENSION) || extension.equals(JAVA_EXTENSION)) { >- fileName = resourcePath.removeFileExtension().lastSegment(); >- if(classesMap.containsKey(fileName)) { >- if(extension.equals(CLASS_EXTENSION)) { >- sourceResources.add(classesMap.remove(fileName)); >- } else if(extension.equals(JAVA_EXTENSION)) { >- sourceResources.add(resource); >- classesMap.remove(fileName); >- } >- } else { >- classesMap.put(fileName, resource); >+ if(extension.equals(CLASS_EXTENSION)){ >+ if(isClassWithoutSource(archive, resource)){ >+ classes.add(resource); > } >+ } else if(extension.equals(JAVA_EXTENSION)){ >+ sourceResources.add(resource); > } else if(extension.equals(JAR_EXTENSION) || extension.equals(RAR_EXTENSION) || extension.equals(WAR_EXTENSION)) { > archive.getNestedArchive(resource); > } else { >@@ -182,10 +205,9 @@ > } > } > >- Collection<IArchiveResource> importedClassesResources = classesMap.values(); > List<IArchive> nestedArchives = archive.getNestedArchives(); > >- verifyImportedResources(sourceResources, importedClassesResources, otherResources, nestedArchives, rootFolder, importedClassesFolder); >+ verifyImportedResources(sourceResources, classes, otherResources, nestedArchives, rootFolder, importedClassesFolder); > } > > protected abstract void verifyImportedResources(Collection<IArchiveResource> sourceResources, Collection<IArchiveResource> importedClassesResources, Collection<IArchiveResource> otherResources, Collection<IArchive> nestedArchives, IFolder rootFolder, IFolder importedClassesFolder) throws Exception; >Index: j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/j2ee/verifiers/JEEExportDataModelVerifier.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/tests/org.eclipse.jst.j2ee.tests/j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/j2ee/verifiers/JEEExportDataModelVerifier.java,v >retrieving revision 1.1 >diff -u -r1.1 JEEExportDataModelVerifier.java >--- j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/j2ee/verifiers/JEEExportDataModelVerifier.java 6 Jul 2007 19:57:09 -0000 1.1 >+++ j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/j2ee/verifiers/JEEExportDataModelVerifier.java 11 Oct 2007 20:36:30 -0000 >@@ -121,7 +121,7 @@ > int type = archiveQuickPeek.getType(); > AssertWarn.warnEquals("Archive type did not match exported type", getExportType(), type); > int iVersionConstant = archiveQuickPeek.getVersion(); >- String sProjVersion = J2EEProjectUtilities.getJ2EEProjectVersion(exportedProj); >+ String sProjVersion = J2EEProjectUtilities.getJ2EEDDProjectVersion(exportedProj); > int iProjVersion = J2EEVersionUtil.convertVersionStringToInt(sProjVersion); > AssertWarn.warnEquals("Archive version did not match exported project version", iProjVersion, iVersionConstant); > } finally { >Index: j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/web/verifiers/WebImportDataModelVerifier.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/tests/org.eclipse.jst.j2ee.tests/j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/web/verifiers/WebImportDataModelVerifier.java,v >retrieving revision 1.1 >diff -u -r1.1 WebImportDataModelVerifier.java >--- j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/web/verifiers/WebImportDataModelVerifier.java 6 Jul 2007 19:57:10 -0000 1.1 >+++ j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tests/web/verifiers/WebImportDataModelVerifier.java 11 Oct 2007 20:36:30 -0000 >@@ -6,6 +6,7 @@ > */ > package org.eclipse.wtp.j2ee.headless.tests.web.verifiers; > >+import java.io.FileNotFoundException; > import java.util.Collection; > > import junit.framework.Assert; >@@ -13,6 +14,9 @@ > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IFolder; > import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants; >+import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil; > import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; > import org.eclipse.jst.jee.archive.IArchive; > import org.eclipse.jst.jee.archive.IArchiveResource; >@@ -60,7 +64,9 @@ > for(IArchiveResource importedClassResource : importedClassesResources) { > resourcePath = importedClassResource.getPath().removeFirstSegments(2); > resourceFile = importedClassesFolder.getFile(resourcePath); >- Assert.assertTrue("The imported class " + resourcePath + " should exist in the project", resourceFile.exists()); >+ if(!resourceFile.exists()){ >+ Assert.fail("The imported class " + resourcePath + " should exist in the project"); >+ } > } > > for(IArchiveResource otherResource : otherResources) { >@@ -73,4 +79,48 @@ > > } > } >+ >+ protected boolean isClassWithoutSource(IArchive archive, IArchiveResource aFile) { >+ String javaUri = ArchiveUtil.classUriToJavaUri(aFile.getPath().toString()); >+ if (javaUri == null) >+ return true; >+ IPath javaPath = new Path(javaUri); >+ if (archive.containsArchiveResource(javaPath)) { >+ return false; >+ } >+ // see if it is a JSP >+ String jspUri = javaUri.substring(0, javaUri.indexOf(ArchiveUtil.DOT_JAVA)); >+ int lastSlash = jspUri.lastIndexOf('/'); >+ int _index = lastSlash == -1 ? ArchiveConstants.WEBAPP_CLASSES_URI.length() : lastSlash + 1; >+ if (jspUri.charAt(_index) == '_') { >+ jspUri = jspUri.substring(ArchiveConstants.WEBAPP_CLASSES_URI.length(), _index) + jspUri.substring(_index + 1) + ArchiveUtil.DOT_JSP; >+ IPath jspPath = new Path(jspUri); >+ if (archive.containsArchiveResource(jspPath)) { >+ return false; >+ } >+ } >+ >+ //This is to handle archives created by an earlier version >+ //The format was to include the source files in a directory called source in WEB-INF >+ //Example: class is in WEB-INF/classes/test/Foo.class >+ // source is in WEB-INF/source/test/Foo.java >+ if(javaPath.segmentCount() > 2 && javaPath.segment(0).equals("WEB-INF") && javaPath.segment(1).equals("classes")){ >+ String alternateJavaUri = javaUri.replaceFirst("classes", "source"); >+ IPath alternateJavaPath = new Path(alternateJavaUri); >+ if (archive.containsArchiveResource(alternateJavaPath)){ >+ IArchiveResource sourceFile; >+ try { >+ sourceFile = archive.getArchiveResource(alternateJavaPath); >+ if(sourceFile != null){ >+ return false; >+ } >+ } catch (FileNotFoundException e) { >+ } >+ >+ } >+ >+ } >+ >+ return true; >+ } > } >Index: j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tets/appclient/verifiers/AppClientImportDataModelVerifier.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/tests/org.eclipse.jst.j2ee.tests/j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tets/appclient/verifiers/AppClientImportDataModelVerifier.java,v >retrieving revision 1.1 >diff -u -r1.1 AppClientImportDataModelVerifier.java >--- j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tets/appclient/verifiers/AppClientImportDataModelVerifier.java 6 Jul 2007 19:57:09 -0000 1.1 >+++ j2ee-verifiers/org/eclipse/wtp/j2ee/headless/tets/appclient/verifiers/AppClientImportDataModelVerifier.java 11 Oct 2007 20:36:30 -0000 >@@ -52,7 +52,9 @@ > for(IArchiveResource sourceResource : sourceResources) { > resourcePath = sourceResource.getPath(); > resourceFile = rootFolder.getFile(resourcePath); >- Assert.assertTrue("The file " + resourcePath + " should exist in the project", resourceFile.exists()); >+ if(!resourceFile.exists()){ >+ Assert.fail("The file " + resourcePath + " should exist in the project"); >+ } > } > > for(IArchiveResource importedClassResource : importedClassesResources) { >#P org.eclipse.jst.j2ee.ui >Index: j2ee_ui/org/eclipse/jst/j2ee/internal/AvailableJ2EEComponentsForEARContentProvider.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/AvailableJ2EEComponentsForEARContentProvider.java,v >retrieving revision 1.15 >diff -u -r1.15 AvailableJ2EEComponentsForEARContentProvider.java >--- j2ee_ui/org/eclipse/jst/j2ee/internal/AvailableJ2EEComponentsForEARContentProvider.java 7 Jun 2007 20:02:11 -0000 1.15 >+++ j2ee_ui/org/eclipse/jst/j2ee/internal/AvailableJ2EEComponentsForEARContentProvider.java 11 Oct 2007 20:36:30 -0000 >@@ -49,6 +49,7 @@ > public class AvailableJ2EEComponentsForEARContentProvider implements IStructuredContentProvider, ITableLabelProvider { > private int j2eeVersion; > private IVirtualComponent earComponent; >+ private boolean isEE5 = false; > > public AvailableJ2EEComponentsForEARContentProvider(IVirtualComponent aEarComponent, int j2eeVersion) { > super(); >@@ -62,6 +63,9 @@ > * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) > */ > public Object[] getElements(Object inputElement) { >+ if (null != earComponent){ >+ isEE5 = J2EEProjectUtilities.isJEEProject(earComponent.getProject()); >+ } > Object[] empty = new Object[0]; > if (!(inputElement instanceof IWorkspaceRoot)) > return empty; >@@ -81,23 +85,21 @@ > J2EEProjectUtilities.isJCAProject(project) || > J2EEProjectUtilities.isUtilityProject(project) ){ > int compJ2EEVersion = J2EEVersionUtil.convertVersionStringToInt(component); >- if( compJ2EEVersion <= j2eeVersion) >- //validCompList.add(component.getProject()); >+ if( compJ2EEVersion <= j2eeVersion){ >+ validCompList.add(component); >+ } else if(isEE5){ > validCompList.add(component); >+ } > }else if(null != earComponent && J2EEProjectUtilities.isEARProject(project)){ > //find the ArchiveComponent > if( component.equals( earComponent )){ > IVirtualReference[] newrefs = component.getReferences(); > for( int k=0; k< newrefs.length; k++ ){ > IVirtualReference tmpref = newrefs[k]; >- //IVirtualComponent enclosingcomp = tmpref.getEnclosingComponent(); >- //boolean isBinary = enclosingcomp.isBinary(); > IVirtualComponent referencedcomp = tmpref.getReferencedComponent(); > boolean isBinary = referencedcomp.isBinary(); > if( isBinary ){ > validCompList.add(referencedcomp); >- //validCompList.add(referencedcomp.getProject()); >- //IPath path = ComponentUtilities.getResolvedPathForArchiveComponent(name); > } else { > addClasspathComponentDependencies(validCompList, pathToComp, referencedcomp); > } >#P org.eclipse.jst.j2ee.jca >Index: rarproject/org/eclipse/jst/j2ee/internal/jca/operations/ConnectorComponentImportOperation.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/j2ee/plugins/org.eclipse.jst.j2ee.jca/rarproject/org/eclipse/jst/j2ee/internal/jca/operations/ConnectorComponentImportOperation.java,v >retrieving revision 1.6 >diff -u -r1.6 ConnectorComponentImportOperation.java >--- rarproject/org/eclipse/jst/j2ee/internal/jca/operations/ConnectorComponentImportOperation.java 7 Jun 2007 19:30:22 -0000 1.6 >+++ rarproject/org/eclipse/jst/j2ee/internal/jca/operations/ConnectorComponentImportOperation.java 11 Oct 2007 20:36:31 -0000 >@@ -11,7 +11,6 @@ > package org.eclipse.jst.j2ee.internal.jca.operations; > > import java.util.ArrayList; >-import java.util.Iterator; > import java.util.List; > > import org.eclipse.core.commands.ExecutionException; >@@ -23,12 +22,11 @@ > import org.eclipse.jdt.core.JavaCore; > import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jem.util.logger.proxy.Logger; >-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; >-import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile; > import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy; > import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties; > import org.eclipse.jst.j2ee.internal.archive.operations.ConnectorComponentSaveStrategyImpl; > import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactImportOperation; >+import org.eclipse.jst.jee.archive.IArchive; > import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; > import org.eclipse.wst.common.componentcore.resources.IVirtualFile; > import org.eclipse.wst.common.frameworks.datamodel.IDataModel; >@@ -52,14 +50,12 @@ > protected void addAssociateArchivesToClassPath() { > List extraEntries = new ArrayList(); > >- List archiveList = ((ModuleFile)archiveWrapper.getUnderLyingArchive()).getArchiveFiles(); >- Iterator iterator = archiveList.iterator(); >+ List <IArchive> nestedArchives = ((IArchive)archiveWrapper.getUnderLyingArchive()).getNestedArchives(); > IVirtualFile vFile = null; > IFile file = null; >- while (iterator.hasNext()) { >- Archive anArchive = (Archive) iterator.next(); >- if (anArchive.getName().endsWith(JAR_EXTENSION)) { >- vFile = virtualComponent.getRootFolder().getFile(anArchive.getURI()); >+ for(IArchive nestedArchive : nestedArchives){ >+ if(nestedArchive.getPath().lastSegment().endsWith(JAR_EXTENSION)){ >+ vFile = virtualComponent.getRootFolder().getFile(nestedArchive.getPath()); > if (vFile.exists()) { > file = vFile.getUnderlyingFile(); > extraEntries.add(JavaCore.newLibraryEntry(file.getFullPath(), file.getFullPath(), null, true));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 206086
: 80180