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 179347 Details for
Bug 325911
Deployment Assembly Verifier for classpath entries
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]
Proposed Patch
Missing validation for classpath entries - Sept 21 2010 3pm.patch (text/plain), 11.49 KB, created by
Aidyl Kareh
on 2010-09-21 17:33:35 EDT
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Aidyl Kareh
Created:
2010-09-21 17:33:35 EDT
Size:
11.49 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.j2ee.ui >Index: j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDependenciesPropertyPage.java >=================================================================== >RCS file: /cvsroot/webtools/jeetools/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDependenciesPropertyPage.java,v >retrieving revision 1.8 >diff -u -r1.8 J2EEModuleDependenciesPropertyPage.java >--- j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDependenciesPropertyPage.java 27 Aug 2010 01:42:32 -0000 1.8 >+++ j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDependenciesPropertyPage.java 21 Sep 2010 19:05:51 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Path; > import org.eclipse.jdt.core.IClasspathAttribute; > import org.eclipse.jdt.core.IClasspathEntry; >@@ -296,6 +297,16 @@ > super.handleAddDirective(wizard); > } > } >+ >+ @Override >+ protected void verify() { >+ ArrayList<ComponentResourceProxy> allMappings = new ArrayList<ComponentResourceProxy>(); >+ allMappings.addAll(resourceMappings); >+ allMappings.addAll(hiddenMappings); >+ >+ IStatus status = J2EEModuleDeploymentAssemblyVerifierHelper.verify(rootComponent, runtime, currentReferences, allMappings,resourceMappingsChanged, currentClasspathEntries); >+ setErrorMessage(status); >+ } > > // > // @Override >Index: j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierData.java >=================================================================== >RCS file: j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierData.java >diff -N j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierData.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierData.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,38 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jst.j2ee.internal.ui; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.jst.j2ee.internal.ui.J2EEModuleDependenciesPropertyPage.ClasspathEntryProxy; >+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; >+import org.eclipse.wst.common.componentcore.resources.IVirtualReference; >+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.verifier.DeploymentAssemblyVerifierData; >+import org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.ComponentResourceProxy; >+import org.eclipse.wst.server.core.IRuntime; >+ >+public class J2EEModuleDeploymentAssemblyVerifierData extends DeploymentAssemblyVerifierData{ >+ >+ public J2EEModuleDeploymentAssemblyVerifierData(IVirtualComponent component, IRuntime runtime, ArrayList<IVirtualReference> currentReferences, >+ ArrayList<ComponentResourceProxy> resourceMappings, boolean resourceMappingsChanged, List<ClasspathEntryProxy> currentClasspathEntries2) { >+ super(component, runtime, currentReferences,resourceMappings, resourceMappingsChanged); >+ this.currentClasspathEntries = currentClasspathEntries2; >+ } >+ private List<ClasspathEntryProxy> currentClasspathEntries; >+ >+ public List<ClasspathEntryProxy> getCurrentClasspathEntries() { >+ return currentClasspathEntries; >+ } >+ public void setCurrentClasspathEntries(List<ClasspathEntryProxy> currentClasspathEntries) { >+ this.currentClasspathEntries = currentClasspathEntries; >+ } >+} >Index: j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierHelper.java >=================================================================== >RCS file: j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierHelper.java >diff -N j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierHelper.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierHelper.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,70 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jst.j2ee.internal.ui; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.MultiStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.jst.j2ee.internal.ui.J2EEModuleDependenciesPropertyPage.ClasspathEntryProxy; >+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; >+import org.eclipse.wst.common.componentcore.resources.IVirtualReference; >+import org.eclipse.wst.common.componentcore.ui.Messages; >+import org.eclipse.wst.common.componentcore.ui.ModuleCoreUIPlugin; >+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.verifier.DeploymentAssemblyVerifierHelper; >+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.verifier.IDeploymentAssemblyVerifier; >+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.verifier.VerifierRegistryReader; >+import org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.ComponentResourceProxy; >+import org.eclipse.wst.server.core.IRuntime; >+ >+public class J2EEModuleDeploymentAssemblyVerifierHelper { >+ >+ >+ /** >+ * This method will use the facet framework to find all registered verifiers based on installed facets and runtimes. >+ * All the verifiers will have an opportunity to verify and return status on the proposed component mappings >+ * @param component >+ * @param runtime >+ * @param resourceMappingsChanged >+ * @param resourceMappings >+ * @param currentReferences >+ * @param currentClasspathEntries >+ * @return IStatus >+ */ >+ public static IStatus verify(IVirtualComponent component,IRuntime runtime, ArrayList<IVirtualReference> currentReferences, ArrayList<ComponentResourceProxy> resourceMappings, boolean resourceMappingsChanged, List<ClasspathEntryProxy> currentClasspathEntries) { >+ IProject project = component.getProject(); >+ >+ List verifiers = DeploymentAssemblyVerifierHelper.collectAllVerifiers(project,runtime); >+ if (verifiers.isEmpty()) return Status.OK_STATUS; >+ MultiStatus masterStatus = new MultiStatus(ModuleCoreUIPlugin.PLUGIN_ID, IStatus.OK, Messages.DeploymentAssemblyVerifierHelper_0,null); >+ >+ for (int i = 0; i < verifiers.size(); i++) { >+ if (!(verifiers.get(i) instanceof IConfigurationElement)) >+ continue; >+ IDeploymentAssemblyVerifier verifier = null; >+ try { >+ verifier = (IDeploymentAssemblyVerifier) ((IConfigurationElement) verifiers.get(i)).createExecutableExtension(VerifierRegistryReader.VERIFIER_CLASS); >+ J2EEModuleDeploymentAssemblyVerifierData data = new J2EEModuleDeploymentAssemblyVerifierData(component, runtime,currentReferences,resourceMappings,resourceMappingsChanged,currentClasspathEntries ); >+ IStatus verifyStatus = verifier.verify(data); >+ masterStatus.add(verifyStatus); >+ } catch (Exception e) { >+ ModuleCoreUIPlugin.log(e); >+ continue; >+ } >+ >+ } >+ return masterStatus; >+ } >+} >#P org.eclipse.wst.common.modulecore.ui >Index: src/org/eclipse/wst/common/componentcore/ui/internal/propertypage/verifier/DeploymentAssemblyVerifierHelper.java >=================================================================== >RCS file: /cvsroot/webtools/common/plugins/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/internal/propertypage/verifier/DeploymentAssemblyVerifierHelper.java,v >retrieving revision 1.1 >diff -u -r1.1 DeploymentAssemblyVerifierHelper.java >--- src/org/eclipse/wst/common/componentcore/ui/internal/propertypage/verifier/DeploymentAssemblyVerifierHelper.java 20 May 2010 04:32:43 -0000 1.1 >+++ src/org/eclipse/wst/common/componentcore/ui/internal/propertypage/verifier/DeploymentAssemblyVerifierHelper.java 21 Sep 2010 19:05:51 -0000 >@@ -75,7 +75,7 @@ > * @param runtime > * @return all verifiers by iterating through projects installed facets, and querying the registry > */ >- private static List collectAllVerifiers(IProject project, IRuntime runtime) { >+ public static List collectAllVerifiers(IProject project, IRuntime runtime) { > IFacetedProject fProj = null; > try { > fProj = ProjectFacetsManager.create(project); >Index: src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java >=================================================================== >RCS file: /cvsroot/webtools/common/plugins/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java,v >retrieving revision 1.31 >diff -u -r1.31 AddModuleDependenciesPropertiesPage.java >--- src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java 26 Aug 2010 19:13:05 -0000 1.31 >+++ src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java 21 Sep 2010 19:05:51 -0000 >@@ -703,22 +703,28 @@ > allMappings.addAll(hiddenMappings); > > IStatus status = DeploymentAssemblyVerifierHelper.verify(rootComponent, runtime, currentReferences, allMappings,resourceMappingsChanged); >+ setErrorMessage(status); >+ } >+ >+ protected void setErrorMessage(IStatus status) { > // Clear the messages > propPage.setErrorMessage(null); > propPage.setMessage(null); >- if (status.isMultiStatus()) { >- MultiStatus multi = (MultiStatus)status; >- if (!multi.isOK()) { >- propPage.setMessage(getMessage(multi), multi.getSeverity()); >- if (multi.getSeverity() == IStatus.ERROR) { >- propPage.setErrorMessage(getMessage(multi)); >- propPage.setValid(false); >- } >- else >- propPage.setValid(true); >- } else propPage.setValid(true); >- } else if (status.isOK()) propPage.setValid(true); >- propPage.getContainer().updateMessage(); >+ if(status != null) { >+ if (status.isMultiStatus()) { >+ MultiStatus multi = (MultiStatus)status; >+ if (!multi.isOK()) { >+ propPage.setMessage(getMessage(multi), multi.getSeverity()); >+ if (multi.getSeverity() == IStatus.ERROR) { >+ propPage.setErrorMessage(getMessage(multi)); >+ propPage.setValid(false); >+ } >+ else >+ propPage.setValid(true); >+ } else propPage.setValid(true); >+ } else if (status.isOK()) propPage.setValid(true); >+ propPage.getContainer().updateMessage(); >+ } > } > > private String getMessage(MultiStatus multi) {
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 325911
: 179347