[jbosstools-commits] JBoss Tools SVN: r43224 - in trunk/ws: plugins/org.jboss.tools.ws.jaxrs.core/META-INF and 27 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Aug 24 12:20:05 EDT 2012


Author: xcoulon
Date: 2012-08-24 12:20:04 -0400 (Fri, 24 Aug 2012)
New Revision: 43224

Added:
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/AbstractJaxrsElementValidatorDelegate.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsApplicationValidatorDelegate.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsHttpMethodValidatorDelegate.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsResourceMethodValidatorDelegate.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsResourceValidatorDelegate.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationErrorManager.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.properties
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/MarkerUtils.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IMarkerResolutionDelegate.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/quickfix/
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/quickfix/JaxrsValidationQuickFixes.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/JaxrsPreferenceInitializer.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/JaxrsPreferences.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/package-info.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/IConfigurationBlockDescriptionProvider.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencePage.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencesMessages.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencesMessages.properties
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsSettingsPreferencePage.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorConfigurationBlock.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorConfigurationBlockDescriptionProvider.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorPreferencePage.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/package-info.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/AddTargetAnnotationMarkerResolution.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsMarkerResolutionGenerator.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsQuickFixMessages.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsQuickFixMessages.properties
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/package-info.java
Removed:
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/IValidable.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/quickfix/
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/JaxrsMarkerResolutionGenerator.java
Modified:
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/META-INF/MANIFEST.MF
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/plugin.properties
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/plugin.xml
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/JBossJaxrsCorePlugin.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/configuration/ProjectBuilderConfigurer.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/configuration/ProjectBuilderUtils.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedListener.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsElementDelta.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilder.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceDeltaScanner.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBaseElement.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBuiltinHttpMethod.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsHttpMethod.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaApplication.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaElement.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsParamBeanProperty.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsProvider.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResource.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceField.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsWebxmlApplication.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/Annotation.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/EnumJaxrsClassname.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaAnnotationsVisitor.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodParameter.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtils.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsHttpMethod.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsMetamodel.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/META-INF/MANIFEST.MF
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/plugin.properties
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/plugin.xml
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateElementAdapterFactory.java
   trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/facet/JaxrsFacetedProjectListener.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/META-INF/MANIFEST.MF
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/plugin.properties
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BarResource.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BazResource.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/FOO.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/WorkbenchUtils.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/configuration/ProjectBuilderUtilsTestCase.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedProcessorTestCase.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilderTestCase.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelChangedProcessorTestCase.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactoryTestCase.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodelTestCase.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidatorTestCase.java
   trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/jdt/JaxrsAnnotationScannerTestCase.java
Log:
Fixed - JBIDE-12413 - Warn when a JAX-RS HTTP Method has no valid @Target and @Retention annotations aside of the @HttpMethod annotation 
Fixed - JBIDE-12485 - Move JAX-RS validation into JBoss Tools validation, aside of CDI validation 
Fixed - JBIDE-12486 - Improve message labels when JAX-RS PathParam annotation value does not match Path template parameters 
Fixed - JBIDE-12488 - Report a warning if no JAX-RS activator (or multiple ones) exist in the project 

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/META-INF/MANIFEST.MF	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/META-INF/MANIFEST.MF	2012-08-24 16:20:04 UTC (rev 43224)
@@ -27,15 +27,20 @@
  org.eclipse.jst.j2ee;bundle-version="1.1.301";visibility:=reexport,
  org.eclipse.emf.ecore;bundle-version="2.5.0";visibility:=reexport,
  org.eclipse.wst.common.frameworks.ui;bundle-version="1.1.301",
- org.eclipse.jface.text;bundle-version="3.7.1"
+ org.eclipse.jface.text;bundle-version="3.7.1",
+ org.jboss.tools.common.validation;bundle-version="3.4.0",
+ org.jboss.tools.common;bundle-version="3.4.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
-Export-Package: org.jboss.tools.ws.jaxrs.core;x-friends:="org.jboss.tools.ws.jaxrs.core.test",
+Export-Package: org.jboss.tools.ws.jaxrs.core,
  org.jboss.tools.ws.jaxrs.core.configuration,
  org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder;x-friends:="org.jboss.tools.ws.jaxrs.core.test",
  org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain;x-friends:="org.jboss.tools.ws.jaxrs.core.test",
+ org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;x-friends:="org.jboss.tools.ws.jaxrs.core.test",
  org.jboss.tools.ws.jaxrs.core.internal.utils;x-friends:="org.jboss.tools.ws.jaxrs.core.test",
  org.jboss.tools.ws.jaxrs.core.jdt,
  org.jboss.tools.ws.jaxrs.core.metamodel,
+ org.jboss.tools.ws.jaxrs.core.metamodel.quickfix,
+ org.jboss.tools.ws.jaxrs.core.preferences,
  org.jboss.tools.ws.jaxrs.core.pubsub
 Bundle-ClassPath: .

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/plugin.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/plugin.properties	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/plugin.properties	2012-08-24 16:20:04 UTC (rev 43224)
@@ -1,2 +1,8 @@
 PLUGIN_NAME=JBoss JAX-RS Tooling (Core)
 PLUGIN_PROVIDER=JBoss by Red Hat
+VALIDATOR_NAME=JAX-RS Validator
+
+
+ConfigureMenu_AddJaxrs11Support=Add JAX-RS 1.1 support...
+ConfigureMenu_RemoveJaxrs11Support=Remove JAX-RS 1.1 support...
+

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/plugin.xml
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/plugin.xml	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/plugin.xml	2012-08-24 16:20:04 UTC (rev 43224)
@@ -37,7 +37,7 @@
          <action
                class="org.jboss.tools.ws.jaxrs.core.configuration.AddNatureAction"
                id="org.jboss.tools.ws.jaxrs.configuration.addJaxrsConfigurationAction"
-               label="Add JAX-RS 1.1 support..."
+               label="%ConfigureMenu_AddJaxrs11Support"
                menubarPath="org.eclipse.ui.projectConfigure/additions">
          </action>
       </objectContribution>
@@ -60,7 +60,7 @@
          <action
                class="org.jboss.tools.ws.jaxrs.core.configuration.RemoveNatureAction"
                id="org.jboss.tools.ws.jaxrs.removeJaxrsConfigurationAction"
-               label="Remove JAX-RS 1.1 support..."
+               label="%ConfigureMenu_RemoveJaxrs11Support"
                menubarPath="org.eclipse.ui.projectConfigure/additions">
          </action>
       </objectContribution>
@@ -87,23 +87,17 @@
       </super>
    </extension>
    <extension
-         id="org.jboss.tools.ws.jaxrs.JaxrsMetamodelValidator"
-         name="JAX-RS Metamodel Validator"
-         point="org.eclipse.wst.validation.validatorV2">
+         point="org.jboss.tools.common.validation.validator">
       <validator
-            build="true"
             class="org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation.JaxrsMetamodelValidator"
-            manual="true"
-            markerId="org.jboss.tools.ws.jaxrs.metamodelMarker">
-         <include>
-            <rules>
-               <projectNature
-                     id="org.jboss.tools.ws.jaxrs.nature">
-               </projectNature>
-            </rules>
-         </include>
+            id="org.jboss.tools.ws.jaxrs.JaxrsMetamodelValidator"
+            name="%VALIDATOR_NAME">
       </validator>
    </extension>
+   
+    <extension point="org.eclipse.core.runtime.preferences">
+      <initializer class="org.jboss.tools.ws.jaxrs.core.preferences.JaxrsPreferenceInitializer"/>
+   </extension>
   
 
 </plugin>

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/JBossJaxrsCorePlugin.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/JBossJaxrsCorePlugin.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/JBossJaxrsCorePlugin.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -13,8 +13,8 @@
 
 import org.eclipse.core.resources.IResourceChangeEvent;
 import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Plugin;
 import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JavaElementChangedListener;
 import org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.ResourceChangedListener;
 import org.osgi.framework.BundleContext;
@@ -22,7 +22,7 @@
 /**
  * The activator class controls the plug-in life cycle
  */
-public class JBossJaxrsCorePlugin extends Plugin {
+public class JBossJaxrsCorePlugin extends AbstractUIPlugin {
 
 	/** The plug-in ID. */
 	public static final String PLUGIN_ID = "org.jboss.tools.ws.jaxrs.core"; //$NON-NLS-1$

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/configuration/ProjectBuilderConfigurer.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/configuration/ProjectBuilderConfigurer.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/configuration/ProjectBuilderConfigurer.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -14,6 +14,7 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectNature;
 import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsMetamodelBuilder;
 import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
 
 /**
@@ -33,7 +34,7 @@
 		}
 		// project nature installation triggers the project builder
 		// installation, by configuration/association in the plugin.xml file.
-		if (ProjectBuilderUtils.installProjectBuilder(project, ProjectBuilderUtils.JAXRS_BUILDER_ID)) {
+		if (ProjectBuilderUtils.installProjectBuilder(project, JaxrsMetamodelBuilder.BUILDER_ID)) {
 			Logger.info("JAX-RS Builder is now installed.");
 		} else {
 			Logger.info("JAX-RS Builder was already installed.");
@@ -45,7 +46,7 @@
 		if (project == null) {
 			return;
 		}
-		if (ProjectBuilderUtils.uninstallProjectBuilder(project, ProjectBuilderUtils.JAXRS_BUILDER_ID)) {
+		if (ProjectBuilderUtils.uninstallProjectBuilder(project, JaxrsMetamodelBuilder.BUILDER_ID)) {
 			Logger.debug("JAX-RS Metamodel Builder is now uninstalled.");
 		} else {
 			Logger.debug("JAX-RS Metamodel Builder was not installed.");

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/configuration/ProjectBuilderUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/configuration/ProjectBuilderUtils.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/configuration/ProjectBuilderUtils.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -23,11 +23,6 @@
  */
 public final class ProjectBuilderUtils {
 
-	// TODO : replace with javabuilder, add jaxrs builder after this one.
-	public static final String VALIDATION_BUILDER_ID = "org.eclipse.wst.validation.validationbuilder";
-	/** The JAX-RS Metamodel Builder Id. */
-	public static final String JAXRS_BUILDER_ID = "org.jboss.tools.ws.jaxrs.metamodelBuilder";
-
 	/** Hidden constructor of the utility method. Prevents instantiation. */
 	private ProjectBuilderUtils() {
 		super();
@@ -75,22 +70,8 @@
 		if (isProjectBuilderInstalled(project, builderId)) {
 			return false;
 		}
-
+		
 		ICommand[] newCommands = new ICommand[commands.length + 1];
-		for (int i = 0; i < commands.length; i++) {
-			if (commands[i].getBuilderName().equals(VALIDATION_BUILDER_ID)) {
-				System.arraycopy(commands, 0, newCommands, 0, i);
-				ICommand command = desc.newCommand();
-				command.setBuilderName(builderId);
-				newCommands[i] = command;
-				System.arraycopy(commands, i, newCommands, i + 1, commands.length - i);
-				desc.setBuildSpec(newCommands);
-				project.setDescription(desc, null);
-				return true;
-			}
-		}
-		// if no validation builder was found, add the jax-rs builder at the
-		// last position
 		System.arraycopy(commands, 0, newCommands, 0, commands.length);
 		ICommand command = desc.newCommand();
 		command.setBuilderName(builderId);

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedListener.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedListener.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedListener.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2008 Red Hat, Inc. 
+le * Copyright (c) 2008 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsElementDelta.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsElementDelta.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsElementDelta.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -35,32 +35,36 @@
 	public static final int F_NONE = 0;
 
 	/** Meaning that the change occurred at a finer level. */
-	public static final int F_FINE_GRAINED = 1;
+	public static final int F_FINE_GRAINED = 0x1;
 
-	public static final int F_ELEMENT_KIND = 2;
+	public static final int F_ELEMENT_KIND = 0x2;
 
-	public static final int F_PATH_VALUE = 4;
+	public static final int F_PATH_VALUE = 0x4;
 
-	public static final int F_APPLICATION_PATH_VALUE = 8;
+	public static final int F_APPLICATION_PATH_VALUE = 0x8;
 
-	public static final int F_HTTP_METHOD_VALUE = 16;
+	public static final int F_HTTP_METHOD_VALUE = 0x10;
 
-	public static final int F_PATH_PARAM_VALUE = 32;
+	public static final int F_PATH_PARAM_VALUE = 0x20;
 
-	public static final int F_QUERY_PARAM_VALUE = 64;
+	public static final int F_QUERY_PARAM_VALUE = 0x40;
 
-	public static final int F_MATRIX_PARAM_VALUE = 128;
+	public static final int F_MATRIX_PARAM_VALUE = 0x80;
 
-	public static final int F_DEFAULT_VALUE_VALUE = 256;
+	public static final int F_DEFAULT_VALUE_VALUE = 0x100;
 
-	public static final int F_CONSUMED_MEDIATYPES_VALUE = 512;
+	public static final int F_CONSUMED_MEDIATYPES_VALUE = 0x200;
 
-	public static final int F_PRODUCED_MEDIATYPES_VALUE = 1024;
+	public static final int F_PRODUCED_MEDIATYPES_VALUE = 0x400;
 
-	public static final int F_METHOD_PARAMETERS = 2048;
+	public static final int F_METHOD_PARAMETERS = 0x800;
 
-	public static final int F_METHOD_RETURN_TYPE = 4096;
+	public static final int F_METHOD_RETURN_TYPE = 0x1000;
 
+	public static final int F_TARGET_VALUE = 0x2000;
+	
+	public static final int F_RETENTION_VALUE = 0x4000;
+
 	/**
 	 * Full constructor.
 	 * 

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilder.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilder.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilder.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -40,12 +40,9 @@
 
 	public static final int SCALE = 10;
 
-	/** The standard 'Java type' marker type. */
-	public static final String JAVA_PROBLEM = "org.eclipse.jdt.core.problem";
-
-	/** The custom 'JAX-RS Problem' marker type. */
-	public static final String JAXRS_PROBLEM = "org.jboss.tools.ws.jaxrs.metamodelMarker";
-
+	/** The builder ID. */
+	public static final String BUILDER_ID = "org.jboss.tools.ws.jaxrs.metamodelBuilder";
+	
 	/** The Java element change listener name. */
 	public static final QualifiedName JAXRS_ELEMENT_CHANGE_LISTENER_NAME = new QualifiedName(
 			JBossJaxrsCorePlugin.PLUGIN_ID, "jaxrsPostReconcileListener");

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceDeltaScanner.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceDeltaScanner.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceDeltaScanner.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -25,6 +25,7 @@
 import org.eclipse.core.resources.IResourceDelta;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IJavaModelMarker;
 import org.jboss.tools.ws.jaxrs.core.internal.utils.ConstantUtils;
 import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
 import org.jboss.tools.ws.jaxrs.core.internal.utils.WtpUtils;
@@ -105,7 +106,7 @@
 					int severity = markerDelta.getAttribute(IMarker.SEVERITY, 0);
 					String type = markerDelta.getType();
 					String message = markerDelta.getAttribute(IMarker.MESSAGE, "");
-					if (severity == IMarker.SEVERITY_ERROR && type.equals("org.eclipse.jdt.core.problem")) {
+					if (severity == IMarker.SEVERITY_ERROR && type.equals(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER)) {
 						Logger.debug("Marker delta: {} [{}] {}: \"{}\" at line {} (id={})", markerDelta.getResource()
 								.getName(), ConstantUtils.getStaticFieldName(IResourceDelta.class,
 								markerDelta.getKind()), ConstantUtils.getStaticFieldName(IMarker.class, severity,

Deleted: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/IValidable.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/IValidable.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/IValidable.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -1,30 +0,0 @@
-/******************************************************************************* 
- * Copyright (c) 2008 Red Hat, Inc. 
- * Distributed under license by Red Hat, Inc. All rights reserved. 
- * This program is 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: 
- * Xavier Coulon - Initial API and implementation 
- ******************************************************************************/
-
-package org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public interface IValidable {
-
-	/**
-	 * Validates the element against JAX-RS business/technical rules. In case of
-	 * errors or warning, creates appropriate markers on the underlying
-	 * resource.
-	 * 
-	 * @param progressMonitor
-	 *            the progress monitor
-	 * @throws CoreException
-	 */
-	abstract void validate(IProgressMonitor progressMonitor) throws CoreException;
-
-}

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBaseElement.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBaseElement.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBaseElement.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -1,10 +1,6 @@
 package org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain;
 
-import java.util.List;
-
 import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.wst.validation.ValidatorMessage;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementCategory;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
 import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsElement;
@@ -52,9 +48,6 @@
 
 	public abstract IResource getResource();
 	
-	public abstract List<ValidatorMessage> validate() throws JavaModelException;
-
-	public abstract String getName();
+	public abstract String getName();	
 	
-	
 }

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBuiltinHttpMethod.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBuiltinHttpMethod.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBuiltinHttpMethod.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -10,6 +10,9 @@
  ******************************************************************************/
 package org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain;
 
+import java.util.Arrays;
+
+import org.eclipse.core.resources.IResource;
 import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
 
 /**
@@ -30,12 +33,26 @@
 	private final String httpVerb;
 	
 	public JaxrsBuiltinHttpMethod(String annotationName, String annotationValue) {
-		super(null, new Annotation(null, annotationName, annotationValue, null), null);
+		super(null, Arrays.asList(new Annotation(null, annotationName, annotationValue, null)), null);
 		this.annotationName = annotationName;
 		this.httpVerb = annotationValue;
 	} 
 
 	@Override
+	public boolean isBuiltIn() {
+		return true;
+	}
+
+	/**
+	 * There is no resource associated with this built-in HTTP Method. Overriding this method prevents NPE (since <code>javaElement<code> attribute is null).
+	 * @see org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsJavaElement#getResource()
+	 */
+	@Override
+	public IResource getResource() {
+		return null;
+	}
+
+	@Override
 	public String getHttpVerb() {
 		return this.httpVerb;
 	}

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -26,6 +26,8 @@
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.PRODUCES;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.PROVIDER;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.QUERY_PARAM;
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.RETENTION;
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.TARGET;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -269,11 +271,11 @@
 	 */
 	public JaxrsHttpMethod createHttpMethod(final IType javaType, final CompilationUnit ast,
 			final JaxrsMetamodel metamodel) throws CoreException {
-		Annotation httpMethodAnnotation = JdtUtils.resolveAnnotation(javaType, ast, HTTP_METHOD.qualifiedName);
-		if (httpMethodAnnotation == null) {
+		Map<String, Annotation> annotations = JdtUtils.resolveAnnotations(javaType, ast, HTTP_METHOD.qualifiedName, TARGET.qualifiedName, RETENTION.qualifiedName);
+		if (annotations == null || annotations.isEmpty()) {
 			return null;
 		}
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(javaType, httpMethodAnnotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(javaType, metamodel).annotations(annotations.values()).build();
 		return httpMethod;
 	}
 
@@ -291,7 +293,8 @@
 			final JaxrsMetamodel metamodel) throws CoreException {
 		if (annotation.getJavaParent() != null && annotation.getJavaParent().getElementType() == IJavaElement.TYPE
 				&& annotation.getName().equals(HTTP_METHOD.qualifiedName)) {
-			return new JaxrsHttpMethod((IType) annotation.getJavaParent(), annotation, metamodel);
+			//return new JaxrsHttpMethod.Builder((IType) annotation.getJavaParent(), metamodel).httpMethod(annotation).build();
+			return createHttpMethod((IType) annotation.getJavaParent(), ast, metamodel);
 		}
 		return null;
 	}

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsHttpMethod.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsHttpMethod.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsHttpMethod.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -11,16 +11,15 @@
 
 package org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain;
 
-import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementDelta.F_HTTP_METHOD_VALUE;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.HTTP_METHOD;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
-import org.eclipse.core.resources.IMarker;
 import org.eclipse.jdt.core.IType;
-import org.eclipse.wst.validation.ValidatorMessage;
-import org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsMetamodelBuilder;
 import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementCategory;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
@@ -94,37 +93,69 @@
 		}
 	}
 	
-	public JaxrsHttpMethod(IType javaType, Annotation httpMethodAnnotation, JaxrsMetamodel metamodel) {
-		super(javaType, httpMethodAnnotation, metamodel);
+	public static class Builder {
+		final IType javaType;
+		final JaxrsMetamodel metamodel;
+		final List<Annotation> annotations = new ArrayList<Annotation>();
+
+		public Builder(final IType javaType, final JaxrsMetamodel metamodel) {
+			this.javaType = javaType;
+			this.metamodel = metamodel;
+		}
+
+		public Builder retention(final Annotation retentionAnnotation) {
+			if(retentionAnnotation != null) {
+				annotations.add(retentionAnnotation);
+			}
+			return this;
+		}
+
+		public Builder httpMethod(final Annotation httpMethodAnnotation) {
+			if(httpMethodAnnotation != null) {
+				annotations.add(httpMethodAnnotation);
+			}
+			return this;
+		}
+
+		public Builder target(final Annotation targetAnnotation) {
+			if(targetAnnotation != null) {
+				annotations.add(targetAnnotation);
+			}
+			return this;
+		}
+
+		public Builder annotations(final Collection<Annotation> annotations) {
+			if(annotations != null) {
+				this.annotations.addAll(annotations);
+			}
+			return this;
+		}
+		public JaxrsHttpMethod build() {
+			JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(javaType, annotations, metamodel);
+			return httpMethod;
+		}
 	}
 
+	/**
+	 * Full constructor.
+	 * 
+	 * @param annotations
+	 * 
+	 */
+	JaxrsHttpMethod(IType javaType, List<Annotation> annotations,
+			final JaxrsMetamodel metamodel) {
+		super(javaType, annotations, metamodel);
+	}
+	
+	public boolean isBuiltIn() {
+		return false;
+	}
+
 	@Override
 	public EnumElementCategory getElementCategory() {
 		return EnumElementCategory.HTTP_METHOD;
 	}
 
-	@Override
-	public List<ValidatorMessage> validate() {
-		List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
-		final Annotation annotation = getHttpMethodAnnotation();
-		if (annotation == null) {
-
-		} else {
-			final String httpValue = annotation.getValue("value");
-			if (httpValue == null || httpValue.isEmpty()) {
-				final ValidatorMessage message = ValidatorMessage
-						.create("HTTP Verb should not be empty", getResource());
-				message.setAttribute(IMarker.MARKER, JaxrsMetamodelBuilder.JAXRS_PROBLEM);
-				message.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
-				message.setAttribute(IMarker.CHAR_START, annotation.getSourceRange().getOffset());
-				message.setAttribute(IMarker.CHAR_END, annotation.getSourceRange().getOffset()
-						+ annotation.getSourceRange().getLength());
-				messages.add(message);
-			}
-		}
-		return messages;
-	}
-
 	/*
 	 * (non-Javadoc)
 	 * 
@@ -141,11 +172,20 @@
 		return null;
 	}
 
-	/** @return the httpVerbAnnotation */
-	@Override
+	/** @return the HttpMethod Annotation */
 	public Annotation getHttpMethodAnnotation() {
 		return getAnnotation(HTTP_METHOD.qualifiedName);
 	}
+	
+	/** @return the Retention Annotation */
+	public Annotation getRetentionAnnotation() {
+		return getAnnotation(Retention.class.getName());
+	}
+	
+	/** @return the Target Annotation */
+	public Annotation getTargetAnnotation() {
+		return getAnnotation(Target.class.getName());
+	}
 
 	/*
 	 * (non-Javadoc)
@@ -197,15 +237,16 @@
 	 * @return the flags indicating the kind of changes that occurred during the
 	 *         update.
 	 */
-	public int update(JaxrsHttpMethod httpMethod) {
-		int flags = 0;
+	public int update(final JaxrsHttpMethod httpMethod) {
+		/*int flags = 0;
 		final Annotation annotation = this.getAnnotation(HTTP_METHOD.qualifiedName);
 		final Annotation otherAnnotation = httpMethod.getAnnotation(HTTP_METHOD.qualifiedName);
 		if (annotation != null && otherAnnotation != null && !annotation.equals(otherAnnotation)
 				&& annotation.update(otherAnnotation)) {
 			flags += F_HTTP_METHOD_VALUE;
 		}
-		return flags;
+		return flags;*/
+		return mergeAnnotations(httpMethod.getAnnotations());
 	}
 
 }

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaApplication.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaApplication.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaApplication.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -13,11 +13,7 @@
 import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementDelta.F_APPLICATION_PATH_VALUE;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.APPLICATION_PATH;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.eclipse.jdt.core.IType;
-import org.eclipse.wst.validation.ValidatorMessage;
 import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementCategory;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
@@ -55,12 +51,6 @@
 		return EnumElementKind.UNDEFINED;
 	}
 
-	@Override
-	public List<ValidatorMessage> validate() {
-		List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
-		return messages;
-	}
-
 	/**
 	 * {@inheritDoc}
 	 */

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaElement.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaElement.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsJavaElement.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -22,6 +22,8 @@
 import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementDelta.F_PATH_VALUE;
 import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementDelta.F_PRODUCED_MEDIATYPES_VALUE;
 import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementDelta.F_QUERY_PARAM_VALUE;
+import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementDelta.F_RETENTION_VALUE;
+import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementDelta.F_TARGET_VALUE;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.APPLICATION_PATH;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.CONSUMES;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.DEFAULT_VALUE;
@@ -31,6 +33,8 @@
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.PATH_PARAM;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.PRODUCES;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.QUERY_PARAM;
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.RETENTION;
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.TARGET;
 
 import java.util.Arrays;
 import java.util.HashMap;
@@ -39,10 +43,21 @@
 import java.util.Map;
 import java.util.Map.Entry;
 
+import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.ValidatorMessage;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation.JaxrsMetamodelValidator;
 import org.jboss.tools.ws.jaxrs.core.internal.utils.CollectionUtils;
+import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
+import org.jboss.tools.ws.jaxrs.core.internal.utils.ValidationMessages;
 import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
+import org.jboss.tools.ws.jaxrs.core.jdt.CompilationUnitsRepository;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
 import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsHttpMethod;
 
@@ -95,7 +110,7 @@
 		}
 	}
 
-	Annotation getAnnotation(String className) {
+	public Annotation getAnnotation(String className) {
 		return annotations.get(className);
 	}
 
@@ -208,7 +223,7 @@
 				iterator.remove();
 				if (annotationName.equals(PATH.qualifiedName)) {
 					flag = F_PATH_VALUE;
-				}else if (annotationName.equals(APPLICATION_PATH.qualifiedName)) {
+				} else if (annotationName.equals(APPLICATION_PATH.qualifiedName)) {
 					flag = F_APPLICATION_PATH_VALUE;
 				} else if (annotationName.equals(HTTP_METHOD.qualifiedName)) {
 					flag = F_HTTP_METHOD_VALUE;
@@ -222,6 +237,10 @@
 					flag = F_CONSUMED_MEDIATYPES_VALUE;
 				} else if (annotationName.equals(PRODUCES.qualifiedName)) {
 					flag = F_PRODUCED_MEDIATYPES_VALUE;
+				} else if (annotationName.equals(TARGET.qualifiedName)) {
+					flag = F_TARGET_VALUE;
+				} else if (annotationName.equals(RETENTION.qualifiedName)) {
+					flag = F_RETENTION_VALUE;
 				} else {
 					for (IJaxrsHttpMethod httpMethod : metamodel.getAllHttpMethods()) {
 						if (httpMethod.getFullyQualifiedName().equals(annotationName)) {
@@ -284,4 +303,29 @@
 		return true;
 	}
 
+	/**
+	 * Creates a validation message from the given parameters. The created validation messages is of the 'JAX-RS' type.
+	 * @param msg the message to display
+	 * @param severity the severity of the marker
+	 * @param region the region that the validation marker points to
+	 * @return the created validation message.
+	 * @throws JavaModelException 
+	ValidatorMessage createValidatorMessage(final String id, final String msg, int severity, final ISourceRange sourceRange)
+			throws JavaModelException {
+		final ValidatorMessage validationMsg = ValidatorMessage.create(msg, this.getResource());
+		validationMsg.setType(JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE);
+		final ICompilationUnit compilationUnit = this.getJavaElement().getCompilationUnit();
+		final CompilationUnit ast = CompilationUnitsRepository.getInstance().getAST(compilationUnit);
+		validationMsg.setAttribute(IMarker.LOCATION,
+				NLS.bind(ValidationMessages.LINE_NUMBER, ast.getLineNumber(sourceRange.getOffset())));
+		validationMsg.setAttribute(IMarker.MARKER, JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE);
+		validationMsg.setAttribute(IMarker.SEVERITY, severity);
+		validationMsg.setAttribute(IMarker.CHAR_START, sourceRange.getOffset());
+		validationMsg.setAttribute(IMarker.CHAR_END, sourceRange.getOffset() + sourceRange.getLength());
+		Logger.debug("Validation message for {}: {}", this.getJavaElement().getElementName(),
+				validationMsg.getAttribute(IMarker.MESSAGE));
+		return validationMsg;
+	}
+	 */
+
 }

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -13,6 +13,7 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -249,7 +250,7 @@
 		// ResourceMethod
 		if (jaxrsElement.getElementCategory() == EnumElementCategory.RESOURCE) {
 			final JaxrsResource resource = (JaxrsResource) jaxrsElement;
-			for (JaxrsResourceMethod resourceMethod : resource.getMethods().values()) {
+			for (JaxrsBaseElement resourceMethod : resource.getMethods().values()) {
 				unindexElement(resourceMethod);
 			}
 			for (JaxrsResourceField resourceField : ((JaxrsResource) jaxrsElement).getFields().values()) {
@@ -293,6 +294,20 @@
 	}
 
 	/**
+	 * Returns an unmodifiable list of all the elements in the Metamodel.
+	 * @return
+	 */
+	public List<JaxrsBaseElement> getAllElements() {
+		final Collection<Set<JaxrsBaseElement>> values = elementsIndex.values();
+		final List<JaxrsBaseElement> elements = new ArrayList<JaxrsBaseElement>();
+		for (Set<JaxrsBaseElement> subSet : values) {
+			elements.addAll(subSet);
+		}
+		return Collections.unmodifiableList(elements);
+	}
+
+
+	/**
 	 * @return the application that is used to compute the Endpoint's URI Path Templates, or null if no application was
 	 *         specified in the code. An invalid application may be returned, though (ie, a Type annotated with
 	 *         {@link javax.ws.rs.ApplicationPath} but not extending the {@link javax.ws.rs.Application} type).
@@ -411,6 +426,9 @@
 	}
 
 	public List<JaxrsBaseElement> getElements(final IJavaElement javaElement) {
+		if(javaElement == null) {
+			return Collections.emptyList();
+		}
 		final String key = javaElement.getHandleIdentifier();
 		final List<JaxrsBaseElement> result = new ArrayList<JaxrsBaseElement>();
 		if (elementsIndex.containsKey(key)) {
@@ -436,23 +454,6 @@
 	}
 
 	public void remove(JaxrsBaseElement element) {
-		switch (element.getElementKind()) {
-		case APPLICATION_WEBXML:
-			remove((JaxrsWebxmlApplication) element);
-			break;
-		default:
-			remove((JaxrsJavaElement<?>)element);
-			break;
-		}
-	}
-
-	/**
-	 * Remove the given JAX-RS Element from the metamodel.
-	 * 
-	 * @param resource
-	 * @return true if the resource was actually removed, false otherwise.
-	 */
-	public void remove(JaxrsJavaElement<?> element) {
 		if (element == null) {
 			return;
 		}
@@ -482,11 +483,6 @@
 		unindexElement(element);
 	}
 
-	public void remove(JaxrsWebxmlApplication application) {
-		this.applications.remove(application);
-		unindexElement(application);
-	}
-
 	public JaxrsHttpMethod getHttpMethod(Annotation httpMethodAnnotation) {
 		if (httpMethodAnnotation != null) {
 			for (IJaxrsHttpMethod httpMethod : httpMethods) {

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsParamBeanProperty.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsParamBeanProperty.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsParamBeanProperty.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -10,11 +10,7 @@
  ******************************************************************************/
 package org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.eclipse.jdt.core.IMethod;
-import org.eclipse.wst.validation.ValidatorMessage;
 import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementCategory;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
@@ -36,12 +32,6 @@
 	}
 
 	@Override
-	public List<ValidatorMessage> validate() {
-		List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
-		return messages;
-	}
-
-	@Override
 	public EnumElementKind getElementKind() {
 		return null;
 	}

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsProvider.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsProvider.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsProvider.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -16,7 +16,6 @@
 import java.util.Map;
 
 import org.eclipse.jdt.core.IType;
-import org.eclipse.wst.validation.ValidatorMessage;
 import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementCategory;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
@@ -102,12 +101,6 @@
 	}
 
 	@Override
-	public List<ValidatorMessage> validate() {
-		List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
-		return messages;
-	}
-
-	@Override
 	public EnumElementKind getElementKind() {
 		final boolean isMessageBodyReader = providedKinds.get(EnumElementKind.MESSAGE_BODY_READER) != null;
 		final boolean isMessageBodyWriter = providedKinds.get(EnumElementKind.MESSAGE_BODY_WRITER) != null;

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResource.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResource.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResource.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -20,11 +20,8 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 
 import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.wst.validation.ValidatorMessage;
 import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementCategory;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
@@ -208,19 +205,11 @@
 		return resourceFields;
 	}
 
+	/**
+	 * @return the resource methods indexed by their associated java method handleIdentifier
+	 */
 	public Map<String, JaxrsResourceMethod> getMethods() {
 		return resourceMethods;
 	}
 
-	@Override
-	public List<ValidatorMessage> validate() throws JavaModelException {
-		List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
-		// delegating the validation to the undelying resource methods
-		for (Entry<String, JaxrsResourceMethod> entry : resourceMethods.entrySet()) {
-			final JaxrsResourceMethod resourceMethod = entry.getValue();
-			messages.addAll(resourceMethod.validate());
-		}
-		return messages;
-	}
-
 }

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceField.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceField.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceField.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -15,11 +15,9 @@
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.PATH_PARAM;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.QUERY_PARAM;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.jdt.core.IField;
-import org.eclipse.wst.validation.ValidatorMessage;
 import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementCategory;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
@@ -60,12 +58,6 @@
 	}
 
 	@Override
-	public List<ValidatorMessage> validate() {
-		List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
-		return messages;
-	}
-
-	@Override
 	public EnumElementKind getElementKind() {
 		if (getPathParamAnnotation() != null) {
 			return EnumElementKind.PATH_PARAM_FIELD;

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -14,30 +14,18 @@
 import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementDelta.F_METHOD_PARAMETERS;
 import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementDelta.F_METHOD_RETURN_TYPE;
 import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementDelta.F_NONE;
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.CONSUMES;
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.PATH;
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.PRODUCES;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.*;
-
-
-
-import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.ISourceRange;
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.validation.ValidatorMessage;
-import org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsMetamodelBuilder;
-import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
-import org.jboss.tools.ws.jaxrs.core.internal.utils.ValidationMessages;
 import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
-import org.jboss.tools.ws.jaxrs.core.jdt.CompilationUnitsRepository;
 import org.jboss.tools.ws.jaxrs.core.jdt.JavaMethodParameter;
 import org.jboss.tools.ws.jaxrs.core.jdt.JavaMethodSignature;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementCategory;
@@ -49,12 +37,6 @@
 public class JaxrsResourceMethod extends JaxrsResourceElement<IMethod>
 		implements IJaxrsResourceMethod {
 
-	/** The parameter type names that can be annotated with {@link Context}. */
-	private final static List<String> CONTEXT_TYPE_NAMES = new ArrayList<String>(Arrays.asList(
-			"javax.ws.rs.core.HttpHeaders", "javax.ws.rs.core.UriInfo", "javax.ws.rs.core.Request",
-			"javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "javax.servlet.ServletConfig",
-			"javax.servlet.ServletContext", "javax.ws.rs.core.SecurityContext"));
-
 	private final JaxrsResource parentResource;
 
 	/**
@@ -200,149 +182,6 @@
 		return EnumElementCategory.RESOURCE_METHOD;
 	}
 
-	@Override
-	public List<ValidatorMessage> validate() throws JavaModelException {
-		this.hasErrors(false);
-		final List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
-		messages.addAll(validateMissingPathValueInPathParamAnnotations());
-		messages.addAll(validateMissingPathParamAnnotations());
-		messages.addAll(validateParamsWithContextAnnotation());
-		messages.addAll(validateSingleParamWithoutAnnotation());
-		return messages;
-	}
-
-	/**
-	 * Validate that only one method parameter is not annotated with a JAX-RS
-	 * annotation. This non-annotated parameter is the "Entity parameter",
-	 * coming from the client's request body, unmarshalled by the appropriate
-	 * {@link MesssageBodyReader}.
-	 * 
-	 * @return
-	 */
-	private List<ValidatorMessage> validateSingleParamWithoutAnnotation() {
-		final List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
-		return messages;
-	}
-
-	/**
-	 * Validates that the method parameters annotated with {@link Context} are
-	 * of the supported types in the spec: {@link UriInfo}, {@link HttpHeaders},
-	 * {@link ServletConfig}, {@link ServletContext}, {@link HttpServletRequest}
-	 * , {@link Request}, {@link HttpServletResponse} and {@link Response}.
-	 * 
-	 * @return
-	 * @throws JavaModelException 
-	 */
-	private List<ValidatorMessage> validateParamsWithContextAnnotation() throws JavaModelException {
-		final List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
-		for (JavaMethodParameter parameter : this.javaMethodParameters) {
-			final Annotation annotation = parameter.getAnnotation(CONTEXT.qualifiedName);
-			final String typeName = parameter.getTypeName();
-			if (annotation != null && typeName != null
-					&& !CONTEXT_TYPE_NAMES.contains(typeName)) {
-				final String msg = NLS
-								.bind(ValidationMessages.INVALID_CONTEXT_ANNOTATION,
-										typeName);
-				ValidatorMessage validationMsg = createValidationMessage(msg, IMarker.SEVERITY_ERROR, parameter.getRegion().getOffset(), parameter.getRegion().getLength());
-				messages.add(validationMsg);
-				this.hasErrors(true);
-			}
-		}
-		return messages;	
-	}
-
-	/**
-	 * Validates that the @Path annotation parameters have a counterpart in the
-	 * java method paramters, otherwise, issues some markers with a 'warning'
-	 * severity.
-	 * 
-	 * @return
-	 * @throws JavaModelException
-	 */
-	private List<ValidatorMessage> validateMissingPathParamAnnotations()
-			throws JavaModelException {
-		final List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
-		final List<String> pathParamValueProposals = getPathParamValueProposals();
-		for (String proposal : pathParamValueProposals) {
-			boolean matching = false;
-			for (JavaMethodParameter parameter : this.javaMethodParameters) {
-				final Annotation annotation = parameter
-						.getAnnotation(PATH_PARAM.qualifiedName);
-				if (annotation != null && annotation.getValue("value") != null
-						&& annotation.getValue("value").equals(proposal)) {
-					matching = true;
-					break;
-				}
-			}
-			if (!matching) {
-				final String msg = NLS
-						.bind(ValidationMessages.INVALID_PATHPARAM_VALUE,
-								proposal);
-				final ISourceRange nameRange = getJavaElement().getNameRange();
-				ValidatorMessage validationMsg = createValidationMessage(msg, IMarker.SEVERITY_WARNING, nameRange.getOffset(), nameRange.getLength());
-				messages.add(validationMsg);
-			}
-		}
-		return messages;
-	}
-
-	/**
-	 * Checks that the {@link PathParam} annotation values match the params in
-	 * the {@link Path} annotations at the method and the parent type levels.
-	 * 
-	 * @return errors in case of mismatch, empty list otherwise.
-	 * @throws JavaModelException 
-	 */
-	private List<ValidatorMessage> validateMissingPathValueInPathParamAnnotations() throws JavaModelException {
-		final List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
-		final List<String> pathParamValueProposals = getPathParamValueProposals();
-		for (JavaMethodParameter parameter : this.javaMethodParameters) {
-			final Annotation annotation = parameter
-					.getAnnotation(PATH_PARAM.qualifiedName);
-			if (annotation != null) {
-				final String value = annotation.getValue("value");
-				if(value != null) {
-					if (!pathParamValueProposals.contains(value)) {
-						final String msg = NLS
-								.bind(ValidationMessages.INVALID_PATHPARAM_VALUE,
-										pathParamValueProposals);
-						final ISourceRange region = annotation.getSourceRange();
-						ValidatorMessage validationMsg = createValidationMessage(msg, IMarker.SEVERITY_ERROR, region.getOffset(), region.getLength());
-						hasErrors(true);
-						messages.add(validationMsg);
-					}
-				}
-			}
-		}
-		return messages;
-	}
-
-	/**
-	 * Creates a validation message from the given parameters. The created validation messages is of the 'JAX-RS' type.
-	 * @param msg the message to display
-	 * @param severity the severity of the marker
-	 * @param region the region that the validation marker points to
-	 * @return the created validation message.
-	 * @throws JavaModelException 
-	 */
-	private ValidatorMessage createValidationMessage(final String msg,
-			int severity, final int offset, int length) throws JavaModelException {
-		final ValidatorMessage validationMsg = ValidatorMessage.create(msg,
-				this.getResource());
-		validationMsg.setType(JaxrsMetamodelBuilder.JAXRS_PROBLEM);
-		final ICompilationUnit compilationUnit = this.getJavaElement().getCompilationUnit();
-		final CompilationUnit ast = CompilationUnitsRepository.getInstance().getAST(compilationUnit);
-		validationMsg.setAttribute(IMarker.LOCATION, NLS.bind(ValidationMessages.LINE_NUMBER, ast.getLineNumber(offset)));
-		validationMsg.setAttribute(IMarker.MARKER,
-				JaxrsMetamodelBuilder.JAXRS_PROBLEM);
-		validationMsg.setAttribute(IMarker.SEVERITY, severity);
-		validationMsg.setAttribute(IMarker.CHAR_START, offset);
-		validationMsg.setAttribute(IMarker.CHAR_END, offset + length);
-		Logger.debug("Validation message for {}: {}", this.getJavaElement()
-				.getElementName(), validationMsg.getAttribute(IMarker.MESSAGE));
-		return validationMsg;
-	}
-
 	
 	/*
 	 * (non-Javadoc)

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsWebxmlApplication.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsWebxmlApplication.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsWebxmlApplication.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -2,10 +2,7 @@
 
 import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsElementDelta.F_APPLICATION_PATH_VALUE;
 
-import java.util.List;
-
 import org.eclipse.core.resources.IResource;
-import org.eclipse.wst.validation.ValidatorMessage;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementCategory;
 import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
 import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsApplication;
@@ -71,12 +68,6 @@
 		return webxmlResource != null ? webxmlResource.getName() : "*unknown resource*";
 	}
 
-	@Override
-	public List<ValidatorMessage> validate() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
 	/*
 	 * (non-Javadoc)
 	 * @see java.lang.Object#hashCode()

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/AbstractJaxrsElementValidatorDelegate.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/AbstractJaxrsElementValidatorDelegate.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/AbstractJaxrsElementValidatorDelegate.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,45 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;
+
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.common.validation.TempMarkerManager;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsBaseElement;
+
+/**
+ * @author Xavier Coulon
+ *
+ */
+public abstract class AbstractJaxrsElementValidatorDelegate<T extends JaxrsBaseElement> {
+	
+	private final T element;
+	
+	private final TempMarkerManager markerManager;
+	
+	public AbstractJaxrsElementValidatorDelegate(TempMarkerManager markerManager, T element) {
+		this.markerManager = markerManager;
+		this.element = element;
+	}
+	
+	public abstract void validate() throws CoreException;
+
+	public T getElement() {
+		return element;
+	}
+
+	/**
+	 * @return the validator
+	 */
+	public TempMarkerManager getMarkerManager() {
+		return markerManager;
+	}
+
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/AbstractJaxrsElementValidatorDelegate.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsApplicationValidatorDelegate.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsApplicationValidatorDelegate.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsApplicationValidatorDelegate.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,24 @@
+package org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;
+
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.common.validation.TempMarkerManager;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsJavaApplication;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsResource;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsResourceMethod;
+import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsResourceMethod;
+
+public class JaxrsApplicationValidatorDelegate extends AbstractJaxrsElementValidatorDelegate<JaxrsJavaApplication> {
+
+	public JaxrsApplicationValidatorDelegate(TempMarkerManager markerManager, JaxrsJavaApplication element) {
+		super(markerManager, element);
+	}
+
+	@Override
+	public void validate() throws CoreException {
+		final JaxrsJavaApplication resource = getElement();
+		MarkerUtils.clearMarkers(resource.getResource());
+	}
+	
+	
+
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsApplicationValidatorDelegate.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsHttpMethodValidatorDelegate.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsHttpMethodValidatorDelegate.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsHttpMethodValidatorDelegate.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,118 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.common.validation.TempMarkerManager;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsHttpMethod;
+import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
+import org.jboss.tools.ws.jaxrs.core.metamodel.quickfix.JaxrsValidationQuickFixes;
+import org.jboss.tools.ws.jaxrs.core.preferences.JaxrsPreferences;
+
+/**
+ * @author Xavier Coulon
+ * 
+ */
+public class JaxrsHttpMethodValidatorDelegate extends AbstractJaxrsElementValidatorDelegate<JaxrsHttpMethod> {
+
+	public JaxrsHttpMethodValidatorDelegate(TempMarkerManager markerManager, JaxrsHttpMethod element) {
+		super(markerManager, element);
+	}
+
+	@Override
+	public void validate() throws CoreException {
+		final JaxrsHttpMethod httpMethod = getElement();
+		MarkerUtils.clearMarkers(httpMethod.getResource());
+		if (!httpMethod.isBuiltIn()) {
+			validateHttpMethodAnnotation(httpMethod);
+			validateRetentionAnnotation(getElement());
+			validateTargetAnnotation(getElement());
+		}
+	}
+
+	/**
+	 * Validates that annotation value is not null nor empty
+	 * 
+	 * @param messages
+	 * @throws JavaModelException
+	 */
+	private void validateHttpMethodAnnotation(final JaxrsHttpMethod httpMethod) {
+		final Annotation annotation = httpMethod.getHttpMethodAnnotation();
+		if (annotation != null) { // if annotation is null, the resource is not a JaxrsHttpMethod anymore.
+			final String httpValue = annotation.getValue("value");
+			if (httpValue == null || httpValue.isEmpty()) {
+				getMarkerManager().addProblem(JaxrsValidationMessages.HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE,
+						JaxrsPreferences.HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE, new String[0],
+						annotation.getSourceRange().getLength(), annotation.getSourceRange().getOffset(),
+						httpMethod.getResource());
+			}
+		}
+	}
+
+	/**
+	 * Validate that annotation exists and value is Target.METHOD
+	 * 
+	 * @param messages
+	 * @throws JavaModelException
+	 */
+	private void validateTargetAnnotation(final JaxrsHttpMethod httpMethod) {
+		final Annotation targetAnnotation = httpMethod.getTargetAnnotation();
+		final Annotation httpMethodAnnotation = httpMethod.getHttpMethodAnnotation();
+		if (targetAnnotation == null) {
+			getMarkerManager().addProblem(JaxrsValidationMessages.HTTP_METHOD_MISSING_TARGET_ANNOTATION,
+					JaxrsPreferences.HTTP_METHOD_MISSING_TARGET_ANNOTATION, new String[0],
+					httpMethodAnnotation.getSourceRange().getLength(),
+					httpMethodAnnotation.getSourceRange().getOffset(), httpMethod.getResource(),
+					JaxrsValidationQuickFixes.HTTP_METHOD_MISSING_TARGET_ANNOTATION_ID);
+		} else {
+			final String annotationValue = targetAnnotation.getValue("value");
+			if (annotationValue == null || !annotationValue.equals(ElementType.METHOD.name())) {
+				getMarkerManager().addProblem(JaxrsValidationMessages.HTTP_METHOD_INVALID_TARGET_ANNOTATION_VALUE,
+						JaxrsPreferences.HTTP_METHOD_INVALID_TARGET_ANNOTATION_VALUE, new String[0],
+						httpMethodAnnotation.getSourceRange().getLength(),
+						httpMethodAnnotation.getSourceRange().getOffset(), httpMethod.getResource(),
+						JaxrsValidationQuickFixes.HTTP_METHOD_INVALID_TARGET_ANNOTATION_VALUE_ID);
+			}
+		}
+	}
+
+	/**
+	 * Validate that annotation exists and value is Retention.RUNTIME
+	 * 
+	 * @param messages
+	 * @throws JavaModelException
+	 */
+	private void validateRetentionAnnotation(final JaxrsHttpMethod httpMethod) {
+		final Annotation retentionAnnotation = httpMethod.getRetentionAnnotation();
+		final Annotation httpMethodAnnotation = httpMethod.getHttpMethodAnnotation();
+		if (retentionAnnotation == null) {
+			getMarkerManager().addProblem(JaxrsValidationMessages.HTTP_METHOD_MISSING_RETENTION_ANNOTATION,
+					JaxrsPreferences.HTTP_METHOD_MISSING_RETENTION_ANNOTATION, new String[0],
+					httpMethodAnnotation.getSourceRange().getLength(),
+					httpMethodAnnotation.getSourceRange().getOffset(), httpMethod.getResource(),
+					JaxrsValidationQuickFixes.HTTP_METHOD_MISSING_RETENTION_ANNOTATION_ID);
+		} else {
+			final String annotationValue = retentionAnnotation.getValue("value");
+			if (annotationValue == null || !annotationValue.equals(RetentionPolicy.RUNTIME.name())) {
+				getMarkerManager().addProblem(JaxrsValidationMessages.HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE,
+						JaxrsPreferences.HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE, new String[0],
+						httpMethodAnnotation.getSourceRange().getLength(),
+						httpMethodAnnotation.getSourceRange().getOffset(), httpMethod.getResource(),
+						JaxrsValidationQuickFixes.HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE_ID);
+			}
+		}
+	}
+
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsHttpMethodValidatorDelegate.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Deleted: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -1,84 +0,0 @@
-/******************************************************************************* 
- * Copyright (c) 2008 Red Hat, Inc. 
- * Distributed under license by Red Hat, Inc. All rights reserved. 
- * This program is 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: 
- * Xavier Coulon - Initial API and implementation 
- ******************************************************************************/
-package org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.wst.validation.AbstractValidator;
-import org.eclipse.wst.validation.ValidationResult;
-import org.eclipse.wst.validation.ValidationState;
-import org.eclipse.wst.validation.ValidatorMessage;
-import org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsMetamodelBuilder;
-import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsBaseElement;
-import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsMetamodel;
-import org.jboss.tools.ws.jaxrs.core.internal.utils.ConstantUtils;
-import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
-import org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils;
-import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementCategory;
-import org.jboss.tools.ws.jaxrs.core.metamodel.JaxrsMetamodelLocator;
-
-public class JaxrsMetamodelValidator extends AbstractValidator {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.wst.validation.AbstractValidator#validate(org.eclipse.core
-	 * .resources.IResource, int, org.eclipse.wst.validation.ValidationState,
-	 * org.eclipse.core.runtime.IProgressMonitor)
-	 */
-	@Override
-	public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
-		final ValidationResult validationResult = new ValidationResult();
-		final IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
-		try {
-			subMonitor.beginTask("Validating the JAX-RS Metamodel", 1);
-			if (resource.getType() == IResource.FILE && "java".equals(resource.getFileExtension())) {
-				clearMarkers((IFile) resource);
-				final JaxrsMetamodel jaxrsMetamodel = JaxrsMetamodelLocator.get(resource.getProject());
-				if (jaxrsMetamodel == null) {
-					return validationResult;
-				}
-				List<JaxrsBaseElement> elements = jaxrsMetamodel.getElements(JdtUtils.getCompilationUnit(resource));
-				for(JaxrsBaseElement element : elements) {
-					if (element.getElementCategory() == EnumElementCategory.RESOURCE) {
-						Logger.debug("Validating the JAX-RS Metamodel after {} was {}", resource.getName(),
-								ConstantUtils.getStaticFieldName(IResourceDelta.class, kind));
-						List<ValidatorMessage> validationMessages = element.validate();
-						for (ValidatorMessage validationMessage : validationMessages) {
-							validationResult.add(validationMessage);
-						}
-					}
-				}
-			}
-		} catch (CoreException e) {
-			Logger.error("Failed to validate the resource change", e);
-		} finally {
-			subMonitor.done();
-		}
-		return validationResult;
-	}
-
-	private void clearMarkers(IFile file) {
-		try {
-			file.deleteMarkers(JaxrsMetamodelBuilder.JAXRS_PROBLEM, true,
-					org.eclipse.core.resources.IResource.DEPTH_INFINITE);
-		} catch (CoreException e) {
-		}
-	}
-
-}

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,242 @@
+/******************************************************************************* 
+ * Copyright (c) 2008 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Xavier Coulon - Initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.jboss.tools.common.validation.ContextValidationHelper;
+import org.jboss.tools.common.validation.EditorValidationContext;
+import org.jboss.tools.common.validation.IAsYouTypeValidator;
+import org.jboss.tools.common.validation.IProjectValidationContext;
+import org.jboss.tools.common.validation.IValidatingProjectTree;
+import org.jboss.tools.common.validation.IValidator;
+import org.jboss.tools.common.validation.TempMarkerManager;
+import org.jboss.tools.common.validation.ValidatorManager;
+import org.jboss.tools.common.validation.internal.SimpleValidatingProjectTree;
+import org.jboss.tools.ws.jaxrs.core.configuration.ProjectNatureUtils;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsMetamodelBuilder;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsBaseElement;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsHttpMethod;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsMetamodel;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsResource;
+import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
+import org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils;
+import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsApplication;
+import org.jboss.tools.ws.jaxrs.core.metamodel.JaxrsMetamodelLocator;
+import org.jboss.tools.ws.jaxrs.core.preferences.JaxrsPreferences;
+
+ at SuppressWarnings("restriction")
+public class JaxrsMetamodelValidator extends TempMarkerManager implements IValidator, IAsYouTypeValidator {
+
+	/** The JAX-RS Validator ID. */
+	public static final String ID = "org.jboss.tools.ws.jaxrs.JaxrsMetamodelValidator"; //$NON-NLS-1$
+
+	/** The custom 'JAX-RS Problem' marker type. */
+	public static final String JAXRS_PROBLEM_TYPE = "org.jboss.tools.ws.jaxrs.metamodelMarker";
+
+	private static final String BUNDLE_NAME = JaxrsMetamodelValidator.class.getPackage().getName() + ".messages";
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.jst.web.kb.validation.IValidator#isEnabled(org.eclipse.core.resources.IProject)
+	 */
+	public boolean isEnabled(IProject project) {
+		return JaxrsPreferences.isValidationEnabled(project);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.jst.web.kb.validation.IValidator#shouldValidate(org.eclipse .core.resources.IProject)
+	 */
+	public boolean shouldValidate(IProject project) {
+		try {
+			return project.isAccessible() && project.hasNature(ProjectNatureUtils.JAXRS_NATURE_ID)
+					&& isEnabled(project);
+		} catch (CoreException e) {
+			Logger.error("Failed to check if JAX-RS validation is required for project '" + project.getName() + "'", e);
+		}
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.jst.web.kb.validation.IValidator#validate(java.util.Set,
+	 * org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper,
+	 * org.jboss.tools.jst.web.kb.validation.IProjectValidationContext,
+	 * org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager,
+	 * org.eclipse.wst.validation.internal.provisional.core.IReporter)
+	 */
+	public IStatus validate(Set<IFile> changedFiles, IProject project, ContextValidationHelper validationHelper,
+			IProjectValidationContext context, ValidatorManager manager, IReporter reporter) throws ValidationException {
+		init(project, validationHelper, context, manager, reporter);
+		setAsYouTypeValidation(false);
+		for (IFile changedFile : changedFiles) {
+			validate(reporter, changedFile);
+		}
+		return Status.OK_STATUS;
+	}
+
+	/**
+	 * @param reporter
+	 * @param file
+	 * @throws CoreException
+	 */
+	private void validate(final IReporter reporter, final IFile file) {
+		if (reporter.isCancelled() || !file.isAccessible()) {
+			return;
+		}
+		displaySubtask(JaxrsValidationMessages.VALIDATING_RESOURCE,
+				new String[] { file.getProject().getName(), file.getName() });
+		try {
+			// clearMarkers((IFile) resource);
+			final JaxrsMetamodel jaxrsMetamodel = JaxrsMetamodelLocator.get(file.getProject());
+			if (jaxrsMetamodel != null) {
+				List<JaxrsBaseElement> elements = jaxrsMetamodel.getElements(JdtUtils.getCompilationUnit(file));
+				for (JaxrsBaseElement element : elements) {
+					validate(element);
+				}
+			}
+		} catch (CoreException e) {
+			Logger.error("Failed to validate the resource change", e);
+		}
+	}
+
+	@Override
+	public void validate(org.eclipse.wst.validation.internal.provisional.core.IValidator validatorManager,
+			IProject rootProject, Collection<IRegion> dirtyRegions, IValidationContext helper, IReporter reporter,
+			EditorValidationContext validationContext, IProjectValidationContext projectContext, IFile file) {
+		ContextValidationHelper validationHelper = new ContextValidationHelper();
+		validationHelper.setProject(rootProject);
+		validationHelper.setValidationContextManager(validationContext);
+		init(rootProject, validationHelper, projectContext, validatorManager, reporter);
+		setAsYouTypeValidation(false);
+		this.document = validationContext.getDocument();
+		displaySubtask(JaxrsValidationMessages.VALIDATING_RESOURCE,
+				new String[] { file.getProject().getName(), file.getName() });
+		validate(reporter, file);
+	}
+
+	@Override
+	public IStatus validateAll(IProject project, ContextValidationHelper validationHelper,
+			IProjectValidationContext validationContext, ValidatorManager manager, IReporter reporter)
+			throws ValidationException {
+		init(project, validationHelper, validationContext, manager, reporter);
+		setAsYouTypeValidation(false);
+		displaySubtask(JaxrsValidationMessages.VALIDATING_PROJECT, new String[] { project.getName() });
+		try {
+			final JaxrsMetamodel jaxrsMetamodel = JaxrsMetamodelLocator.get(project);
+			// validate that the number of jax-rs applications (java or web.xml) is 1.
+			validateJaxrsApplicationDeclarations(jaxrsMetamodel);
+			// validate all other elements
+			if (jaxrsMetamodel != null) {
+				for (JaxrsBaseElement element : jaxrsMetamodel.getAllElements()) {
+					validate(element);
+				}
+			}
+		} catch (CoreException e) {
+			Logger.error("Failed to validate project '", e);
+		}
+
+		return Status.OK_STATUS;
+	}
+
+	private void validateJaxrsApplicationDeclarations(JaxrsMetamodel jaxrsMetamodel) throws CoreException {
+		MarkerUtils.clearMarkers(jaxrsMetamodel.getProject());
+		final List<IJaxrsApplication> allApplications = jaxrsMetamodel.getAllApplications();
+		if(allApplications.isEmpty()) {
+			this.addProblem(JaxrsValidationMessages.APPLICATION_NO_OCCURRENCE_FOUND,
+					JaxrsPreferences.APPLICATION_NO_OCCURRENCE_FOUND, new String[0],
+					0, 0, jaxrsMetamodel.getProject());
+			
+		} else if(allApplications.size() > 1) {
+			this.addProblem(JaxrsValidationMessages.APPLICATION_TOO_MANY_OCCURRENCES,
+					JaxrsPreferences.APPLICATION_TOO_MANY_OCCURRENCES, new String[0],
+					0, 0, jaxrsMetamodel.getProject());
+		}
+	}
+
+	/**
+	 * Uses the appropriate validator to validate the given JAX-RS element, or does nothing if no validator could be
+	 * found.
+	 * 
+	 * @param element
+	 * @throws CoreException
+	 */
+	private void validate(JaxrsBaseElement element) throws CoreException {
+		Logger.debug("Validating element {}", element.getName());
+			switch (element.getElementCategory()) {
+			case APPLICATION:
+				break;
+			case HTTP_METHOD:
+				new JaxrsHttpMethodValidatorDelegate(this, (JaxrsHttpMethod) element).validate();
+			case PROVIDER:
+				break;
+			case RESOURCE:
+				// this validator delegate also deals with ResourceMethods and ResourceFields 
+				new JaxrsResourceValidatorDelegate(this, (JaxrsResource) element).validate();
+			default:
+				// skipping other categories of elements at this validator level. (see above)
+				break;
+		}
+	}
+
+	@Override
+	protected String getMessageBundleName() {
+		return BUNDLE_NAME;
+	}
+
+	@Override
+	protected String getPreference(IProject project, String preferenceKey) {
+		return JaxrsPreferences.getInstance().getProjectPreference(project, preferenceKey);
+	}
+
+	@Override
+	protected String getPreferencePageId() {
+		return "org.jboss.tools.ws.jaxrs.ui";
+	}
+
+	@Override
+	public int getMaxNumberOfMarkersPerFile(IProject project) {
+		return JaxrsPreferences.getMaxNumberOfProblemMarkersPerFile(project);
+	}
+
+	@Override
+	public String getMarkerType() {
+		return JAXRS_PROBLEM_TYPE;
+	}
+
+	@Override
+	public String getId() {
+		return ID;
+	}
+
+	@Override
+	public String getBuilderId() {
+		return JaxrsMetamodelBuilder.BUILDER_ID;
+	}
+
+	@Override
+	public IValidatingProjectTree getValidatingProjects(IProject project) {
+		return new SimpleValidatingProjectTree(project);
+	}
+
+}

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsResourceMethodValidatorDelegate.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsResourceMethodValidatorDelegate.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsResourceMethodValidatorDelegate.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,215 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;
+
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.CONTEXT;
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.PATH_PARAM;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.common.validation.TempMarkerManager;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsResourceMethod;
+import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
+import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
+import org.jboss.tools.ws.jaxrs.core.jdt.JavaMethodParameter;
+import org.jboss.tools.ws.jaxrs.core.preferences.JaxrsPreferences;
+
+/**
+ * Validates the given JAX-RS resource
+ * 
+ * @author Xavier Coulon
+ * 
+ */
+public class JaxrsResourceMethodValidatorDelegate extends AbstractJaxrsElementValidatorDelegate<JaxrsResourceMethod> {
+
+	/** The parameter type names that can be annotated with <code>Context</code>. */
+	private final static List<String> CONTEXT_TYPE_NAMES = new ArrayList<String>(Arrays.asList(
+			"javax.ws.rs.core.HttpHeaders", "javax.ws.rs.core.UriInfo", "javax.ws.rs.core.Request",
+			"javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse",
+			"javax.servlet.ServletConfig", "javax.servlet.ServletContext", "javax.ws.rs.core.SecurityContext"));
+
+	private static final Pattern pattern = Pattern.compile("[a-zA-Z1-9]+");
+
+	public JaxrsResourceMethodValidatorDelegate(final TempMarkerManager markerManager,
+			final JaxrsResourceMethod resourceMethod) {
+		super(markerManager, resourceMethod);
+
+	}
+
+	@Override
+	public void validate() {
+		final JaxrsResourceMethod resourceMethod = getElement();
+		try {
+			resourceMethod.hasErrors(false);
+			validatePublicModifierOnJavaMethod(resourceMethod);
+			validateNoUnboundPathAnnotationTemplateParameters(resourceMethod);
+			validateNoUnboundPathParamAnnotationValues(resourceMethod);
+			validateNoUnauthorizedContextAnnotationOnJavaMethodParameters(resourceMethod);
+			validateAtMostOneMethodParameterWithoutAnnotation(resourceMethod);
+		} catch (JavaModelException e) {
+			Logger.error("Failed to validate JAX-RS Resource Method '" + resourceMethod.getName() + "'", e);
+		}
+	}
+
+	/**
+	 * Validate that at most one method parameter is not annotated with a JAX-RS annotation. This non-annotated
+	 * parameter is the "Entity parameter", coming from the client's request body, unmarshalled by the appropriate
+	 * {@link MesssageBodyReader}.
+	 * 
+	 * @return
+	 * @throws JavaModelException
+	 */
+	private void validateAtMostOneMethodParameterWithoutAnnotation(final JaxrsResourceMethod resourceMethod)
+			throws JavaModelException {
+		int counter = 0;
+		for (JavaMethodParameter parameter : resourceMethod.getJavaMethodParameters()) {
+			// Should count parameters annotated with:
+			// @MatrixParam, @QueryParam, @PathParam, @CookieParam, @HeaderParam, @Context or @FormParam
+			final List<Annotation> jaxrsAnnotations = parameter.getAnnotations();
+			if (jaxrsAnnotations.size() == 0) {
+				counter++;
+			}
+		}
+		if (counter > 1) {
+			final ISourceRange nameRange = resourceMethod.getJavaElement().getNameRange();
+			Logger.debug("Reporting problem of type {} on ResourceMethod {}.{}",
+					JaxrsPreferences.RESOURCE_METHOD_MORE_THAN_ONE_UNANNOTATED_PARAMETER, resourceMethod
+							.getParentResource().getName(), resourceMethod.getName());
+			getMarkerManager().addProblem(JaxrsValidationMessages.RESOURCE_METHOD_MORE_THAN_ONE_UNANNOTATED_PARAMETER,
+					JaxrsPreferences.RESOURCE_METHOD_MORE_THAN_ONE_UNANNOTATED_PARAMETER, new String[0],
+					nameRange.getLength(), nameRange.getOffset(), resourceMethod.getResource());
+			resourceMethod.hasErrors(true);
+		}
+	}
+
+	/**
+	 * Validates that the method parameters annotated with <code>Context</code> are of the supported types in the spec:
+	 * <code>UriInfo</code>, <code>HttpHeaders<code>, <code>ServletConfig</code>, <code>ServletContext</code>,
+	 * <code>HttpServletRequest</code> , <code>Request</code>, <code>HttpServletResponse</code> and
+	 * <code>@link Response</code>.
+	 * 
+	 * @return
+	 * @throws JavaModelException
+	 */
+	private void validateNoUnauthorizedContextAnnotationOnJavaMethodParameters(final JaxrsResourceMethod resourceMethod) {
+		for (JavaMethodParameter parameter : resourceMethod.getJavaMethodParameters()) {
+			final Annotation contextAnnotation = parameter.getAnnotation(CONTEXT.qualifiedName);
+			final String typeName = parameter.getTypeName();
+			if (contextAnnotation != null && typeName != null && !CONTEXT_TYPE_NAMES.contains(typeName)) {
+				Logger.debug("Reporting problem of type {} on ResourceMethod {}.{}",
+						JaxrsPreferences.RESOURCE_METHOD_ILLEGAL_CONTEXT_ANNOTATION, resourceMethod.getParentResource()
+								.getName(), resourceMethod.getName());
+				getMarkerManager().addProblem(JaxrsValidationMessages.RESOURCE_METHOD_ILLEGAL_CONTEXT_ANNOTATION,
+						JaxrsPreferences.RESOURCE_METHOD_ILLEGAL_CONTEXT_ANNOTATION,
+						new String[] { CONTEXT_TYPE_NAMES.toString() }, contextAnnotation.getSourceRange().getLength(),
+						contextAnnotation.getSourceRange().getOffset(), resourceMethod.getResource());
+				resourceMethod.hasErrors(true);
+			}
+		}
+	}
+
+	/**
+	 * Checks that there is no unbound Path template parameter in the <code>@Path</code> annotations by checking the
+	 * method @PathParam annotated parameters. Report a problem if a Path template parameter has no equivalent in the
+	 * java method's parameters.
+	 * 
+	 * @return errors in case of mismatch, empty list otherwise.
+	 * @throws JavaModelException
+	 */
+	private void validateNoUnboundPathAnnotationTemplateParameters(final JaxrsResourceMethod resourceMethod)
+			throws JavaModelException {
+		final List<String> pathParamValueProposals = resourceMethod.getPathParamValueProposals();
+		final List<String> pathParamValues = new ArrayList<String>();
+		for (JavaMethodParameter parameter : resourceMethod.getJavaMethodParameters()) {
+			final Annotation annotation = parameter.getAnnotation(PATH_PARAM.qualifiedName);
+			if (annotation != null && annotation.getValue() != null) {
+				pathParamValues.add(annotation.getValue());
+			}
+		}
+		final ISourceRange nameRange = resourceMethod.getJavaElement().getNameRange();
+		for (String pathTemplateParameter : pathParamValueProposals) {
+			if (!pathParamValues.contains(pathTemplateParameter)) {
+				Logger.debug("Reporting problem of type {} on ResourceMethod {}.{}",
+						JaxrsPreferences.RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER, resourceMethod
+								.getParentResource().getName(), resourceMethod.getName());
+				getMarkerManager().addProblem(
+						JaxrsValidationMessages.RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER,
+						JaxrsPreferences.RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER,
+						new String[] { pathTemplateParameter }, nameRange.getLength(), nameRange.getOffset(),
+						resourceMethod.getResource());
+				resourceMethod.hasErrors(true);
+			}
+		}
+	}
+
+	/**
+	 * Report a problem for each <code>@PathParam</code> annotation value that have no counterpart in the
+	 * <code>@Path</code> template parameters.
+	 * 
+	 * @return
+	 * @throws JavaModelException
+	 */
+	private void validateNoUnboundPathParamAnnotationValues(final JaxrsResourceMethod resourceMethod)
+			throws JavaModelException {
+		final List<String> pathParamValueProposals = resourceMethod.getPathParamValueProposals();
+		for (JavaMethodParameter parameter : resourceMethod.getJavaMethodParameters()) {
+			final Annotation annotation = parameter.getAnnotation(PATH_PARAM.qualifiedName);
+			if (annotation != null) {
+				final String pathParamValue = annotation.getValue("value");
+				if (pathParamValue != null) {
+					if (!pattern.matcher(pathParamValue).matches()) {
+						final ISourceRange sourceRange = annotation.getSourceRange();
+						Logger.debug("Reporting problem of type {} on ResourceMethod {}.{}",
+								JaxrsPreferences.RESOURCE_METHOD_INVALID_PATHPARAM_ANNOTATION_VALUE, resourceMethod
+										.getParentResource().getName(), resourceMethod.getName());
+						getMarkerManager().addProblem(
+								JaxrsValidationMessages.RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE,
+								JaxrsPreferences.RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE,
+								new String[] { pathParamValue }, sourceRange.getLength(), sourceRange.getOffset(),
+								resourceMethod.getResource());
+						resourceMethod.hasErrors(true);
+					} else if (!pathParamValueProposals.contains(pathParamValue)) {
+						final ISourceRange sourceRange = annotation.getSourceRange();
+						Logger.debug("Reporting problem of type {} on ResourceMethod {}.{}",
+								JaxrsPreferences.RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE, resourceMethod
+										.getParentResource().getName(), resourceMethod.getName());
+						getMarkerManager().addProblem(
+								JaxrsValidationMessages.RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE,
+								JaxrsPreferences.RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE,
+								new String[] { pathParamValue }, sourceRange.getLength(), sourceRange.getOffset(),
+								resourceMethod.getResource());
+						resourceMethod.hasErrors(true);
+					}
+				}
+			}
+		}
+	}
+	
+	private void validatePublicModifierOnJavaMethod(final JaxrsResourceMethod resourceMethod) throws JavaModelException {
+		final IMethod javaMethod = resourceMethod.getJavaElement();
+		if(javaMethod != null && !Flags.isPublic(javaMethod.getFlags())) {
+			final ISourceRange nameRange = javaMethod.getNameRange();
+			getMarkerManager().addProblem(
+					JaxrsValidationMessages.RESOURCE_METHOD_NO_PUBLIC_MODIFIER,
+					JaxrsPreferences.RESOURCE_METHOD_NO_PUBLIC_MODIFIER,
+					new String[0], nameRange.getLength(), nameRange.getOffset(),
+					resourceMethod.getResource());
+		}
+	}
+	
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsResourceMethodValidatorDelegate.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsResourceValidatorDelegate.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsResourceValidatorDelegate.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsResourceValidatorDelegate.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,28 @@
+package org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;
+
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.common.validation.TempMarkerManager;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsResource;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsResourceMethod;
+import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsResourceMethod;
+
+public class JaxrsResourceValidatorDelegate extends AbstractJaxrsElementValidatorDelegate<JaxrsResource> {
+
+	public JaxrsResourceValidatorDelegate(TempMarkerManager markerManager, JaxrsResource element) {
+		super(markerManager, element);
+	}
+
+	@Override
+	public void validate() throws CoreException {
+		final JaxrsResource resource = getElement();
+		MarkerUtils.clearMarkers(resource.getResource());
+		for(IJaxrsResourceMethod resourceMethod : resource.getAllMethods()) {
+			new JaxrsResourceMethodValidatorDelegate(getMarkerManager(), (JaxrsResourceMethod) resourceMethod).validate();
+		}
+	}
+	
+	private void validateConstructorParameters() {
+		//TODO...
+	}
+
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsResourceValidatorDelegate.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationErrorManager.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationErrorManager.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationErrorManager.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,43 @@
+/******************************************************************************* 
+ * Copyright (c) 2009 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/ 
+package org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.common.validation.TempMarkerManager;
+import org.jboss.tools.ws.jaxrs.core.preferences.JaxrsPreferences;
+
+abstract public class JaxrsValidationErrorManager extends TempMarkerManager {
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getPreference(org.eclipse.core.resources.IProject, java.lang.String)
+	 */
+	@Override
+	protected String getPreference(IProject project, String preferenceKey) {
+		return severityPreferences.getProjectPreference(project, preferenceKey);
+	}
+
+	SeverityPreferences severityPreferences = JaxrsPreferences.getInstance();
+
+	protected void setSeverityPreferences(SeverityPreferences severityPreferences) {
+		this.severityPreferences = (severityPreferences == null) ? JaxrsPreferences.getInstance() : severityPreferences;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMaxNumberOfMarkersPerFile(org.eclipse.core.resources.IProject)
+	 */
+	@Override
+	public int getMaxNumberOfMarkersPerFile(IProject project) {
+		return JaxrsPreferences.getMaxNumberOfProblemMarkersPerFile(project);
+	}
+}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationErrorManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,44 @@
+/******************************************************************************* 
+ * Copyright (c) 2009 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class JaxrsValidationMessages {
+
+	private static final String BUNDLE_NAME = JaxrsValidationMessages.class.getName(); //$NON-NLS-1$
+
+	public static String SEARCHING_RESOURCES;
+	public static String VALIDATING_RESOURCE;
+	public static String VALIDATING_PROJECT;
+
+	public static String HTTP_METHOD_MISSING_RETENTION_ANNOTATION;
+	public static String HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE;
+	public static String HTTP_METHOD_MISSING_TARGET_ANNOTATION;
+	public static String HTTP_METHOD_INVALID_TARGET_ANNOTATION_VALUE;
+
+	public static String RESOURCE_METHOD_ILLEGAL_CONTEXT_ANNOTATION;
+	public static String RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE;
+	public static String RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER;
+	public static String RESOURCE_METHOD_MORE_THAN_ONE_UNANNOTATED_PARAMETER;
+	public static String RESOURCE_METHOD_INVALID_PATHPARAM_ANNOTATION_VALUE;
+	public static String RESOURCE_METHOD_NO_PUBLIC_MODIFIER;
+
+	public static String APPLICATION_NO_OCCURRENCE_FOUND;
+	public static String APPLICATION_TOO_MANY_OCCURRENCES;
+	
+	static {
+		NLS.initializeMessages(BUNDLE_NAME, JaxrsValidationMessages.class);
+	}
+}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.properties	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.properties	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,18 @@
+SEARCHING_RESOURCES=project "{0}"; searching resources for validation (JAX-RS Validator).
+VALIDATING_RESOURCE=project "{0}"; resource "{1}" (JAX-RS Validator)
+VALIDATING_PROJECT=project "{0}" (JAX-RS Validator)
+
+
+HTTP_METHOD_MISSING_RETENTION_ANNOTATION=The HTTP Method should have a @Retention(RetentionPolicy.RUNTIME) annotation on its type.
+HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE=The @Retention annotation value is not correct. It should be RetentionPolicy.RUNTIME
+HTTP_METHOD_MISSING_TARGET_ANNOTATION=The HTTP Method should have a @Target(ElementType.METHOD) annotation on its type.
+HTTP_METHOD_INVALID_TARGET_ANNOTATION_VALUE=The @Target annotation value is not correct. It should be ElementType.METHOD
+
+RESOURCE_METHOD_ILLEGAL_CONTEXT_ANNOTATION=@Context annotation is only allowed on method parameters of type {0}.
+RESOURCE_METHOD_MORE_THAN_ONE_UNANNOTATED_PARAMETER=At most one method parameter may be declared without any JAX-RS annotation to map the incoming request entity body.
+RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE=@PathParam value "{0}" does not match any @Path annotation template parameters of the java method and the enclosing java type.
+RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER=The @Path template parameter "{0}" is not bound to any @Path template parameter.
+RESOURCE_METHOD_INVALID_PATHPARAM_ANNOTATION_VALUE=The @PathParam annotation value "{0}" should be alphanumeric.
+RESOURCE_METHOD_NO_PUBLIC_MODIFIER=The method "{0}" should be public.
+APPLICATION_NO_OCCURRENCE_FOUND=No JAX-RS Activator is defined for the project. 
+APPLICATION_TOO_MANY_OCCURRENCES=Multiple JAX-RS Activators are defined for the project.


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/MarkerUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/MarkerUtils.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/MarkerUtils.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,31 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
+
+/**
+ * @author Xavier Coulon
+ * The class name says it all. 
+ */
+public class MarkerUtils {
+
+	public static void clearMarkers(IResource resource) throws CoreException {
+		if (resource == null) {
+			return;
+		}
+		Logger.debug("Clearing JAXRS markers for resource " + resource.getName());
+		resource.deleteMarkers(JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE, true, org.eclipse.core.resources.IResource.DEPTH_INFINITE);
+	}
+
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/MarkerUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/Annotation.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/Annotation.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/Annotation.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -95,14 +95,26 @@
 	public ISourceRange getSourceRange() {
 		return sourceRange;
 	}
-
+	
 	/** @return the value */
-	public List<String> getValues(String elementName) {
+	public List<String> getValues(final String elementName) {
 		return javaAnnotationElements.get(elementName);
 	}
 
+	/** @return the default value */
+	public String getValue() {
+		final List<String> values = javaAnnotationElements.get("value");
+		if (values != null) {
+			assert !(values.size() > 1);
+			if (values.size() == 1) {
+				return values.get(0);
+			}
+		}
+		return null;
+	}
+	
 	/** @return the value */
-	public String getValue(String elementName) {
+	public String getValue(final String elementName) {
 		final List<String> values = javaAnnotationElements.get(elementName);
 		if (values != null) {
 			assert !(values.size() > 1);

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/EnumJaxrsClassname.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/EnumJaxrsClassname.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/EnumJaxrsClassname.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -10,55 +10,62 @@
  ******************************************************************************/
 package org.jboss.tools.ws.jaxrs.core.jdt;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
 /**
  * @author Xavier Coulon
  *
  */
 public enum EnumJaxrsClassname {
 	
-	DELETE("javax.ws.rs.DELETE"),
+	DELETE("javax.ws.rs.DELETE", "DELETE"),
 	
-	GET("javax.ws.rs.GET"),
+	GET("javax.ws.rs.GET", "GET"),
 	
-	POST("javax.ws.rs.POST"),
+	POST("javax.ws.rs.POST", "POST"),
 	
-	PUT("javax.ws.rs.PUT"),
+	PUT("javax.ws.rs.PUT", "PUT"),
 	
-	HEAD("javax.ws.rs.HEAD"),
+	HEAD("javax.ws.rs.HEAD", "HEAD"),
 	
-	OPTIONS("javax.ws.rs.OPTIONS"),
+	OPTIONS("javax.ws.rs.OPTIONS", "OPTIONS"),
 	
-	HTTP_METHOD("javax.ws.rs.HttpMethod"),
+	HTTP_METHOD("javax.ws.rs.HttpMethod", "HttpMethod"),
 	
-	APPLICATION("javax.ws.rs.core.Application"), 
+	TARGET(Target.class.getName(), "Target"),
 	
-	APPLICATION_PATH("javax.ws.rs.ApplicationPath"),
+	RETENTION(Retention.class.getName(), "Retention"),
 	
+	APPLICATION("javax.ws.rs.core.Application", "Application"), 
+	
+	APPLICATION_PATH("javax.ws.rs.ApplicationPath", "ApplicationPath"),
+	
 	MESSAGE_BODY_READER("javax.ws.rs.ext.MessageBodyReader"),
 
 	MESSAGE_BODY_WRITER("javax.ws.rs.ext.MessageBodyWriter"),
 	
 	EXCEPTION_MAPPER("javax.ws.rs.ext.ExceptionMapper"),
 	
-	PATH("javax.ws.rs.Path"),
+	PATH("javax.ws.rs.Path", "Path"),
 	
-	PATH_PARAM("javax.ws.rs.PathParam"),
+	PATH_PARAM("javax.ws.rs.PathParam", "PathParam"),
 	
-	CONSUMES("javax.ws.rs.Consumes"),
+	CONSUMES("javax.ws.rs.Consumes", "Consumes"),
 	
-	PRODUCES("javax.ws.rs.Produces"),
+	PRODUCES("javax.ws.rs.Produces", "Produces"),
 	
-	DEFAULT_VALUE("javax.ws.rs.DefaultValue"),
+	DEFAULT_VALUE("javax.ws.rs.DefaultValue", "DefaultValue"),
 
-	COOKIE_PARAM("javax.ws.rs.CookieParam"),
+	COOKIE_PARAM("javax.ws.rs.CookieParam", "CookieParam"),
 
-	HEADER_PARAM("javax.ws.rs.HeaderParam"),
+	HEADER_PARAM("javax.ws.rs.HeaderParam", "HeaderParam"),
 
-	MATRIX_PARAM("javax.ws.rs.MatrixParam"),
+	MATRIX_PARAM("javax.ws.rs.MatrixParam", "MatrixParam"),
 	
-	QUERY_PARAM("javax.ws.rs.QueryParam"),
+	QUERY_PARAM("javax.ws.rs.QueryParam", "QueryParam"),
 	
-	CONTEXT("javax.ws.rs.core.Context"),
+	CONTEXT("javax.ws.rs.core.Context", "Context"),
 	
 	HTTP_HEADERS("javax.ws.rs.core.HttpHeaders"),
 
@@ -68,14 +75,22 @@
 	
 	URI_INFO("javax.ws.rs.core.UriInfo"),
 	
-	ENCODED("javax.ws.rs.Encoded"),
+	ENCODED("javax.ws.rs.Encoded", "Encoded"),
 	
-	PROVIDER("javax.ws.rs.ext.Provider");
+	PROVIDER("javax.ws.rs.ext.Provider", "Provider");
 	
 	public final String qualifiedName;
+
+	public final String annotationName;
 	
 	private EnumJaxrsClassname(final String qualifiedName) {
 		this.qualifiedName = qualifiedName;
+		this.annotationName = null;
 	}
 
+	private EnumJaxrsClassname(final String qualifiedName, final String annotationName) {
+		this.qualifiedName = qualifiedName;
+		this.annotationName = annotationName;
+	}
+
 }

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaAnnotationsVisitor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaAnnotationsVisitor.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaAnnotationsVisitor.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -28,6 +28,8 @@
 import org.eclipse.jdt.core.dom.FieldDeclaration;
 import org.eclipse.jdt.core.dom.IAnnotationBinding;
 import org.eclipse.jdt.core.dom.IMemberValuePairBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
 import org.eclipse.jdt.core.dom.MethodDeclaration;
 import org.eclipse.jdt.core.dom.TypeDeclaration;
 import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
@@ -239,10 +241,10 @@
 				final List<String> values = new ArrayList<String>();
 				if (binding.getValue() instanceof Object[]) {
 					for (Object v : (Object[]) binding.getValue()) {
-						values.add(v.toString());
+						values.add(toString(v));
 					}
 				} else {
-					values.add(binding.getValue().toString());
+					values.add(toString(binding.getValue()));
 				}
 				annotationElements.put(binding.getName(), values);
 			}
@@ -258,4 +260,25 @@
 		return annotationElements;
 	}
 
+	/**
+	 * Converts the given value into String. The actual types that are supported are:
+	 * java.lang.Class - the ITypeBinding for the class object
+	 * java.lang.String - the string value itself
+	 * enum type - the IVariableBinding for the enum constant
+	 * annotation type - an IAnnotationBinding
+	 * for other types, the <code>java.lang.Object{@link #toString()}</code> method is used.
+	 * @param value
+	 * @return litteral value
+	 */
+	private static String toString(Object value) {
+		if(value instanceof ITypeBinding) {
+			return ((ITypeBinding)value).getQualifiedName();
+		} else if(value instanceof IVariableBinding) {
+			return ((IVariableBinding)value).getName();
+		} else if(value instanceof IAnnotationBinding) {
+			return ((IAnnotationBinding)value).getName();
+		} 
+		return value.toString();
+	}
+
 }
\ No newline at end of file

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodParameter.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodParameter.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodParameter.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -13,30 +13,22 @@
 
 import java.util.List;
 
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.text.TypedRegion;
-import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.IValidable;
+import org.eclipse.jdt.core.ISourceRange;
 
-public class JavaMethodParameter implements IValidable {
+public class JavaMethodParameter {
 
 	private final String typeName;
 
 	private final List<Annotation> annotations;
 
-	private final TypedRegion region;
+	private final ISourceRange sourceRange;
 
-	public JavaMethodParameter(String name, String typeName, List<Annotation> annotations, final TypedRegion region) {
+	public JavaMethodParameter(String name, String typeName, List<Annotation> annotations, final ISourceRange sourceRange) {
 		this.typeName = typeName;
 		this.annotations = annotations;
-		this.region = region;
+		this.sourceRange = sourceRange;
 	}
 
-	@Override
-	public void validate(IProgressMonitor progressMonitor) throws CoreException {
-		// TODO Auto-generated method stub
-	}
-
 	/** @return the parameterType */
 	public String getTypeName() {
 		return this.typeName;
@@ -58,8 +50,8 @@
 	/**
 	 * @return the region
 	 */
-	public TypedRegion getRegion() {
-		return region;
+	public ISourceRange getRegion() {
+		return sourceRange;
 	}
 
 	@Override

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -30,8 +30,6 @@
 import org.eclipse.jdt.core.dom.IVariableBinding;
 import org.eclipse.jdt.core.dom.MethodDeclaration;
 import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.TypedRegion;
 import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
 
 public class JavaMethodSignaturesVisitor extends ASTVisitor {
@@ -110,9 +108,8 @@
 									annotationElements, sourceRange));
 						}
 					}
-					final TypedRegion typedRegion = new TypedRegion(parameter.getStartPosition(),
-							parameter.getLength(), IDocument.DEFAULT_CONTENT_TYPE);
-					methodParameters.add(new JavaMethodParameter(paramName, paramTypeName, paramAnnotations, typedRegion));
+					final ISourceRange sourceRange = new SourceRange(parameter.getStartPosition(), parameter.getLength());
+					methodParameters.add(new JavaMethodParameter(paramName, paramTypeName, paramAnnotations, sourceRange));
 				}
 
 				// TODO : add support for thrown exceptions

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtils.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JdtUtils.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -195,6 +195,28 @@
 		}
 		return element;
 	}
+	
+	/**
+	 * Returns the closest Java Element of the expected type that surrounds the given location in the
+	 * given compilationUnit. This method can return SimpleAnnotation, which the
+	 * default JDT ICompilationUnit implementation does not support.
+	 * 
+	 * @param sourceRange
+	 * @param location
+	 * @param type
+	 * @return
+	 * @throws JavaModelException
+	 */
+	public static IJavaElement getElementAt(ICompilationUnit compilationUnit, int location, int type) throws JavaModelException {
+		IJavaElement element = getElementAt(compilationUnit, location);
+		while (element != null && element.exists()) {
+			if (element.getElementType() == type) {
+				return element;
+			}
+			element = element.getParent();
+		}
+		return null;
+	}
 
 	/**
 	 * Parse the DOM of the given member, and resolve bindings. If the given
@@ -592,4 +614,6 @@
 
 	}
 
+	
+
 }

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsHttpMethod.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsHttpMethod.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsHttpMethod.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -11,7 +11,6 @@
 package org.jboss.tools.ws.jaxrs.core.metamodel;
 
 import org.eclipse.jdt.core.IType;
-import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
 
 public interface IJaxrsHttpMethod extends IJaxrsElement, Comparable<IJaxrsHttpMethod> {
 
@@ -21,8 +20,6 @@
 	/** @return the name */
 	String getFullyQualifiedName();
 
-	Annotation getHttpMethodAnnotation();
-
 	IType getJavaElement();
 
 }
\ No newline at end of file

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsMetamodel.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsMetamodel.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IJaxrsMetamodel.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -17,7 +17,6 @@
 
 public interface IJaxrsMetamodel {
 
-	/** @return the JAX-RS Ednpoints */
 	public abstract List<IJaxrsEndpoint> getAllEndpoints();
 
 	public abstract <T> T getElement(IJavaElement invocationElement, Class<T> clazz);

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IMarkerResolutionDelegate.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IMarkerResolutionDelegate.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IMarkerResolutionDelegate.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,26 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.jaxrs.core.metamodel;
+
+import org.eclipse.core.runtime.CoreException;
+
+
+/**
+ * @author Xavier Coulon
+ *
+ */
+public interface IMarkerResolutionDelegate {
+	
+	public static final String MARKER_RESOLUTION = "MARKER_RESOLUTION";
+
+	public abstract void applyQuickFix() throws CoreException;
+
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/IMarkerResolutionDelegate.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/quickfix/JaxrsValidationQuickFixes.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/quickfix/JaxrsValidationQuickFixes.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/quickfix/JaxrsValidationQuickFixes.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,10 @@
+package org.jboss.tools.ws.jaxrs.core.metamodel.quickfix;
+
+public class JaxrsValidationQuickFixes {
+
+	public static final int HTTP_METHOD_MISSING_RETENTION_ANNOTATION_ID = 1;
+	public static final int HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE_ID = 2;
+	public static final int HTTP_METHOD_MISSING_TARGET_ANNOTATION_ID = 3;
+	public static final int HTTP_METHOD_INVALID_TARGET_ANNOTATION_VALUE_ID = 4;
+
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/metamodel/quickfix/JaxrsValidationQuickFixes.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/JaxrsPreferenceInitializer.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/JaxrsPreferenceInitializer.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/JaxrsPreferenceInitializer.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,54 @@
+/******************************************************************************* 
+ * Copyright (c) 2009 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/ 
+package org.jboss.tools.ws.jaxrs.core.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.ws.jaxrs.core.JBossJaxrsCorePlugin;
+
+/**
+ * @author Alexey Kazakov
+ * @author Xavier Coulon
+ */
+public class JaxrsPreferenceInitializer extends AbstractPreferenceInitializer {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+	 */
+	@Override
+	public void initializeDefaultPreferences() {
+		IEclipsePreferences defaultPreferences = ((IScopeContext)DefaultScope.INSTANCE).getNode(JBossJaxrsCorePlugin.PLUGIN_ID);
+		defaultPreferences.putBoolean(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
+		defaultPreferences.put(SeverityPreferences.WRONG_BUILDER_ORDER_PREFERENCE_NAME, JaxrsPreferences.ERROR);
+		for (String name : JaxrsPreferences.SEVERITY_OPTION_NAMES) {
+			defaultPreferences.put(name, SeverityPreferences.ERROR);
+		}
+		defaultPreferences.put(JaxrsPreferences.APPLICATION_NO_OCCURRENCE_FOUND, JaxrsPreferences.WARNING);
+		defaultPreferences.put(JaxrsPreferences.APPLICATION_TOO_MANY_OCCURRENCES, JaxrsPreferences.WARNING);
+
+		defaultPreferences.put(JaxrsPreferences.HTTP_METHOD_MISSING_TARGET_ANNOTATION, JaxrsPreferences.ERROR);
+		defaultPreferences.put(JaxrsPreferences.HTTP_METHOD_INVALID_TARGET_ANNOTATION_VALUE, JaxrsPreferences.ERROR);
+		defaultPreferences.put(JaxrsPreferences.HTTP_METHOD_MISSING_RETENTION_ANNOTATION, JaxrsPreferences.ERROR);
+		defaultPreferences.put(JaxrsPreferences.HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE, JaxrsPreferences.ERROR);
+		
+		defaultPreferences.put(JaxrsPreferences.RESOURCE_METHOD_ILLEGAL_CONTEXT_ANNOTATION, JaxrsPreferences.ERROR);
+		defaultPreferences.put(JaxrsPreferences.RESOURCE_METHOD_INVALID_PATHPARAM_ANNOTATION_VALUE, JaxrsPreferences.ERROR);
+		defaultPreferences.put(JaxrsPreferences.RESOURCE_METHOD_MORE_THAN_ONE_UNANNOTATED_PARAMETER, JaxrsPreferences.ERROR);
+		defaultPreferences.put(JaxrsPreferences.RESOURCE_METHOD_NO_PUBLIC_MODIFIER, JaxrsPreferences.WARNING);
+		defaultPreferences.put(JaxrsPreferences.RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER, JaxrsPreferences.ERROR);
+		defaultPreferences.put(JaxrsPreferences.RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE, JaxrsPreferences.ERROR);
+
+		defaultPreferences.putInt(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, SeverityPreferences.DEFAULT_MAX_NUMBER_OF_MARKERS_PER_FILE);
+	}
+}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/JaxrsPreferenceInitializer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/JaxrsPreferences.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/JaxrsPreferences.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/JaxrsPreferences.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,127 @@
+/******************************************************************************* 
+ * Copyright (c) 2009 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.jaxrs.core.preferences;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.validation.ValidationSeverityPreferences;
+import org.jboss.tools.ws.jaxrs.core.JBossJaxrsCorePlugin;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class JaxrsPreferences extends ValidationSeverityPreferences {
+
+	public static final Set<String> SEVERITY_OPTION_NAMES = new HashSet<String>();
+
+	private static JaxrsPreferences INSTANCE = new JaxrsPreferences();
+
+	public static final String WARNING_GROUP_ID = "jaxrs";
+
+	// HTTP Method group
+	public static final String HTTP_METHOD_MISSING_RETENTION_ANNOTATION = INSTANCE
+			.createSeverityOption("httpMethodMissingRetentionAnnotation"); //$NON-NLS-1$
+	
+	public static final String HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE = INSTANCE
+			.createSeverityOption("httpMethodInvalidRetentionAnnotationValue"); //$NON-NLS-1$
+	
+	public static final String HTTP_METHOD_MISSING_TARGET_ANNOTATION = INSTANCE
+			.createSeverityOption("httpMethodMissingTargetAnnotation"); //$NON-NLS-1$
+	
+	public static final String HTTP_METHOD_INVALID_TARGET_ANNOTATION_VALUE = INSTANCE
+			.createSeverityOption("httpMethodInvalidTargetAnnotationValue"); //$NON-NLS-1$
+
+	// Resource Method group
+	public static final String RESOURCE_METHOD_ILLEGAL_CONTEXT_ANNOTATION = INSTANCE
+			.createSeverityOption("resourceMethodIllegalContextAnnotation"); //$NON-NLS-1$
+
+	public static final String RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE = INSTANCE
+			.createSeverityOption("resourceMethodUnboundPathParameterAnnotationValue"); //$NON-NLS-1$
+
+	public static final String RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER = INSTANCE
+			.createSeverityOption("resourceMethodUnboundPathAnnotationTemplateParameter"); //$NON-NLS-1$
+
+	public static final String RESOURCE_METHOD_MORE_THAN_ONE_UNANNOTATED_PARAMETER = INSTANCE
+			.createSeverityOption("resourceMethodMoreThanOneUnannotatedParameter"); //$NON-NLS-1$
+
+	public static final String RESOURCE_METHOD_INVALID_PATHPARAM_ANNOTATION_VALUE = INSTANCE
+			.createSeverityOption("resourceMethodInvalidPathParamAnnotationValue"); //$NON-NLS-1$
+
+	public static final String RESOURCE_METHOD_NO_PUBLIC_MODIFIER = INSTANCE
+			.createSeverityOption("resourceMethodNoPublicModifier"); //$NON-NLS-1$
+
+	public static final String APPLICATION_NO_OCCURRENCE_FOUND = INSTANCE
+			.createSeverityOption("applicationNoOccurrenceFound"); //$NON-NLS-1$
+
+	public static final String APPLICATION_TOO_MANY_OCCURRENCES = INSTANCE
+			.createSeverityOption("applicationTooManyOccurrencesFound"); //$NON-NLS-1$
+	/**
+	 * @return the only instance of {@link JaxrsPreferences}
+	 */
+	public static JaxrsPreferences getInstance() {
+		return INSTANCE;
+	}
+
+	private JaxrsPreferences() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.common.validation.ValidationSeverityPreferences#getWarningGroupID()
+	 */
+	@Override
+	public String getWarningGroupID() {
+		return WARNING_GROUP_ID;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.common.preferences.SeverityPreferences#createSeverityOption(java.lang.String)
+	 */
+	@Override
+	protected String createSeverityOption(String shortName) {
+		String name = getPluginId() + ".validator.problem." + shortName; //$NON-NLS-1$
+		SEVERITY_OPTION_NAMES.add(name);
+		return name;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.common.preferences.SeverityPreferences#getPluginId()
+	 */
+	@Override
+	protected String getPluginId() {
+		return JBossJaxrsCorePlugin.PLUGIN_ID;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.common.preferences.SeverityPreferences#getSeverityOptionNames()
+	 */
+	@Override
+	protected Set<String> getSeverityOptionNames() {
+		return SEVERITY_OPTION_NAMES;
+	}
+
+	public static boolean shouldValidateCore(IProject project) {
+		return true;
+	}
+
+	public static boolean isValidationEnabled(IProject project) {
+		return INSTANCE.isEnabled(project);
+	}
+
+	public static int getMaxNumberOfProblemMarkersPerFile(IProject project) {
+		return INSTANCE.getMaxNumberOfProblemMarkersPerResource(project);
+	}
+}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/JaxrsPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/package-info.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/package-info.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/package-info.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,15 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+/**
+ * @author Xavier Coulon
+ *
+ */
+package org.jboss.tools.ws.jaxrs.core.preferences;
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/preferences/package-info.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/META-INF/MANIFEST.MF	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/META-INF/MANIFEST.MF	2012-08-24 16:20:04 UTC (rev 43224)
@@ -36,7 +36,10 @@
  org.eclipse.wst.validation;bundle-version="1.2.300",
  org.eclipse.wst.server.core;bundle-version="1.1.303",
  org.eclipse.debug.core;bundle-version="3.7.0",
- org.eclipse.debug.ui;bundle-version="3.7.101"
+ org.eclipse.debug.ui;bundle-version="3.7.101",
+ org.jboss.tools.common;bundle-version="3.4.0",
+ org.jboss.tools.common.ui;bundle-version="3.4.0",
+ org.jboss.tools.common.validation;bundle-version="3.4.0"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ClassPath: .

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/plugin.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/plugin.properties	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/plugin.properties	2012-08-24 16:20:04 UTC (rev 43224)
@@ -1,3 +1,9 @@
 PLUGIN_NAME=JBoss JAX-RS Tooling (UI)
 PLUGIN_PROVIDER=JBoss by Red Hat
 navigatorContentName=JAX-RS REST Web Services
+
+
+PreferencePage_JaxrsSettings=JAX-RS Validator
+PreferencePage_Validator=JAX-RS Validator
+PreferencePage=JAX-RS
+

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/plugin.xml
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/plugin.xml	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/plugin.xml	2012-08-24 16:20:04 UTC (rev 43224)
@@ -354,4 +354,51 @@
          </adapter>
       </factory>
    </extension>
+   <extension point="org.eclipse.ui.ide.markerResolution">
+      <markerResolutionGenerator
+         markerType="org.jboss.tools.ws.jaxrs.metamodelMarker"
+         class="org.jboss.tools.ws.jaxrs.ui.quickfix.JaxrsMarkerResolutionGenerator"/>
+   </extension>
+   
+   <extension
+         point="org.eclipse.ui.propertyPages">
+       <page
+            name="%PreferencePage_JaxrsSettings"
+            class="org.jboss.tools.ws.jaxrs.ui.preferences.JaxrsSettingsPreferencePage"
+            id="org.jboss.tools.ws.jaxrs.ui.propertyPages.JaxrsSettingsPreferencePage">
+         <enabledWhen>
+		     	<adapt type="org.eclipse.core.resources.IProject">
+		     		<test property="org.eclipse.core.resources.projectNature" value="org.eclipse.jdt.core.javanature"/>
+				</adapt>
+         </enabledWhen>
+      </page>
+       <page
+            name="%PreferencePage_Validator"
+            class="org.jboss.tools.ws.jaxrs.ui.preferences.JaxrsValidatorPreferencePage"
+            id="org.jboss.tools.ws.jaxrs.ui.propertyPages.JaxrsValidatorPreferencePage"
+            category="org.jboss.tools.ws.jaxrs.ui.propertyPages.JaxrsSettingsPreferencePage">
+         <enabledWhen>
+		     	<adapt type="org.eclipse.core.resources.IProject">
+		     		<test property="org.eclipse.core.resources.projectNature" value="org.jboss.tools.ws.jaxrs.nature"/>
+				</adapt>
+         </enabledWhen>
+      </page>
+   </extension>
+   
+    <extension point="org.eclipse.ui.preferencePages">
+      <page 
+         category="org.jboss.tools.ws.jaxrs.ui" 
+         class="org.jboss.tools.ws.jaxrs.ui.preferences.JaxrsValidatorPreferencePage" 
+         id="org.jboss.tools.ws.jaxrs.ui.JAXRSValidatorPreferencePage" 
+         name="%PreferencePage_Validator">
+      </page>
+      <page
+            category="org.jboss.tools.common.model.ui.MainPreferencePage"
+            class="org.jboss.tools.ws.jaxrs.ui.preferences.JaxrsPreferencePage"
+            id="org.jboss.tools.ws.jaxrs.ui"
+            name="%PreferencePage">
+      </page>
+   </extension>
+   
+   
 </plugin>

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateElementAdapterFactory.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateElementAdapterFactory.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateElementAdapterFactory.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -6,6 +6,7 @@
 public class UriPathTemplateElementAdapterFactory implements IAdapterFactory {
 
 	@Override
+	@SuppressWarnings("rawtypes") 
 	public Object getAdapter(Object adaptableObject, Class adapterType) {
 		if( adapterType.equals(ILaunchable.class)) {
 			if( adaptableObject instanceof UriPathTemplateElement ) {
@@ -15,6 +16,7 @@
 		return null;
 	}
 
+	@SuppressWarnings("rawtypes")
 	@Override
 	public Class[] getAdapterList() {
 		return new Class[]{ILaunchable.class};

Deleted: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/JaxrsMarkerResolutionGenerator.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/JaxrsMarkerResolutionGenerator.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/JaxrsMarkerResolutionGenerator.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -1,21 +0,0 @@
-package org.jboss.tools.ws.jaxrs.ui.contentassist;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.IMarkerResolutionGenerator2;
-
-public class JaxrsMarkerResolutionGenerator implements IMarkerResolutionGenerator2 {
-
-	@Override
-	public IMarkerResolution[] getResolutions(IMarker marker) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public boolean hasResolutions(IMarker marker) {
-		
-		return false;
-	}
-
-}

Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/facet/JaxrsFacetedProjectListener.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/facet/JaxrsFacetedProjectListener.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/facet/JaxrsFacetedProjectListener.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -57,6 +57,8 @@
 							ProjectNatureUtils.uninstallProjectNature(project, ProjectNatureUtils.JAXRS_NATURE_ID);
 						}
 						break;
+					default:
+						break;
 					}
 				} catch (CoreException ex) {
 					Logger.error("Failed to add or remove JAX-RS 1.1 support Nature", ex);

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/IConfigurationBlockDescriptionProvider.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/IConfigurationBlockDescriptionProvider.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/IConfigurationBlockDescriptionProvider.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,22 @@
+/******************************************************************************* 
+ * Copyright (c) 2011 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/ 
+package org.jboss.tools.ws.jaxrs.ui.preferences;
+
+import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock.SectionDescription;
+
+/**
+ * 
+ * @author Viacheslav Kabanovich
+ *
+ */
+public interface IConfigurationBlockDescriptionProvider {
+	public SectionDescription[] getSections();
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/IConfigurationBlockDescriptionProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencePage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencePage.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencePage.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,42 @@
+/******************************************************************************* 
+ * Copyright (c) 2009 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/ 
+package org.jboss.tools.ws.jaxrs.ui.preferences;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * @author Xavier Coulon
+ */
+public class JaxrsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+	
+	/**
+	 * @see plugin.xml descriptor for ID
+	 */
+	public static final String ID = "org.jboss.tools.ws.jaxrs.ui";
+
+	@Override
+	protected Control createContents(Composite parent) {
+		Composite root = new Composite(parent, SWT.NONE);
+		GridLayout gl = new GridLayout(1, false);
+		root.setLayout(gl);
+
+		return root;
+	}
+
+	public void init(IWorkbench workbench) {
+	}
+}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencePage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencesMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencesMessages.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencesMessages.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ *     Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.jaxrs.ui.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Alexey Kazakov
+ * @author Xavier Coulon
+ */
+public class JaxrsPreferencesMessages extends NLS {
+	private static final String BUNDLE_NAME = "org.jboss.tools.ws.jaxrs.ui.preferences.JaxrsPreferencesMessages"; //$NON-NLS-1$
+
+	public static String JAXRS_SETTINGS_PREFERENCE_PAGE_JAXRS_SUPPORT;
+
+	// Validator Preference page
+	public static String JaxrsValidatorConfigurationBlock_common_description;
+	
+	public static String JaxrsValidatorConfigurationBlock_needsbuild_title;
+	public static String JaxrsValidatorConfigurationBlock_needsfullbuild_message;
+	public static String JaxrsValidatorConfigurationBlock_needsprojectbuild_message;
+
+	// Section Application/Activators
+	public static String JaxrsValidatorConfigurationBlock_section_applications ;
+	public static String JaxrsValidatorConfigurationBlock_pb_applicationNoOccurrenceFound_label;
+	public static String JaxrsValidatorConfigurationBlock_pb_applicationTooManyOccurrencesFound_label;
+
+	// Section HTTP Method
+	public static String JaxrsValidatorConfigurationBlock_section_httpMethods;
+	public static String JaxrsValidatorConfigurationBlock_pb_httpMethodMissingRetentionAnnotation_label;
+	public static String JaxrsValidatorConfigurationBlock_pb_httpMethodInvalidRetentionAnnotationValue_label;
+	public static String JaxrsValidatorConfigurationBlock_pb_httpMethodMissingTargetAnnotation_label;
+	public static String JaxrsValidatorConfigurationBlock_pb_httpMethodInvalidTargetAnnotationValue_label;
+	
+	// Section Resource 
+	
+	// Section Resource Methods
+ 	public static String JaxrsValidatorConfigurationBlock_section_resourceMethods; 
+	public static String JaxrsValidatorConfigurationBlock_pb_resourceMethodIllegalContextAnnotation_label;
+	public static String JaxrsValidatorConfigurationBlock_pb_resourceMethodUnboundPathParameterAnnotationValue_label;
+	public static String JaxrsValidatorConfigurationBlock_pb_resourceMethodUnboundPathAnnotationTemplateParameter_label;
+	public static String JaxrsValidatorConfigurationBlock_pb_resourceMethodMoreThanOneUnannotatedParameter_label;
+	public static String JaxrsValidatorConfigurationBlock_pb_resourceMethodInvalidPathParamAnnotationValue_label;
+	public static String JaxrsValidatorConfigurationBlock_pb_resourceMethodNoPublicModifier_label;
+
+	// Section Resource Fields
+
+	public static String JAXRS_VALIDATOR_PREFERENCE_PAGE_JAXRS_VALIDATOR;
+
+	static {
+		NLS.initializeMessages(BUNDLE_NAME, JaxrsPreferencesMessages.class);
+	}
+}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencesMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencesMessages.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencesMessages.properties	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencesMessages.properties	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,43 @@
+##################################################################################
+### Copyright (c) 2009 Red Hat, Inc.
+### Distributed under license by Red Hat, Inc. All rights reserved.
+### This program is 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:
+###     Red Hat, Inc. - initial API and implementation
+##################################################################################
+
+JAXRS_SETTINGS_PREFERENCE_PAGE_JAXRS_SUPPORT=JAX-RS support\:
+
+JaxrsValidatorConfigurationBlock_common_description=Select the severity level for the following optional JAX-RS Validator problems:
+
+JaxrsValidatorConfigurationBlock_needsbuild_title=JAX-RS Validator Settings Changed
+JaxrsValidatorConfigurationBlock_needsfullbuild_message=The JAX-RS Validator settings have changed. A full rebuild is required for changes to take effect. Do the full build now?
+JaxrsValidatorConfigurationBlock_needsprojectbuild_message=The JAX-RS Validator settings have changed. A rebuild of the project is required for changes to take effect. Build the project now?
+
+#Section Applications/JAX-RS Activators
+JaxrsValidatorConfigurationBlock_section_applications=JAX-RS Activators
+JaxrsValidatorConfigurationBlock_pb_applicationNoOccurrenceFound_label=No JAX-RS Activator configured
+JaxrsValidatorConfigurationBlock_pb_applicationTooManyOccurrencesFound_label=Multiple JAX-RS Activators configured
+
+#Section HTTP Methods
+JaxrsValidatorConfigurationBlock_section_httpMethods=User-defined HTTP Methods
+JaxrsValidatorConfigurationBlock_pb_httpMethodMissingRetentionAnnotation_label=Missing @Retention annotation:
+JaxrsValidatorConfigurationBlock_pb_httpMethodInvalidRetentionAnnotationValue_label=Invalid @Retention annotation value:
+JaxrsValidatorConfigurationBlock_pb_httpMethodMissingTargetAnnotation_label=Missing @Target annotation:
+JaxrsValidatorConfigurationBlock_pb_httpMethodInvalidTargetAnnotationValue_label=Invalid @Target annotation:
+
+#Section Resource Methods
+JaxrsValidatorConfigurationBlock_section_resourceMethods=JAX-RS Resource Methods
+JaxrsValidatorConfigurationBlock_pb_resourceMethodIllegalContextAnnotation_label=Illegal @Context annotation
+JaxrsValidatorConfigurationBlock_pb_resourceMethodUnboundPathParameterAnnotationValue_label=Unbound @PathParam annotation value
+JaxrsValidatorConfigurationBlock_pb_resourceMethodUnboundPathAnnotationTemplateParameter_label=Unbound @Path template parameter
+JaxrsValidatorConfigurationBlock_pb_resourceMethodMoreThanOneUnannotatedParameter_label=Too many entity parameters
+JaxrsValidatorConfigurationBlock_pb_resourceMethodInvalidPathParamAnnotationValue_label=Invalid @PathParam annotation value
+JaxrsValidatorConfigurationBlock_pb_resourceMethodNoPublicModifier_label=Missing 'public' method modifier
+
+
+
+JAXRS_VALIDATOR_PREFERENCE_PAGE_JAXRS_VALIDATOR=JAX-RS Validator


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsPreferencesMessages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsSettingsPreferencePage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsSettingsPreferencePage.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsSettingsPreferencePage.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,166 @@
+/******************************************************************************* 
+ * Copyright (c) 2009 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.jaxrs.ui.preferences;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.jboss.tools.common.ui.preferences.SettingsPage;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
+import org.jboss.tools.ws.jaxrs.core.configuration.ProjectNatureUtils;
+import org.jboss.tools.ws.jaxrs.ui.internal.utils.Logger;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class JaxrsSettingsPreferencePage extends SettingsPage {
+
+	public static final String ID = "org.jboss.tools.ws.jaxrs.ui.propertyPages.JaxrsSettingsPreferencePage";
+
+	private IProject project;
+	private boolean jaxrsEnabled;
+	private boolean initialState;
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.dialogs.PropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
+	 */
+	@Override
+	public void setElement(IAdaptable element) {
+		super.setElement(element);
+		project = (IProject) getElement().getAdapter(IProject.class);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createContents(Composite parent) {
+		Composite root = new Composite(parent, SWT.NONE);
+		try {
+
+		GridData gd = new GridData();
+
+		gd.horizontalSpan = 1;
+		gd.horizontalAlignment = GridData.FILL;
+		gd.grabExcessHorizontalSpace = true;
+		gd.grabExcessVerticalSpace = false;
+
+		GridLayout gridLayout = new GridLayout(1, false);
+		root.setLayout(gridLayout);
+
+		Composite generalGroup = new Composite(root, SWT.NONE);
+		generalGroup.setLayoutData(gd);
+		gridLayout = new GridLayout(4, false);
+
+		generalGroup.setLayout(gridLayout);
+
+			initialState = isJaxrsEnabled(project);
+		IFieldEditor jaxrsSupportCheckBox = IFieldEditorFactory.INSTANCE.createCheckboxEditor(
+				JaxrsPreferencesMessages.JAXRS_SETTINGS_PREFERENCE_PAGE_JAXRS_SUPPORT,
+				JaxrsPreferencesMessages.JAXRS_SETTINGS_PREFERENCE_PAGE_JAXRS_SUPPORT, initialState);
+		jaxrsSupportCheckBox.addPropertyChangeListener(new PropertyChangeListener() {
+			public void propertyChange(PropertyChangeEvent evt) {
+				Object value = evt.getNewValue();
+				if (value instanceof Boolean) {
+					boolean v = ((Boolean) value).booleanValue();
+					setEnabledJaxrsSuport(v);
+				}
+			}
+		});
+		jaxrsEnabled = isJaxrsEnabled(project);
+		registerEditor(jaxrsSupportCheckBox, generalGroup);
+
+		validate();
+
+		} catch (CoreException e) {
+			Logger.error("Failed to display JAX-RS settings page", e);
+		}
+		return root;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+	 */
+	@Override
+	protected void performDefaults() {
+		try {
+			getEditor(JaxrsPreferencesMessages.JAXRS_SETTINGS_PREFERENCE_PAGE_JAXRS_SUPPORT).setValue(
+					isJaxrsEnabled(project));
+			validate();
+		} catch (CoreException e) {
+			Logger.error("Failed to restore defaults on JAX-RS settings page", e);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
+	 */
+	@Override
+	public boolean performOk() {
+		try {
+			if (isJaxrsEnabled() != initialState) {
+				if (isJaxrsEnabled()) {
+					addJaxrsSupport(project);
+				} else {
+					removeJaxrsSupport(project);
+				}
+			}
+		} catch (CoreException e) {
+			Logger.error("Failed to apply changes on JAX-RS settings page", e);
+		}
+		return true;
+	}
+
+	private void addJaxrsSupport(IProject project) throws CoreException {
+		if (project == null) {
+			return;
+		}
+		ProjectNatureUtils.installProjectNature(project, ProjectNatureUtils.JAXRS_NATURE_ID);
+	}
+
+	private void removeJaxrsSupport(IProject project) throws CoreException {
+		ProjectNatureUtils.uninstallProjectNature(project, ProjectNatureUtils.JAXRS_NATURE_ID);
+	}
+
+	private boolean isJaxrsEnabled(IProject project) throws CoreException {
+		return ProjectNatureUtils.isProjectNatureInstalled(project, ProjectNatureUtils.JAXRS_NATURE_ID);
+	}
+
+	private boolean isJaxrsEnabled() {
+		return jaxrsEnabled;
+	}
+
+	public void setEnabledJaxrsSuport(boolean enabled) {
+		jaxrsEnabled = enabled;
+		editorRegistry.get(JaxrsPreferencesMessages.JAXRS_SETTINGS_PREFERENCE_PAGE_JAXRS_SUPPORT).setValue(enabled);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.common.ui.preferences.SettingsPage#validate()
+	 */
+	@Override
+	protected void validate() {
+	}
+}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsSettingsPreferencePage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorConfigurationBlock.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorConfigurationBlock.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorConfigurationBlock.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,80 @@
+/******************************************************************************* 
+ * Copyright (c) 2009 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/ 
+package org.jboss.tools.ws.jaxrs.ui.preferences;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock;
+import org.jboss.tools.ws.jaxrs.core.JBossJaxrsCorePlugin;
+
+/**
+ * @author Alexey Kazakov
+ * @author Xavier Coulon
+ */
+ at SuppressWarnings("restriction")
+public class JaxrsValidatorConfigurationBlock extends SeverityConfigurationBlock {
+
+	private static final String SETTINGS_SECTION_NAME = "JaxrsValidatorConfigurationBlock";
+
+	private static Key[] getKeys() {
+		ArrayList<Key> keys = new ArrayList<Key>();
+		for (SectionDescription s: JaxrsValidatorConfigurationBlockDescriptionProvider.getInstance().getSections()) {
+			s.collectKeys(keys);
+		}
+		keys.add(MAX_NUMBER_OF_PROBLEMS_KEY);
+		keys.add(WRONG_BUILDER_ORDER_KEY);
+		return keys.toArray(new Key[0]);
+	}
+
+	private static final Key MAX_NUMBER_OF_PROBLEMS_KEY = getKey(JBossJaxrsCorePlugin.PLUGIN_ID, SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME);
+
+	@Override
+	protected Key getMaxNumberOfProblemsKey() {
+		return MAX_NUMBER_OF_PROBLEMS_KEY;
+	}
+
+	private static final Key WRONG_BUILDER_ORDER_KEY = getKey(JBossJaxrsCorePlugin.PLUGIN_ID, SeverityPreferences.WRONG_BUILDER_ORDER_PREFERENCE_NAME);
+
+	protected Key getWrongBuilderOrderKey() {
+		return WRONG_BUILDER_ORDER_KEY;
+	}
+
+	@SuppressWarnings("restriction")
+	public JaxrsValidatorConfigurationBlock(IStatusChangeListener context,
+			IProject project, IWorkbenchPreferenceContainer container) {
+		super(context, project, getKeys(), container);
+	}
+
+	@Override
+	protected SectionDescription[] getAllSections() {
+		return JaxrsValidatorConfigurationBlockDescriptionProvider.getInstance().getSections();
+	}
+
+	@Override
+	protected String getCommonDescription() {
+		return JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_common_description;
+	}
+
+	@Override
+	protected IDialogSettings getDialogSettings() {
+		return JBossJaxrsCorePlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
+	}
+
+	@Override
+	protected String getQualifier() {
+		return JBossJaxrsCorePlugin.PLUGIN_ID;
+	}
+}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorConfigurationBlock.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorConfigurationBlockDescriptionProvider.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorConfigurationBlockDescriptionProvider.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorConfigurationBlockDescriptionProvider.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,79 @@
+/******************************************************************************* 
+ * Copyright (c) 2011 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/ 
+package org.jboss.tools.ws.jaxrs.ui.preferences;
+
+import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock.SectionDescription;
+import org.jboss.tools.ws.jaxrs.core.JBossJaxrsCorePlugin;
+import org.jboss.tools.ws.jaxrs.core.preferences.JaxrsPreferences;
+
+/**
+ * 
+ * @author Alexey Kazakov & Viacheslav Kabanovich
+ *
+ */
+public class JaxrsValidatorConfigurationBlockDescriptionProvider {
+
+	private static JaxrsValidatorConfigurationBlockDescriptionProvider INSTANCE = null;
+
+	private JaxrsValidatorConfigurationBlockDescriptionProvider() {
+	}
+
+	public static JaxrsValidatorConfigurationBlockDescriptionProvider getInstance() {
+		if(INSTANCE == null) {
+			JaxrsValidatorConfigurationBlockDescriptionProvider q = new JaxrsValidatorConfigurationBlockDescriptionProvider();
+			INSTANCE = q;
+		}
+		return INSTANCE;
+	}
+
+	private SectionDescription SECTION_ACTIVATORS = new SectionDescription(
+		JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_section_httpMethods,
+		new String[][]{
+			{JaxrsPreferences.APPLICATION_NO_OCCURRENCE_FOUND, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_applicationNoOccurrenceFound_label},
+			{JaxrsPreferences.APPLICATION_TOO_MANY_OCCURRENCES, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_applicationTooManyOccurrencesFound_label}
+		},
+		JBossJaxrsCorePlugin.PLUGIN_ID
+	);
+	private SectionDescription SECTION_HTTP_METHODS = new SectionDescription(
+			JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_section_httpMethods,
+			new String[][]{
+					{JaxrsPreferences.HTTP_METHOD_MISSING_RETENTION_ANNOTATION, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_httpMethodMissingRetentionAnnotation_label},
+					{JaxrsPreferences.HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_httpMethodInvalidRetentionAnnotationValue_label},
+					{JaxrsPreferences.HTTP_METHOD_MISSING_RETENTION_ANNOTATION, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_httpMethodMissingTargetAnnotation_label},
+					{JaxrsPreferences.HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_httpMethodInvalidTargetAnnotationValue_label},
+			},
+			JBossJaxrsCorePlugin.PLUGIN_ID
+			);
+	private SectionDescription SECTION_RESOURCE_METHODS = new SectionDescription(
+			JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_section_resourceMethods,
+			new String[][]{
+					{JaxrsPreferences.RESOURCE_METHOD_NO_PUBLIC_MODIFIER, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_resourceMethodNoPublicModifier_label},
+					{JaxrsPreferences.RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_resourceMethodUnboundPathAnnotationTemplateParameter_label},
+					{JaxrsPreferences.RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_resourceMethodUnboundPathParameterAnnotationValue_label},
+					{JaxrsPreferences.RESOURCE_METHOD_INVALID_PATHPARAM_ANNOTATION_VALUE, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_resourceMethodInvalidPathParamAnnotationValue_label},
+					{JaxrsPreferences.RESOURCE_METHOD_MORE_THAN_ONE_UNANNOTATED_PARAMETER, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_resourceMethodMoreThanOneUnannotatedParameter_label},
+					{JaxrsPreferences.RESOURCE_METHOD_ILLEGAL_CONTEXT_ANNOTATION, JaxrsPreferencesMessages.JaxrsValidatorConfigurationBlock_pb_resourceMethodIllegalContextAnnotation_label}
+			},
+			JBossJaxrsCorePlugin.PLUGIN_ID
+			);
+
+	private SectionDescription[] ALL_SECTIONS = new SectionDescription[]{
+			SECTION_ACTIVATORS,
+			SECTION_HTTP_METHODS,
+			SECTION_RESOURCE_METHODS
+	};
+
+	public SectionDescription[] getSections() {
+		return ALL_SECTIONS;
+	}
+
+
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorConfigurationBlockDescriptionProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorPreferencePage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorPreferencePage.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorPreferencePage.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,63 @@
+/******************************************************************************* 
+ * Copyright (c) 2009 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/ 
+package org.jboss.tools.ws.jaxrs.ui.preferences;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock.SectionDescription;
+import org.jboss.tools.common.ui.preferences.SeverityPreferencePage;
+import org.jboss.tools.ws.jaxrs.core.JBossJaxrsCorePlugin;
+
+/**
+ * @author Xavier Coulon
+ */
+public class JaxrsValidatorPreferencePage extends SeverityPreferencePage {
+
+	/** The JAX-RS Validation preference page ID (at the workspace level). */
+	public static final String PREF_ID = "org.jboss.tools.ws.jaxrs.ui.JAXRSValidatorPreferencePage"; //$NON-NLS-1$
+	/** The JAX-RS Validation property page ID (at the project level). */
+	public static final String PROP_ID = "org.jboss.tools.ws.jaxrs.ui.propertyPages.JaxrsValidatorPreferencePage"; //$NON-NLS-1$
+
+	public JaxrsValidatorPreferencePage() {
+		setPreferenceStore(JBossJaxrsCorePlugin.getDefault().getPreferenceStore());
+		setTitle(JaxrsPreferencesMessages.JAXRS_VALIDATOR_PREFERENCE_PAGE_JAXRS_VALIDATOR);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageID()
+	 */
+	@Override
+	protected String getPreferencePageID() {
+		return PREF_ID;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPropertyPageID()
+	 */
+	@Override
+	protected String getPropertyPageID() {
+		return PROP_ID;
+	}
+
+	@SuppressWarnings("restriction")
+	@Override
+	public void createControl(Composite parent) {
+		IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer();
+		fConfigurationBlock = new JaxrsValidatorConfigurationBlock(getNewStatusChangedListener(), getProject(), container);
+
+		super.createControl(parent);
+	}
+	
+	@Override
+	protected SectionDescription[] getAllSections() {
+		return JaxrsValidatorConfigurationBlockDescriptionProvider.getInstance().getSections();
+	}
+}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/JaxrsValidatorPreferencePage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/package-info.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/package-info.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/package-info.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,15 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+/**
+ * @author Xavier Coulon
+ *
+ */
+package org.jboss.tools.ws.jaxrs.ui.preferences;
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/preferences/package-info.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/AddTargetAnnotationMarkerResolution.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/AddTargetAnnotationMarkerResolution.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/AddTargetAnnotationMarkerResolution.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,65 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.ws.jaxrs.ui.quickfix;
+
+
+import java.lang.annotation.ElementType;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.jboss.tools.common.refactoring.BaseMarkerResolution;
+import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
+import org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname;
+import org.jboss.tools.ws.jaxrs.ui.internal.utils.Logger;
+
+/**
+ * @author Xavier Coulon
+ *
+ */
+public class AddTargetAnnotationMarkerResolution extends BaseMarkerResolution  {
+	
+	private final IType type;
+
+	public AddTargetAnnotationMarkerResolution(IType type){
+		super(type.getCompilationUnit());
+		this.type = type;
+		label = NLS.bind(JaxrsQuickFixMessages.ADD_TARGET_ANNOTATION_MARKER_RESOLUTION_TITLE, type.getElementName());
+		init();
+	}
+
+	@Override
+	protected CompilationUnitChange getChange(ICompilationUnit compilationUnit){
+		CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
+		MultiTextEdit edit = new MultiTextEdit();
+		change.setEdit(edit);
+		try{
+			MarkerResolutionUtils.addImport(EnumJaxrsClassname.TARGET.qualifiedName, compilationUnit, edit);
+			MarkerResolutionUtils.addImport(ElementType.class.getName(), compilationUnit, edit);
+			MarkerResolutionUtils.addAnnotation(EnumJaxrsClassname.TARGET.annotationName, compilationUnit, type, "(ElementType.METHOD)", edit);
+		} catch (JavaModelException e) {
+			Logger.error("Failed to add @Target annotation on type " + type.getFullyQualifiedName(), e);
+		}
+		return change;
+	}
+
+	@Override
+	public Image getImage() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/AddTargetAnnotationMarkerResolution.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsMarkerResolutionGenerator.java (from rev 42677, trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/JaxrsMarkerResolutionGenerator.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsMarkerResolutionGenerator.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsMarkerResolutionGenerator.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,63 @@
+package org.jboss.tools.ws.jaxrs.ui.quickfix;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolutionGenerator2;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils;
+import org.jboss.tools.ws.jaxrs.core.metamodel.quickfix.JaxrsValidationQuickFixes;
+import org.jboss.tools.ws.jaxrs.ui.internal.utils.Logger;
+
+public class JaxrsMarkerResolutionGenerator implements IMarkerResolutionGenerator2 {
+
+	@Override
+	public IMarkerResolution[] getResolutions(IMarker marker) {
+		return getMarkerResolutions(marker);
+	}
+
+	@Override
+	public boolean hasResolutions(IMarker marker) {
+		return getMarkerResolutions(marker).length > 0;
+	}
+
+	/**
+	 * Null-safe extraction of the potential marker resolutions bound to this marker.
+	 * 
+	 * @param marker
+	 *            the marker
+	 * @return a array of marker resolutions. If no resolution is bound to the marker, the returned array is empty (not
+	 *         null).
+	 */
+	private IMarkerResolution[] getMarkerResolutions(final IMarker marker) {
+		try {
+			final int quickfixId = getQuickFixID(marker);
+			switch (quickfixId) {
+			case JaxrsValidationQuickFixes.HTTP_METHOD_MISSING_TARGET_ANNOTATION_ID:
+				final ICompilationUnit compilationUnit = JdtUtils.getCompilationUnit(marker.getResource());
+				final IType type = (IType) JdtUtils.getElementAt(compilationUnit,
+						marker.getAttribute(IMarker.CHAR_START, 0), IJavaElement.TYPE);
+				if (type != null) {
+					return new IMarkerResolution[] { new AddTargetAnnotationMarkerResolution(type) };
+				}
+			}
+		} catch (CoreException e) {
+			Logger.error("Failed to retrieve marker resolution", e);
+		}
+		return new IMarkerResolution[0];
+	}
+
+	/**
+	 * return message id or -1 if impossible to find
+	 * 
+	 * @param marker
+	 * @return
+	 */
+	private int getQuickFixID(IMarker marker) throws CoreException {
+		return ((Integer) marker.getAttribute(ValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME, -1));
+	}
+
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsMarkerResolutionGenerator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsQuickFixMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsQuickFixMessages.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsQuickFixMessages.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ *     Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.jaxrs.ui.quickfix;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Alexey Kazakov
+ * @author Xavier Coulon
+ */
+public class JaxrsQuickFixMessages extends NLS {
+	private static final String BUNDLE_NAME = "org.jboss.tools.ws.jaxrs.ui.quickfix.JaxrsQuickFixMessages"; //$NON-NLS-1$
+
+	public static String ADD_TARGET_ANNOTATION_MARKER_RESOLUTION_TITLE;
+
+	static {
+		NLS.initializeMessages(BUNDLE_NAME, JaxrsQuickFixMessages.class);
+	}
+}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsQuickFixMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsQuickFixMessages.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsQuickFixMessages.properties	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsQuickFixMessages.properties	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,12 @@
+##################################################################################
+### Copyright (c) 2009 Red Hat, Inc.
+### Distributed under license by Red Hat, Inc. All rights reserved.
+### This program is 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:
+###     Red Hat, Inc. - initial API and implementation
+##################################################################################
+
+ADD_TARGET_ANNOTATION_MARKER_RESOLUTION_TITLE=Add @Target annotation on type {0}
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/JaxrsQuickFixMessages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/package-info.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/package-info.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/package-info.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -0,0 +1,15 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is 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: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+/**
+ * @author Xavier Coulon
+ *
+ */
+package org.jboss.tools.ws.jaxrs.ui.quickfix;
\ No newline at end of file


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/quickfix/package-info.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/META-INF/MANIFEST.MF	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/META-INF/MANIFEST.MF	2012-08-24 16:20:04 UTC (rev 43224)
@@ -30,7 +30,8 @@
  org.eclipse.ui;bundle-version="3.7.0",
  org.eclipse.ltk.core.refactoring;bundle-version="3.5.200",
  org.eclipse.wst.validation;bundle-version="1.2.300",
- org.apache.commons.io;bundle-version="2.0.1"
+ org.apache.commons.io;bundle-version="2.0.1",
+ org.jboss.tools.common.validation;bundle-version="3.4.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Eclipse-RegisterBuddy: org.apache.log4j

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/plugin.properties
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/plugin.properties	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/plugin.properties	2012-08-24 16:20:04 UTC (rev 43224)
@@ -1,2 +1,3 @@
 PLUGIN_NAME=JBoss JAX-RS Tooling (Core Tests)
 PLUGIN_PROVIDER=JBoss by Red Hat
+

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BarResource.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BarResource.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BarResource.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -1,27 +1,65 @@
 package org.jboss.tools.ws.jaxrs.sample.services;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 
+/**
+ * Resource with a template parameter on the @Path annotation at the type level.
+ * @author Xavier Coulon
+ *
+ */
 @Path("/foo/bar/{param1}")
 public class BarResource {
 
+	// missing @PathParam("param2") annotation
+	@GET
+	@Path("/{param2}")
+	public Response getContent1(@PathParam("param1") int id) {
+		return null;
+	}
+	
+	// missing @PathParam("param1") annotation
+	// missing @PathParam("id") annotation
+	// unbound @PathParam("i") annotation
+	@GET
+	@Path("/user/{id}/{format:(/format/[^/]+?)?}/{encoding:(/encoding/[^/]+?)?}")
+	public Response getContent2(@PathParam("i") int id,
+				  @PathParam("format") String format,
+				  @PathParam("encoding") String encoding, 
+				  @QueryParam("start") int start) {
+		return null;
+	}
+
+	// invalid "{param2}" value (because of "{" and "}" chars)
+	// unbound path template parameter "param2" 
 	@PUT
 	@Path("{param2}") 
 	public Response update1(@Context HttpServletRequest requestContext,
-			String bar, @PathParam("{param1}") String param1, @PathParam("{param2}") String param2) throws Exception {
+			String bar, @PathParam("param1") String param1, @PathParam("{param2}") String param2) throws Exception {
 		return null;
 	}
 
+	// missing @PathParam("param1") annotation
 	@PUT
 	@Path("{param2}") 
 	public Response update2(@Context HttpServletRequest requestContext,
-			String bar, @PathParam("{param2}") String param2) throws Exception {
+			String bar, @PathParam("param2") String param2) throws Exception {
 		return null;
 	}
+
+	// more than 1 parameter without annotation
+	@PUT
+	@Path("{param2}") 
+	public Response update3(@Context HttpServletRequest requestContext,
+			@PathParam("param1") String param2, 
+			@PathParam("param2") String param2, 
+			String bar, String foo) throws Exception {
+		return null;
+	}
 	
 }

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BazResource.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BazResource.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/BazResource.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -7,31 +7,54 @@
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 
+/**
+ * Resource without any template parameter on the @Path annotation at the type level.
+ * 
+ * @author Xavier Coulon
+ * 
+ */
 @Path("/foo/baz")
 public class BazResource {
 
+	// missing @PathParam("param2") annotation
 	@GET
-	@Path("/{id}")
-	public Response getContent(@PathParam("id") int id) {
+	@Path("/{param2}")
+	public Response getContent1() {
 		return null;
 	}
-	
+
+	// missing @PathParam("id") annotation
+	// unbound @PathParam("i") annotation
 	@GET
 	@Path("/user/{id}/{format:(/format/[^/]+?)?}/{encoding:(/encoding/[^/]+?)?}")
-	public Response getContent(@PathParam("id") int id,
-				  @PathParam("format") String format,
-				  @PathParam("encoding") String encoding, 
-				  @QueryParam("start") int start) {
+	public Response getContent2(@PathParam("i") int id, @PathParam("format") String format,
+			@PathParam("encoding") String encoding, @QueryParam("start") int start) {
 		return null;
 	}
 
-	@GET
-	@Path("/user2/{id}/{format:(/format/[^/]+?)?}/{encoding:(/encoding/[^/]+?)?}")
-	public Response getContent2(@PathParam("id") int id,
-				  @PathParam("format") String format,
-				  @PathParam("encoding") String encoding, 
-				  @QueryParam("start") int start) {
+	// invalid "{param2}" value (because of "{" and "}" chars)
+	// unbound path template parameter "param2"
+	@PUT
+	@Path("{param2}")
+	public Response update1(@Context HttpServletRequest requestContext, String bar, 
+			@PathParam("{param2}") String param2) throws Exception {
 		return null;
 	}
 
+	//OK
+	@PUT
+	@Path("{param2}")
+	public Response update2(@Context HttpServletRequest requestContext, String bar, @PathParam("param2") String param2)
+			throws Exception {
+		return null;
+	}
+
+	// more than 1 parameter without annotation
+	@PUT
+	@Path("{param2}")
+	public Response update3(@Context HttpServletRequest requestContext, 
+			@PathParam("param2") String param2, String bar, String foo) throws Exception {
+		return null;
+	}
+
 }

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/FOO.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/FOO.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/projects/org.jboss.tools.ws.jaxrs.tests.sampleproject/src/main/java/org/jboss/tools/ws/jaxrs/sample/services/FOO.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -8,8 +8,9 @@
 import javax.ws.rs.HttpMethod;
 
 @Retention(value=RetentionPolicy.RUNTIME)
- at Target(value=ElementType.ANNOTATION_TYPE)
+ at Target(value=ElementType.METHOD)
 @HttpMethod("FOO")
+ at SuppressWarnings("unused") // keep it for some junit tests
 public @interface FOO {
 
 }


Property changes on: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src
___________________________________________________________________
Added: svn:ignore
   + test


Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/WorkbenchUtils.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/WorkbenchUtils.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/WorkbenchUtils.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -848,7 +848,7 @@
 		return JdtUtils.resolveAnnotation(member, JdtUtils.parse(member, null), annotationName);
 	}
 
-	public static Annotation getAnnotation(final IMember member, final String annotationName, String... values)
+	public static Annotation changeAnnotation(final IMember member, final String annotationName, String... values)
 			throws JavaModelException {
 		Annotation annotation = JdtUtils.resolveAnnotation(member, JdtUtils.parse(member, null), annotationName);
 

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/configuration/ProjectBuilderUtilsTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/configuration/ProjectBuilderUtilsTestCase.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/configuration/ProjectBuilderUtilsTestCase.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -53,37 +53,14 @@
 	}
 
 	@Test
-	public void shouldInstallProjectFacetAndCheckPositionWithValidation() throws Exception {
+	public void shouldInstallProjectFacetAndCheckPosition() throws Exception {
 		// pre-conditions
-		ProjectBuilderUtils.installProjectBuilder(javaProject.getProject(), ProjectBuilderUtils.VALIDATION_BUILDER_ID);
-		Assert.assertTrue("Wrong result", ProjectBuilderUtils.isProjectBuilderInstalled(javaProject.getProject(),
-				ProjectBuilderUtils.VALIDATION_BUILDER_ID));
 		ProjectBuilderUtils.uninstallProjectBuilder(javaProject.getProject(), BUILDER_ID);
 		Assert.assertFalse("Wrong result",
 				ProjectBuilderUtils.isProjectBuilderInstalled(javaProject.getProject(), BUILDER_ID));
 		// operation
 		ProjectBuilderUtils.installProjectBuilder(javaProject.getProject(), BUILDER_ID);
 		// post-conditions
-		int customBuilderPosition = ProjectBuilderUtils.getBuilderPosition(project, BUILDER_ID);
-		int validationBuilderPosition = ProjectBuilderUtils.getBuilderPosition(project,
-				ProjectBuilderUtils.VALIDATION_BUILDER_ID);
-		Assert.assertTrue("Wrong ordering:" + customBuilderPosition + " < " + validationBuilderPosition,
-				customBuilderPosition == validationBuilderPosition - 1);
-	}
-
-	@Test
-	public void shouldInstallProjectFacetAndCheckPositionWithoutValidation() throws Exception {
-		// pre-conditions
-		ProjectBuilderUtils
-				.uninstallProjectBuilder(javaProject.getProject(), ProjectBuilderUtils.VALIDATION_BUILDER_ID);
-		Assert.assertFalse("Wrong result", ProjectBuilderUtils.isProjectBuilderInstalled(javaProject.getProject(),
-				ProjectBuilderUtils.VALIDATION_BUILDER_ID));
-		ProjectBuilderUtils.uninstallProjectBuilder(javaProject.getProject(), BUILDER_ID);
-		Assert.assertFalse("Wrong result",
-				ProjectBuilderUtils.isProjectBuilderInstalled(javaProject.getProject(), BUILDER_ID));
-		// operation
-		ProjectBuilderUtils.installProjectBuilder(javaProject.getProject(), BUILDER_ID);
-		// post-conditions
 		int p = ProjectBuilderUtils.getBuilderPosition(project, BUILDER_ID);
 		Assert.assertTrue("Wrong index" + p, p != -1);
 

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedProcessorTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedProcessorTestCase.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedProcessorTestCase.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -18,6 +18,7 @@
 import static org.hamcrest.Matchers.everyItem;
 import static org.hamcrest.Matchers.notNullValue;
 import static org.hamcrest.Matchers.nullValue;
+import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.changeAnnotation;
 import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getAnnotation;
 import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getMethod;
 import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getType;
@@ -76,6 +77,7 @@
 import org.jboss.tools.ws.jaxrs.core.AbstractCommonTestCase;
 import org.jboss.tools.ws.jaxrs.core.JBossJaxrsCorePlugin;
 import org.jboss.tools.ws.jaxrs.core.WorkbenchUtils;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsBaseElement;
 import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsHttpMethod;
 import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsJavaApplication;
 import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsMetamodel;
@@ -124,7 +126,7 @@
 	private JaxrsHttpMethod createHttpMethod(EnumJaxrsClassname httpMethodElement) throws CoreException, JavaModelException {
 		final IType httpMethodType = JdtUtils.resolveType(httpMethodElement.qualifiedName, javaProject, progressMonitor);
 		final Annotation httpMethodAnnotation = getAnnotation(httpMethodType, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(httpMethodType, httpMethodAnnotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(httpMethodType, metamodel).httpMethod(httpMethodAnnotation).build();
 		return httpMethod;
 	}
 
@@ -193,9 +195,9 @@
 		final JavaElementDelta event = createEvent(sourceFolder, ADDED);
 		final List<JaxrsElementDelta> impacts = processEvent(event, progressMonitor);
 		// verifications
-		// 1 Application + 1 HttpMethod + 6 RootResources + 2 Subresources + all their methods and fields (total of 16)..
-		assertThat(impacts.size(), equalTo(30));
-		assertThat(metamodel.getElements(javaProject).size(), equalTo(34)); // 4 previous HttpMethods + 29 added items
+		// 1 Application + 1 HttpMethod + 6 RootResources + 2 Subresources + all their methods and fields..
+		assertThat(impacts.size(), equalTo(35));
+		assertThat(metamodel.getElements(javaProject).size(), equalTo(39)); // 4 previous HttpMethods + all added items
 		assertThat(impacts, everyItem(Matchers.<JaxrsElementDelta> hasProperty("deltaKind", equalTo(ADDED))));
 	}
 
@@ -288,7 +290,7 @@
 		// pre-conditions
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.RestApplication",
 				javaProject, progressMonitor);
-		final Annotation annotation = getAnnotation(type, APPLICATION_PATH.qualifiedName, "/bar");
+		final Annotation annotation = changeAnnotation(type, APPLICATION_PATH.qualifiedName, "/bar");
 		final JaxrsJavaApplication application = new JaxrsJavaApplication(type, annotation, metamodel);
 		metamodel.add(application);
 		// operation
@@ -486,7 +488,7 @@
 		// pre-conditions
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, getAnnotation(type, HTTP_METHOD.qualifiedName), metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(getAnnotation(type, HTTP_METHOD.qualifiedName)).build();
 		metamodel.add(httpMethod);
 		final Annotation annotation = getAnnotation(type, Target.class.getName());
 		// operation
@@ -503,8 +505,8 @@
 		// pre-conditions
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
-		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName, "BAR");
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final Annotation annotation = changeAnnotation(type, HTTP_METHOD.qualifiedName, "BAR");
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		// operation
 		final JavaElementDelta event = createEvent(annotation, CHANGED);
@@ -523,7 +525,7 @@
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
 		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		// operation
 		final JavaElementDelta event = createEvent(annotation, CHANGED);
@@ -539,7 +541,7 @@
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
 		final Annotation httpMethodAnnotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, httpMethodAnnotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(httpMethodAnnotation).build();
 		metamodel.add(httpMethod);
 		final Annotation targetAnnotation = getAnnotation(type, Target.class.getName());
 		// operation
@@ -557,7 +559,7 @@
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
 		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		// operation
 		final JavaElementDelta event = createEvent(type.getCompilationUnit(), REMOVED);
@@ -576,7 +578,7 @@
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
 		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		// operation
 		final JavaElementDelta event = createEvent(type, REMOVED);
@@ -595,7 +597,7 @@
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
 		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		// operation
 		final JavaElementDelta event = createEvent(annotation, REMOVED);
@@ -613,7 +615,7 @@
 		// pre-conditions
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, getAnnotation(type, HTTP_METHOD.qualifiedName), metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(getAnnotation(type, HTTP_METHOD.qualifiedName)).build();
 		metamodel.add(httpMethod);
 		// operation
 		final JavaElementDelta event = createEvent(getAnnotation(type, Target.class.getName()), REMOVED);
@@ -629,7 +631,7 @@
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
 		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		final IPackageFragmentRoot sourceFolder = WorkbenchUtils.getPackageFragmentRoot(javaProject, "src/main/java",
 				progressMonitor);
@@ -652,7 +654,7 @@
 		// let's suppose that this jar only contains 1 HTTP Methods ;-)
 		final IType type = JdtUtils.resolveType("javax.ws.rs.GET", javaProject, progressMonitor);
 		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		// operation
 		final JavaElementDelta event = createEvent(lib, REMOVED);
@@ -798,7 +800,7 @@
 	public void shouldUpdateResourceWhenChangingPathAnnotationValue() throws CoreException {
 		// pre-conditions
 		final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
-		final Annotation annotation = getAnnotation(type, PATH.qualifiedName, "/bar");
+		final Annotation annotation = changeAnnotation(type, PATH.qualifiedName, "/bar");
 		final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(annotation).build();
 		metamodel.add(resource);
 		// operation
@@ -835,7 +837,7 @@
 		// pre-conditions
 		final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
 		final Annotation pathAnnotation = getAnnotation(type, PATH.qualifiedName);
-		final Annotation consumesAnnotation = getAnnotation(type, CONSUMES.qualifiedName, "application/foo");
+		final Annotation consumesAnnotation = changeAnnotation(type, CONSUMES.qualifiedName, "application/foo");
 		final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation)
 				.consumes(consumesAnnotation).build();
 		metamodel.add(resource);
@@ -890,7 +892,7 @@
 	public void shouldUpdateResourceWhenChangingProducesAnnotationValue() throws CoreException {
 		// pre-conditions
 		final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
-		final Annotation annotation = getAnnotation(type, PRODUCES.qualifiedName, "application/foo");
+		final Annotation annotation = changeAnnotation(type, PRODUCES.qualifiedName, "application/foo");
 		final Annotation pathAnnotation = getAnnotation(type, PATH.qualifiedName);
 		final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation)
 				.produces(annotation).build();
@@ -1080,7 +1082,7 @@
 		final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
 		metamodel.add(resource);
 		final IField field = type.getField("productType");
-		final Annotation annotation = getAnnotation(field, PATH_PARAM.qualifiedName, "foo");
+		final Annotation annotation = changeAnnotation(field, PATH_PARAM.qualifiedName, "foo");
 		final JaxrsResourceField resourceField = new JaxrsResourceField(field, annotation, resource, metamodel);
 		metamodel.add(resourceField);
 		// operation
@@ -1100,7 +1102,7 @@
 		final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
 		metamodel.add(resource);
 		final IField field = type.getField("foo");
-		final Annotation annotation = getAnnotation(field, QUERY_PARAM.qualifiedName, "foo!");
+		final Annotation annotation = changeAnnotation(field, QUERY_PARAM.qualifiedName, "foo!");
 		final JaxrsResourceField resourceField = new JaxrsResourceField(field, annotation, resource, metamodel);
 		metamodel.add(resourceField);
 		// operation
@@ -1120,7 +1122,7 @@
 		final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
 		metamodel.add(resource);
 		final IField field = type.getField("bar");
-		final Annotation annotation = getAnnotation(field, MATRIX_PARAM.qualifiedName, "bar!");
+		final Annotation annotation = changeAnnotation(field, MATRIX_PARAM.qualifiedName, "bar!");
 		final JaxrsResourceField resourceField = new JaxrsResourceField(field, annotation, resource, metamodel);
 		metamodel.add(resourceField);
 		// operation
@@ -1140,7 +1142,7 @@
 		final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(pathAnnotation).build();
 		metamodel.add(resource);
 		final IField field = type.getField("bar");
-		final Annotation annotation = getAnnotation(field, SuppressWarnings.class.getName(), "bar");
+		final Annotation annotation = changeAnnotation(field, SuppressWarnings.class.getName(), "bar");
 		final JaxrsResourceField resourceField = new JaxrsResourceField(field, annotation, resource, metamodel);
 		metamodel.add(resourceField);
 		// operation
@@ -1360,7 +1362,7 @@
 		final Annotation annotation = getAnnotation(type, PATH.qualifiedName);
 		final JaxrsResource resource = new JaxrsResource.Builder(type, metamodel).pathTemplate(annotation).build();
 		metamodel.add(resource);
-		for (JaxrsResourceMethod resourceMethod : resource.getMethods().values()) {
+		for (JaxrsBaseElement resourceMethod : resource.getMethods().values()) {
 			metamodel.remove(resourceMethod);
 		}
 		// operation
@@ -1671,7 +1673,7 @@
 		metamodel.add(resource);
 		// JAX-RS Resource Method
 		final IMethod method = getMethod(type, "getCustomer");
-		final Annotation pathAnnotation = getAnnotation(method, PATH.qualifiedName, "/foo");
+		final Annotation pathAnnotation = changeAnnotation(method, PATH.qualifiedName, "/foo");
 		final Annotation httpAnnotation = getAnnotation(method, GET.qualifiedName);
 		final JaxrsResourceMethod resourceMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
 				.httpMethod(httpAnnotation).pathTemplate(pathAnnotation).build();
@@ -1727,7 +1729,7 @@
 		metamodel.add(resource);
 		// JAX-RS Resource Method
 		final IMethod method = getMethod(type, "createCustomer");
-		final Annotation consumesAnnotation = getAnnotation(method, CONSUMES.qualifiedName, "application/foo");
+		final Annotation consumesAnnotation = changeAnnotation(method, CONSUMES.qualifiedName, "application/foo");
 		final Annotation httpAnnotation = getAnnotation(method, POST.qualifiedName);
 		final JaxrsResourceMethod resourceMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
 				.httpMethod(httpAnnotation).consumes(consumesAnnotation).build();
@@ -1812,7 +1814,7 @@
 		// JAX-RS Resource Method
 		final IMethod method = getMethod(type, "getCustomerAsVCard");
 		final Annotation httpAnnotation = getAnnotation(method, GET.qualifiedName);
-		final Annotation producesAnnotation = getAnnotation(method, PRODUCES.qualifiedName, "application/foo");
+		final Annotation producesAnnotation = changeAnnotation(method, PRODUCES.qualifiedName, "application/foo");
 		final JaxrsResourceMethod resourceMethod = new JaxrsResourceMethod.Builder(method, resource, metamodel)
 				.httpMethod(httpAnnotation).produces(producesAnnotation).build();
 		metamodel.add(resourceMethod);

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilderTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilderTestCase.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilderTestCase.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -73,7 +73,7 @@
 		// verification
 		final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(javaProject);
 		assertThat(metamodel, notNullValue());
-		assertThat(metamodel.getAllEndpoints().size(), equalTo(14));
+		assertThat(metamodel.getAllEndpoints().size(), equalTo(20));
 	}
 
 	@Test
@@ -90,7 +90,7 @@
 		// verification
 		final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(javaProject);
 		assertThat(metamodel, notNullValue());
-		assertThat(metamodel.getAllEndpoints().size(), equalTo(14));
+		assertThat(metamodel.getAllEndpoints().size(), equalTo(20));
 	}
 
 	@Test
@@ -139,8 +139,8 @@
 		// verification
 		final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(javaProject);
 		assertThat(metamodel, notNullValue());
-		// 13 usual endpoints + 2 newly created
-		assertThat(metamodel.getAllEndpoints().size(), equalTo(16));
+		// 13 usual endpoints + some newly created
+		assertThat(metamodel.getAllEndpoints().size(), equalTo(22));
 	}
 
 	@Test
@@ -157,8 +157,8 @@
 		// verification
 		final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(javaProject);
 		assertThat(metamodel, notNullValue());
-		// 13 usual endpoints + 2 newly created
-		assertThat(metamodel.getAllEndpoints().size(), equalTo(16));
+		// 13 usual endpoints + some newly created
+		assertThat(metamodel.getAllEndpoints().size(), equalTo(22));
 	}
 	
 	@Test

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelChangedProcessorTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelChangedProcessorTestCase.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelChangedProcessorTestCase.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -16,6 +16,7 @@
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.isOneOf;
+import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.changeAnnotation;
 import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getAnnotation;
 import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getMethod;
 import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getType;
@@ -43,6 +44,7 @@
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.core.JavaModelException;
 import org.jboss.tools.ws.jaxrs.core.AbstractCommonTestCase;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsBaseElement;
 import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsBuiltinHttpMethod;
 import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsEndpoint;
 import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsHttpMethod;
@@ -119,7 +121,7 @@
 	private JaxrsHttpMethod createHttpMethod(String qualifiedName) throws JavaModelException, CoreException {
 		final IType type = getType(qualifiedName, javaProject);
 		final Annotation httpAnnotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, httpAnnotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(httpAnnotation).build();
 		metamodel.add(httpMethod);
 		return httpMethod;
 	}
@@ -205,7 +207,7 @@
 	public void shoudCreateEndpointWhenAddingResourceMethodInRootResource() throws CoreException {
 		// pre-conditions
 		final JaxrsResource customerResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
-		final JaxrsResourceMethod customerResourceMethod = createResourceMethod("getCustomers", customerResource,
+		final JaxrsBaseElement customerResourceMethod = createResourceMethod("getCustomers", customerResource,
 				GET);
 		// operation
 		JaxrsElementDelta event = new JaxrsElementDelta(customerResourceMethod, ADDED);
@@ -219,7 +221,7 @@
 	public void shoudCreateEndpointWhenAddingSubresourceMethodInRootResource() throws JavaModelException, CoreException {
 		// pre-conditions
 		final JaxrsResource customerResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
-		final JaxrsResourceMethod customerSubresourceMethod = createResourceMethod("getCustomer", customerResource,
+		final JaxrsBaseElement customerSubresourceMethod = createResourceMethod("getCustomer", customerResource,
 				GET);
 		// operation
 		JaxrsElementDelta event = new JaxrsElementDelta(customerSubresourceMethod, ADDED);
@@ -241,7 +243,7 @@
 		// createEndpoint(httpMethod, gameResourceMethod);
 
 		final JaxrsResource productResourceLocator = createResource("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
-		final JaxrsResourceMethod productResourceLocatorMethod = createResourceMethod("getProductResourceLocator",
+		final JaxrsBaseElement productResourceLocatorMethod = createResourceMethod("getProductResourceLocator",
 				productResourceLocator, null);
 		// operation
 		JaxrsElementDelta event = new JaxrsElementDelta(productResourceLocatorMethod, ADDED);
@@ -258,7 +260,7 @@
 		final JaxrsResource productResourceLocator = createResource("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
 		createResourceMethod("getProductResourceLocator", productResourceLocator, null);
 		final JaxrsResource bookResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.BookResource");
-		final JaxrsResourceMethod bookResourceMethod = createResourceMethod("getAllProducts", bookResource, GET);
+		final JaxrsBaseElement bookResourceMethod = createResourceMethod("getAllProducts", bookResource, GET);
 		// operation
 		final JaxrsElementDelta event = new JaxrsElementDelta(bookResourceMethod, ADDED);
 		final List<JaxrsEndpointDelta> changes = processEvent(event, progressMonitor);
@@ -292,7 +294,7 @@
 		final JaxrsResource productResourceLocator = createResource("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator");
 		createResourceMethod("getProductResourceLocator", productResourceLocator, null);
 		final JaxrsResource bookResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.BookResource");
-		final JaxrsResourceMethod bookResourceMethod = createResourceMethod("getProduct", bookResource, GET);
+		final JaxrsBaseElement bookResourceMethod = createResourceMethod("getProduct", bookResource, GET);
 		// operation
 		final JaxrsElementDelta event = new JaxrsElementDelta(bookResourceMethod, ADDED);
 		final List<JaxrsEndpointDelta> changes = processEvent(event, progressMonitor);
@@ -383,7 +385,7 @@
 		final JaxrsEndpoint endpoint = createEndpoint(metamodel, httpMethod, customerResourceMethod);
 		assertThat(endpoint.getUriPathTemplate(), equalTo("/app/customers/{id}"));
 		// operation
-		final Annotation annotation = getAnnotation(application.getJavaElement(), APPLICATION_PATH.qualifiedName, "/foo");
+		final Annotation annotation = changeAnnotation(application.getJavaElement(), APPLICATION_PATH.qualifiedName, "/foo");
 		int flags = application.addOrUpdateAnnotation(annotation);
 		final JaxrsElementDelta event = new JaxrsElementDelta(application, CHANGED, flags);
 		final List<JaxrsEndpointDelta> changes = processEvent(event, progressMonitor);
@@ -406,7 +408,7 @@
 		final JaxrsEndpoint endpoint = createEndpoint(httpMethod, customerResourceMethod);
 		assertThat(endpoint.getUriPathTemplate(), equalTo("/customers/{id}"));
 		// operation
-		final Annotation annotation = getAnnotation(customerResource.getJavaElement(), PATH.qualifiedName, "/foo");
+		final Annotation annotation = changeAnnotation(customerResource.getJavaElement(), PATH.qualifiedName, "/foo");
 		customerResource.addOrUpdateAnnotation(annotation);
 		final JaxrsElementDelta event = new JaxrsElementDelta(customerResource, CHANGED, F_PATH_VALUE);
 		final List<JaxrsEndpointDelta> changes = processEvent(event, progressMonitor);
@@ -429,7 +431,7 @@
 		final JaxrsEndpoint endpoint = createEndpoint(httpMethod, customerResourceMethod);
 		assertThat(endpoint.getUriPathTemplate(), equalTo("/customers/{id}"));
 		// operation
-		final Annotation annotation = getAnnotation(customerResourceMethod.getJavaElement(), PATH.qualifiedName, "{foo}");
+		final Annotation annotation = changeAnnotation(customerResourceMethod.getJavaElement(), PATH.qualifiedName, "{foo}");
 		final int flags = customerResourceMethod.addOrUpdateAnnotation(annotation);
 		final JaxrsElementDelta event = new JaxrsElementDelta(customerResourceMethod, CHANGED, flags);
 		final List<JaxrsEndpointDelta> changes = processEvent(event, progressMonitor);
@@ -483,7 +485,7 @@
 		assertThat(endpoint.getUriPathTemplate(), equalTo("/customers/{id}"));
 		// operation
 		int flags = httpMethod
-				.addOrUpdateAnnotation(getAnnotation(httpMethod.getJavaElement(), HTTP_METHOD.qualifiedName, "BAR"));
+				.addOrUpdateAnnotation(changeAnnotation(httpMethod.getJavaElement(), HTTP_METHOD.qualifiedName, "BAR"));
 		final JaxrsElementDelta event = new JaxrsElementDelta(httpMethod, CHANGED, flags);
 		final List<JaxrsEndpointDelta> changes = processEvent(event, progressMonitor);
 		// verifications
@@ -592,7 +594,7 @@
 		final JaxrsResource customerResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
 		final JaxrsResourceMethod customerResourceMethod = createResourceMethod("createCustomer", customerResource,
 				POST);
-		final Annotation annotation = getAnnotation(customerResourceMethod.getJavaElement(), CONSUMES.qualifiedName,
+		final Annotation annotation = changeAnnotation(customerResourceMethod.getJavaElement(), CONSUMES.qualifiedName,
 				"application/foo");
 		customerResourceMethod.addOrUpdateAnnotation(annotation);
 		final JaxrsEndpoint endpoint = createEndpoint(httpMethod, customerResourceMethod);
@@ -615,7 +617,7 @@
 		// pre-conditions
 		final JaxrsHttpMethod httpMethod = JaxrsBuiltinHttpMethod.POST;
 		final JaxrsResource customerResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
-		final Annotation annotation = getAnnotation(customerResource.getJavaElement(), CONSUMES.qualifiedName,
+		final Annotation annotation = changeAnnotation(customerResource.getJavaElement(), CONSUMES.qualifiedName,
 				"application/foo");
 		customerResource.addOrUpdateAnnotation(annotation);
 		final JaxrsResourceMethod customerResourceMethod = createResourceMethod("createCustomer", customerResource,
@@ -641,11 +643,11 @@
 		// pre-conditions
 		final JaxrsHttpMethod httpMethod = JaxrsBuiltinHttpMethod.POST;
 		final JaxrsResource customerResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
-		customerResource.addOrUpdateAnnotation(getAnnotation(customerResource.getJavaElement(), CONSUMES.qualifiedName,
+		customerResource.addOrUpdateAnnotation(changeAnnotation(customerResource.getJavaElement(), CONSUMES.qualifiedName,
 				"application/xml"));
 		final JaxrsResourceMethod customerResourceMethod = createResourceMethod("createCustomer", customerResource,
 				POST);
-		final Annotation annotation = getAnnotation(customerResourceMethod.getJavaElement(), CONSUMES.qualifiedName,
+		final Annotation annotation = changeAnnotation(customerResourceMethod.getJavaElement(), CONSUMES.qualifiedName,
 				"application/foo");
 		customerResourceMethod.addOrUpdateAnnotation(annotation);
 		final JaxrsEndpoint endpoint = createEndpoint(httpMethod, customerResourceMethod);
@@ -670,7 +672,7 @@
 		final JaxrsResource customerResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
 		final JaxrsResourceMethod customerResourceMethod = createResourceMethod("createCustomer", customerResource,
 				POST);
-		final Annotation annotation = getAnnotation(customerResourceMethod.getJavaElement(), CONSUMES.qualifiedName,
+		final Annotation annotation = changeAnnotation(customerResourceMethod.getJavaElement(), CONSUMES.qualifiedName,
 				"application/foo");
 		customerResourceMethod.addOrUpdateAnnotation(annotation);
 		final JaxrsEndpoint endpoint = createEndpoint(httpMethod, customerResourceMethod);
@@ -697,7 +699,7 @@
 		final JaxrsEndpoint endpoint = createEndpoint(httpMethod, customerResourceMethod);
 		assertThat(endpoint.getProducedMediaTypes(), equalTo(Arrays.asList("*/*")));
 		// operation
-		final int flags = customerResource.addOrUpdateAnnotation(getAnnotation(customerResource.getJavaElement(),
+		final int flags = customerResource.addOrUpdateAnnotation(changeAnnotation(customerResource.getJavaElement(),
 				PRODUCES.qualifiedName, "application/xml"));
 		final JaxrsElementDelta event = new JaxrsElementDelta(customerResource, CHANGED, flags);
 		final List<JaxrsEndpointDelta> changes = processEvent(event, progressMonitor);
@@ -737,7 +739,7 @@
 		// pre-conditions
 		final JaxrsHttpMethod httpMethod = JaxrsBuiltinHttpMethod.GET;
 		final JaxrsResource customerResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
-		final Annotation annotation = getAnnotation(customerResource.getJavaElement(), PRODUCES.qualifiedName,
+		final Annotation annotation = changeAnnotation(customerResource.getJavaElement(), PRODUCES.qualifiedName,
 				"application/foo");
 		customerResource.addOrUpdateAnnotation(annotation);
 		final JaxrsResourceMethod customerResourceMethod = createResourceMethod("getCustomerAsVCard", customerResource,
@@ -745,7 +747,7 @@
 		final JaxrsEndpoint endpoint = createEndpoint(httpMethod, customerResourceMethod);
 		assertThat(endpoint.getProducedMediaTypes(), equalTo(Arrays.asList("application/foo")));
 		// operation
-		int flags = customerResource.addOrUpdateAnnotation(getAnnotation(customerResource.getJavaElement(),
+		int flags = customerResource.addOrUpdateAnnotation(changeAnnotation(customerResource.getJavaElement(),
 				PRODUCES.qualifiedName, "application/xml"));
 		final JaxrsElementDelta event = new JaxrsElementDelta(customerResource, CHANGED, flags);
 		final List<JaxrsEndpointDelta> changes = processEvent(event, progressMonitor);
@@ -765,7 +767,7 @@
 		final JaxrsResource customerResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
 		final JaxrsResourceMethod customerResourceMethod = createResourceMethod("getCustomerAsVCard", customerResource,
 				POST);
-		final Annotation annotation = getAnnotation(customerResourceMethod.getJavaElement(), PRODUCES.qualifiedName,
+		final Annotation annotation = changeAnnotation(customerResourceMethod.getJavaElement(), PRODUCES.qualifiedName,
 				"application/foo");
 		customerResourceMethod.addOrUpdateAnnotation(annotation);
 		final JaxrsEndpoint endpoint = createEndpoint(httpMethod, customerResourceMethod);
@@ -789,11 +791,11 @@
 		// pre-conditions
 		final JaxrsHttpMethod httpMethod = JaxrsBuiltinHttpMethod.GET;
 		final JaxrsResource customerResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
-		customerResource.addOrUpdateAnnotation(getAnnotation(customerResource.getJavaElement(), PRODUCES.qualifiedName,
+		customerResource.addOrUpdateAnnotation(changeAnnotation(customerResource.getJavaElement(), PRODUCES.qualifiedName,
 				"application/xml"));
 		final JaxrsResourceMethod customerResourceMethod = createResourceMethod("getCustomerAsVCard", customerResource,
 				POST);
-		final Annotation annotation = getAnnotation(customerResourceMethod.getJavaElement(), PRODUCES.qualifiedName,
+		final Annotation annotation = changeAnnotation(customerResourceMethod.getJavaElement(), PRODUCES.qualifiedName,
 				"application/foo");
 		customerResourceMethod.addOrUpdateAnnotation(annotation);
 		final JaxrsEndpoint endpoint = createEndpoint(httpMethod, customerResourceMethod);
@@ -818,7 +820,7 @@
 		final JaxrsResource customerResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource");
 		final JaxrsResourceMethod customerResourceMethod = createResourceMethod("createCustomer", customerResource,
 				POST);
-		final Annotation annotation = getAnnotation(customerResourceMethod.getJavaElement(), CONSUMES.qualifiedName,
+		final Annotation annotation = changeAnnotation(customerResourceMethod.getJavaElement(), CONSUMES.qualifiedName,
 				"application/foo");
 		customerResourceMethod.addOrUpdateAnnotation(annotation);
 		final JaxrsEndpoint endpoint = createEndpoint(httpMethod, customerResourceMethod);
@@ -960,7 +962,7 @@
 		createEndpoint(httpMethod, productResourceLocatorMethod, bookResourceMethod);
 		// adding an extra subresource that should be affected later
 		final JaxrsResource gameResource = createResource("org.jboss.tools.ws.jaxrs.sample.services.GameResource");
-		final JaxrsResourceMethod gameResourceMethod = createResourceMethod("getProduct", gameResource, GET);
+		final JaxrsBaseElement gameResourceMethod = createResourceMethod("getProduct", gameResource, GET);
 		assertThat(metamodel.getAllEndpoints().size(), equalTo(1));
 		// operation
 		final IType objectType = JdtUtils.resolveType(Object.class.getName(), javaProject, progressMonitor);

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -17,6 +17,7 @@
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.Matchers.everyItem;
 import static org.hamcrest.Matchers.notNullValue;
+import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.changeAnnotation;
 import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getAnnotation;
 import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getType;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.APPLICATION_PATH;
@@ -26,7 +27,10 @@
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.HTTP_METHOD;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.POST;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.PUT;
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.RETENTION;
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.TARGET;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.spy;
@@ -114,7 +118,7 @@
 	 * @throws JavaModelException
 	 */
 	private JaxrsJavaApplication createApplication(IType type, String applicationPath) throws JavaModelException {
-		final Annotation annotation = getAnnotation(type, APPLICATION_PATH.qualifiedName, applicationPath);
+		final Annotation annotation = changeAnnotation(type, APPLICATION_PATH.qualifiedName, applicationPath);
 		return new JaxrsJavaApplication(type, annotation, metamodel);
 	}
 
@@ -137,19 +141,22 @@
 	private JaxrsHttpMethod createHttpMethod(EnumJaxrsClassname httpMethodElement) throws CoreException, JavaModelException {
 		final IType httpMethodType = JdtUtils.resolveType(httpMethodElement.qualifiedName, javaProject, progressMonitor);
 		final Annotation httpMethodAnnotation = getAnnotation(httpMethodType, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(httpMethodType, httpMethodAnnotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(httpMethodType, metamodel).httpMethod(httpMethodAnnotation).build();
+		
 		return httpMethod;
 	}
 
 	private JaxrsHttpMethod createHttpMethod(IType type) throws JavaModelException {
-		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final Annotation httpMethodAnnotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
+		final Annotation targetAnnotation = getAnnotation(type, TARGET.qualifiedName);
+		final Annotation retentionAnnotation = getAnnotation(type, RETENTION.qualifiedName);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(httpMethodAnnotation).target(targetAnnotation).retention(retentionAnnotation).build();
 		return httpMethod;
 	}
 
 	private JaxrsHttpMethod createHttpMethod(IType type, String httpVerb) throws JavaModelException {
-		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName, httpVerb);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final Annotation annotation = changeAnnotation(type, HTTP_METHOD.qualifiedName, httpVerb);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		return httpMethod;
 	}
 
@@ -188,7 +195,7 @@
 		assertThat(affectedElements.size(), equalTo(9));
 		assertThat(affectedElements, everyItem(Matchers.<JaxrsElementDelta> hasProperty("deltaKind", equalTo(ADDED))));
 		// all HttpMethods, Resources, ResourceMethods and ResourceFields. only application is available: the java-based one found in src/main/java
-		assertThat(metamodel.getElements(javaProject).size(), equalTo(30));
+		assertThat(metamodel.getElements(javaProject).size(), equalTo(35));
 	}
 
 	@Test
@@ -211,7 +218,7 @@
 		assertThat(affectedElements, everyItem(Matchers.<JaxrsElementDelta> hasProperty("deltaKind", equalTo(ADDED))));
 		// all project-specific Applications, HttpMethods, Resources, ResourceMethods and ResourceFields (built-in HttpMethods are not bound to a project)
 		// 2 applications are available: the java-based and the web.xml since a full build was performed
-		assertThat(metamodel.getElements(javaProject).size(), equalTo(31));
+		assertThat(metamodel.getElements(javaProject).size(), equalTo(36));
 	}
 
 	/**
@@ -242,7 +249,7 @@
 		final List<JaxrsElementDelta> affectedElements = affectedMetamodel.getAffectedElements();
 		assertThat(affectedElements.size(), equalTo(9));
 		// all Applications, HttpMethods, Resources, ResourceMethods and ResourceFields specific to the project
-		assertThat(metamodel.getElements(javaProject).size(), equalTo(31));
+		assertThat(metamodel.getElements(javaProject).size(), equalTo(36));
 
 	}
 
@@ -354,7 +361,7 @@
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
 		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		// operation
 		WorkbenchUtils.delete(type);
@@ -563,7 +570,7 @@
 		// let's suppose that this jar only contains 1 HTTP Methods ;-)
 		final IType type = JdtUtils.resolveType("javax.ws.rs.GET", javaProject, progressMonitor);
 		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		// operation
 		final ResourceDelta event = createEvent(lib.getResource(), REMOVED);
@@ -595,7 +602,8 @@
 		// pre-conditions
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
-		metamodel.add(createHttpMethod(type, "bar"));
+		final JaxrsHttpMethod httpMethod = createHttpMethod(type, "bar");
+		metamodel.add(httpMethod);
 		// operation
 		final ResourceDelta event = createEvent(type.getResource(), CHANGED);
 		final List<JaxrsElementDelta> affectedElements = processResourceChanges(event, progressMonitor);
@@ -606,9 +614,48 @@
 		assertThat(((IJaxrsHttpMethod) affectedElements.get(0).getElement()).getHttpVerb(), equalTo("FOO"));
 		verify(metamodel, times(1)).add(any(JaxrsHttpMethod.class));
 		assertThat(metamodel.getElements(javaProject).size(), equalTo(1));
+		assertThat(httpMethod.getHttpVerb(), equalTo("FOO"));
 	}
 
 	@Test
+	public void shouldChangeHttpMethodWhenRemovingTargetAnnotation() throws CoreException {
+		// pre-conditions
+		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
+				progressMonitor);
+		final JaxrsHttpMethod httpMethod = createHttpMethod(type);
+		metamodel.add(httpMethod);
+		final Annotation annotation = getAnnotation(type, TARGET.qualifiedName);
+		// operation
+		WorkbenchUtils.delete(annotation.getJavaAnnotation(), false);
+		final ResourceDelta event = createEvent(annotation.getJavaParent().getResource(), CHANGED);
+		final List<JaxrsElementDelta> affectedElements = processResourceChanges(event, progressMonitor);
+		// verifications
+		assertThat(affectedElements.size(), equalTo(1));
+		assertThat(affectedElements.get(0).getElement().getElementCategory(), equalTo(EnumElementCategory.HTTP_METHOD));
+		assertThat(affectedElements.get(0).getDeltaKind(), equalTo(CHANGED));
+		assertThat(((IJaxrsHttpMethod) affectedElements.get(0).getElement()).getHttpVerb(), equalTo("FOO"));
+		verify(metamodel, times(1)).add(any(JaxrsHttpMethod.class));
+		assertThat(metamodel.getElements(javaProject).size(), equalTo(1));
+		assertNull(httpMethod.getAnnotations().get(TARGET.qualifiedName));
+	}
+
+	@Test
+	public void shouldNotChangeHttpMethodWhenAddingDeprecatedAnnotation() throws CoreException {
+		// pre-conditions
+		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
+				progressMonitor);
+		final JaxrsHttpMethod httpMethod = createHttpMethod(type);
+		metamodel.add(httpMethod);
+		final Annotation annotation = getAnnotation(type, TARGET.qualifiedName);
+		// operation
+		WorkbenchUtils.addTypeAnnotation(type, "@Deprecated", false);
+		final ResourceDelta event = createEvent(annotation.getJavaParent().getResource(), CHANGED);
+		final List<JaxrsElementDelta> affectedElements = processResourceChanges(event, progressMonitor);
+		// verifications
+		assertThat(affectedElements.size(), equalTo(0));
+	}
+	
+	@Test
 	public void shouldRemoveHttpMethodWhenChangingResource() throws CoreException {
 		// pre-conditions
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
@@ -635,7 +682,7 @@
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
 		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		// operation
 		final ResourceDelta event = createEvent(type.getResource(), REMOVED);
@@ -654,7 +701,7 @@
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
 		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		// operation
 		WorkbenchUtils.delete(type);
@@ -674,7 +721,7 @@
 		final IType type = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
 		final Annotation annotation = getAnnotation(type, HTTP_METHOD.qualifiedName);
-		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(type, annotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(type, metamodel).httpMethod(annotation).build();
 		metamodel.add(httpMethod);
 		final IPackageFragmentRoot sourceFolder = WorkbenchUtils.getPackageFragmentRoot(javaProject, "src/main/java",
 				progressMonitor);

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactoryTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactoryTestCase.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactoryTestCase.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -117,7 +117,7 @@
 		// pre-conditions
 		final IType httpType = getType(GET.qualifiedName, javaProject);
 		final Annotation httpAnnotation = getAnnotation(httpType, HTTP_METHOD.qualifiedName);
-		JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(httpType, httpAnnotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(httpType, metamodel).httpMethod(httpAnnotation).build();
 		metamodel.add(httpMethod);
 		final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
 		final IMethod method = getMethod(type, "getCustomerAsVCard");
@@ -135,7 +135,7 @@
 		// pre-conditions
 		final IType httpType = getType(GET.qualifiedName, javaProject);
 		final Annotation httpAnnotation = getAnnotation(httpType, HTTP_METHOD.qualifiedName);
-		JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(httpType, httpAnnotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(httpType, metamodel).httpMethod(httpAnnotation).build();
 		metamodel.add(httpMethod);
 		final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.BookResource", javaProject);
 		final IMethod method = getMethod(type, "getProduct");
@@ -153,7 +153,7 @@
 		// pre-conditions
 		final IType httpType = getType(GET.qualifiedName, javaProject);
 		final Annotation httpAnnotation = getAnnotation(httpType, HTTP_METHOD.qualifiedName);
-		JaxrsHttpMethod httpMethod = new JaxrsHttpMethod(httpType, httpAnnotation, metamodel);
+		final JaxrsHttpMethod httpMethod = new JaxrsHttpMethod.Builder(httpType, metamodel).httpMethod(httpAnnotation).build();
 		metamodel.add(httpMethod);
 		final IType type = getType("org.jboss.tools.ws.jaxrs.sample.services.ProductResourceLocator", javaProject);
 		IField field = type.getField("foo");

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodelTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodelTestCase.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodelTestCase.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -78,7 +78,7 @@
 		IType javaType = JdtUtils.resolveType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject,
 				progressMonitor);
 		final Annotation annotation = JdtUtils.resolveAnnotation(javaType, JdtUtils.parse(javaType, progressMonitor),
-				Target.class);
+				SuppressWarnings.class);
 		assertThat(metamodel.getElement(annotation), nullValue());
 	}
 
@@ -144,7 +144,7 @@
 	@Test
 	public void shouldAssertResolvedEndpoints() throws CoreException {
 		List<IJaxrsEndpoint> endpoints = metamodel.getAllEndpoints();
-		Assert.assertEquals("Wrong result", 14, endpoints.size());
+		Assert.assertEquals("Wrong result", 20, endpoints.size());
 		for (IJaxrsEndpoint endpoint : endpoints) {
 			Assert.assertFalse("Empty list of resourceMethods", endpoint.getResourceMethods().isEmpty());
 			Assert.assertNotNull("No URI Path template", endpoint.getUriPathTemplate());

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidatorTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidatorTestCase.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidatorTestCase.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -11,102 +11,343 @@
 package org.jboss.tools.ws.jaxrs.core.internal.metamodel.validation;
 
 import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
+import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.changeAnnotation;
 import static org.jboss.tools.ws.jaxrs.core.WorkbenchUtils.getAnnotation;
 import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.HTTP_METHOD;
-import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.PATH;
+import static org.jboss.tools.ws.jaxrs.core.jdt.EnumJaxrsClassname.TARGET;
 import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
 
+import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
 
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IMethod;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ISourceRange;
 import org.eclipse.jdt.core.IType;
-import org.eclipse.wst.validation.ValidatorMessage;
+import org.eclipse.wst.validation.ReporterHelper;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.jboss.tools.common.validation.ContextValidationHelper;
+import org.jboss.tools.common.validation.IProjectValidationContext;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.common.validation.ValidatorManager;
+import org.jboss.tools.common.validation.internal.ProjectValidationContext;
 import org.jboss.tools.ws.jaxrs.core.WorkbenchUtils;
 import org.jboss.tools.ws.jaxrs.core.builder.AbstractMetamodelBuilderTestCase;
 import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsBaseElement;
 import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsHttpMethod;
+import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsResource;
 import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsResourceMethod;
 import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
+import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
+import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsApplication;
+import org.jboss.tools.ws.jaxrs.core.preferences.JaxrsPreferences;
 import org.junit.Test;
 
 /**
  * @author Xi
- *
+ * 
  */
+ at SuppressWarnings("restriction")
 public class JaxrsMetamodelValidatorTestCase extends AbstractMetamodelBuilderTestCase {
-	
+
+	private final IReporter reporter = new ReporterHelper(new NullProgressMonitor());
+	private final ContextValidationHelper validationHelper = new ContextValidationHelper();
+	private final IProjectValidationContext context = new ProjectValidationContext();
+	private final ValidatorManager validatorManager = new ValidatorManager();
+
+	private Set<IFile> toSet(IResource resource) {
+		final Set<IFile> changedFiles = new HashSet<IFile>();
+		changedFiles.add((IFile) resource);
+		return changedFiles;
+	}
+
+	/**
+	 * @param element
+	 * @return
+	 * @throws CoreException
+	 */
+	private IMarker[] findJaxrsMarkers(final JaxrsBaseElement element) throws CoreException {
+		switch (element.getElementCategory()) {
+		case HTTP_METHOD:
+		case RESOURCE:
+			return element.getResource().findMarkers(JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE, true,
+					IResource.DEPTH_INFINITE);
+		case RESOURCE_METHOD:
+			final IMarker[] markers = element.getResource().findMarkers(JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE,
+					true, IResource.DEPTH_INFINITE);
+			final List<IMarker> resourceMethodMarkers = new ArrayList<IMarker>();
+			final ISourceRange methodSourceRange = ((JaxrsResourceMethod) element).getJavaElement().getSourceRange();
+
+			for (IMarker marker : markers) {
+				final int markerCharStart = marker.getAttribute(IMarker.CHAR_START, -1);
+				if (markerCharStart >= methodSourceRange.getOffset()
+						&& markerCharStart <= (methodSourceRange.getOffset() + methodSourceRange.getLength())) {
+					resourceMethodMarkers.add(marker);
+				}
+			}
+			return resourceMethodMarkers.toArray(new IMarker[resourceMethodMarkers.size()]);
+		default:
+			return new IMarker[0];
+		}
+	}
+
+	/**
+	 * @param element
+	 * @throws CoreException
+	 */
+	private void deleteJaxrsMarkers(final JaxrsBaseElement element) throws CoreException {
+		element.getResource()
+				.deleteMarkers(JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE, false, IResource.DEPTH_INFINITE);
+	}
+
+	/**
+	 * @param element
+	 * @throws CoreException
+	 */
+	private void deleteJaxrsMarkers(final IProject project) throws CoreException {
+		project.deleteMarkers(JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE, false, IResource.DEPTH_INFINITE);
+	}
+
 	@Test
-	public void shouldValidateHttpMethod() throws CoreException {
+	public void shouldValidateHttpMethod() throws CoreException, ValidationException {
 		// preconditions
-		IType fooType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject);
+		final IType fooType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject);
 		final JaxrsBaseElement httpMethod = metamodel.getElement(fooType);
+		assertThat(findJaxrsMarkers(httpMethod).length, equalTo(0));
+		deleteJaxrsMarkers(httpMethod);
 		// operation
-		final List<ValidatorMessage> validationMessages = httpMethod.validate();
+		new JaxrsMetamodelValidator().validate(toSet(httpMethod.getResource()), project, validationHelper, context,
+				validatorManager, reporter);
 		// validation
-		assertThat(validationMessages.size(), equalTo(0));
+		assertThat(findJaxrsMarkers(httpMethod).length, equalTo(0));
 	}
 
 	@Test
-	public void shouldNotValidateHttpMethod() throws CoreException {
+	public void shouldReportProblemWhenHttpMethodVerbIsEmpty() throws CoreException, ValidationException {
 		// preconditions
-		IType fooType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject);
+		final IType fooType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject);
 		final JaxrsHttpMethod httpMethod = metamodel.getElement(fooType, JaxrsHttpMethod.class);
-		Annotation httpAnnotation = getAnnotation(fooType, HTTP_METHOD.qualifiedName, new String[0]);
+		final Annotation httpAnnotation = changeAnnotation(fooType, HTTP_METHOD.qualifiedName, new String[0]);
 		httpMethod.addOrUpdateAnnotation(httpAnnotation);
+		deleteJaxrsMarkers(httpMethod);
 		// operation
-		final List<ValidatorMessage> validationMessages = httpMethod.validate();
+		new JaxrsMetamodelValidator().validate(toSet(httpMethod.getResource()), project, validationHelper, context,
+				validatorManager, reporter);
 		// validation
-		assertThat(validationMessages.size(), equalTo(1));
+		final IMarker[] markers = findJaxrsMarkers(httpMethod);
+		assertThat(markers.length, equalTo(1));
 	}
-	
+
 	@Test
-	public void shouldValidateCustomerResourceMethod() throws CoreException {
+	public void shouldReportProblemWhenHttpMethodVerbIsNull() throws CoreException, ValidationException {
 		// preconditions
-		IType customerJavaType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
-		final JaxrsBaseElement customerResource = metamodel.getElement(customerJavaType);
+		final IType fooType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject);
+		final JaxrsHttpMethod httpMethod = metamodel.getElement(fooType, JaxrsHttpMethod.class);
+		final Annotation httpAnnotation = changeAnnotation(fooType, HTTP_METHOD.qualifiedName, (String) null);
+		httpMethod.addOrUpdateAnnotation(httpAnnotation);
+		deleteJaxrsMarkers(httpMethod);
 		// operation
-		final List<ValidatorMessage> validationMessages = customerResource.validate();
+		new JaxrsMetamodelValidator().validate(toSet(httpMethod.getResource()), project, validationHelper, context,
+				validatorManager, reporter);
 		// validation
-		assertThat(validationMessages.size(), equalTo(0));
+		assertThat(findJaxrsMarkers(httpMethod).length, equalTo(1));
 	}
 
 	@Test
-	public void shouldValidateBarResourceMethod() throws CoreException {
+	public void shouldReportProblemWhenHttpMethodTypeMissesTargetAnnotation() throws CoreException, ValidationException {
 		// preconditions
-		IType barJavaType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.BarResource", javaProject);
-		final JaxrsBaseElement barResource = metamodel.getElement(barJavaType);
+		final IType fooType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject);
+		final JaxrsHttpMethod httpMethod = metamodel.getElement(fooType, JaxrsHttpMethod.class);
+		final Annotation targetAnnotation = getAnnotation(fooType, TARGET.qualifiedName);
+		httpMethod.removeAnnotation(targetAnnotation);
+		deleteJaxrsMarkers(httpMethod);
 		// operation
-		final List<ValidatorMessage> validationMessages = barResource.validate();
+		new JaxrsMetamodelValidator().validate(toSet(httpMethod.getResource()), project, validationHelper, context,
+				validatorManager, reporter);
 		// validation
-		// 3 errors because of curly brackets + 4 warnings because of missing (correct) parameters
-		assertThat(validationMessages.size(), equalTo(7));
+		assertThat(findJaxrsMarkers(httpMethod).length, equalTo(1));
 	}
 
 	@Test
-	public void shouldValidateBazResourceMethod() throws CoreException {
+	public void shouldReportProblemWhenHttpMethodTypeTargetAnnotationHasNullValue() throws CoreException,
+			ValidationException {
 		// preconditions
-		IType bazJavaType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.BazResource", javaProject);
-		final JaxrsBaseElement barResource = metamodel.getElement(bazJavaType);
+		final IType fooType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject);
+		final JaxrsHttpMethod httpMethod = metamodel.getElement(fooType, JaxrsHttpMethod.class);
+		final Annotation targetAnnotation = changeAnnotation(fooType, TARGET.qualifiedName, (String) null);
+		httpMethod.addOrUpdateAnnotation(targetAnnotation);
+		deleteJaxrsMarkers(httpMethod);
 		// operation
-		final List<ValidatorMessage> validationMessages = barResource.validate();
+		new JaxrsMetamodelValidator().validate(toSet(httpMethod.getResource()), project, validationHelper, context,
+				validatorManager, reporter);
 		// validation
-		assertThat(validationMessages.size(), equalTo(0));
+		assertThat(findJaxrsMarkers(httpMethod).length, equalTo(1));
+
 	}
 
 	@Test
-	public void shouldNotValidateResourceMethod() throws CoreException {
+	public void shouldReportProblemWhenHttpMethodTypeTargetAnnotationHasWrongValue() throws CoreException,
+			ValidationException {
 		// preconditions
-		IType customerJavaType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
+		final IType fooType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.FOO", javaProject);
+		final JaxrsHttpMethod httpMethod = metamodel.getElement(fooType, JaxrsHttpMethod.class);
+		final Annotation targetAnnotation = changeAnnotation(fooType, TARGET.qualifiedName, "FOO");
+		httpMethod.addOrUpdateAnnotation(targetAnnotation);
+		deleteJaxrsMarkers(httpMethod);
+		// operation
+		new JaxrsMetamodelValidator().validate(toSet(httpMethod.getResource()), project, validationHelper, context,
+				validatorManager, reporter);
+		// validation
+		assertThat(findJaxrsMarkers(httpMethod).length, equalTo(1));
+	}
+
+	@Test
+	public void shouldValidateCustomerResourceMethod() throws CoreException, ValidationException {
+		// preconditions
+		final IType customerJavaType = WorkbenchUtils.getType(
+				"org.jboss.tools.ws.jaxrs.sample.services.CustomerResource", javaProject);
 		final JaxrsBaseElement customerResource = metamodel.getElement(customerJavaType);
-		IMethod customerJavaMethod = WorkbenchUtils.getMethod(customerJavaType, "getCustomer");
-		final JaxrsResourceMethod customerResourceMethod = metamodel.getElement(customerJavaMethod, JaxrsResourceMethod.class);
-		Annotation pathAnnotation = getAnnotation(customerJavaMethod, PATH.qualifiedName, "/{foo}");
-		customerResourceMethod.addOrUpdateAnnotation(pathAnnotation);
+		deleteJaxrsMarkers(customerResource);
 		// operation
-		final List<ValidatorMessage> validationMessages = customerResource.validate();
+		new JaxrsMetamodelValidator().validate(toSet(customerResource.getResource()), project, validationHelper,
+				context, validatorManager, reporter);
 		// validation
-		assertThat(validationMessages.size(), equalTo(2));
+		assertThat(findJaxrsMarkers(customerResource).length, equalTo(0));
 	}
 
+	@Test
+	public void shouldReportProblemsOnBarResourceMethods() throws CoreException, ValidationException {
+		// preconditions
+		final IType barJavaType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.BarResource",
+				javaProject);
+		final JaxrsResource barResource = metamodel.getElement(barJavaType, JaxrsResource.class);
+		deleteJaxrsMarkers(barResource);
+		// operation
+		new JaxrsMetamodelValidator().validate(toSet(barResource.getResource()), project, validationHelper, context,
+				validatorManager, reporter);
+		// validation
+		final IMarker[] markers = findJaxrsMarkers(barResource);
+		assertThat(markers.length, equalTo(8));
+		final Map<String, JaxrsResourceMethod> resourceMethods = barResource.getMethods();
+		for (Entry<String, JaxrsResourceMethod> entry : resourceMethods.entrySet()) {
+			final IMarker[] methodMarkers = findJaxrsMarkers(entry.getValue());
+			if (entry.getKey().contains("getContent1")) {
+				assertThat(entry.getValue().hasErrors(), is(true));
+				assertThat(methodMarkers.length, equalTo(1));
+				assertThat(methodMarkers[0].getType(), equalTo(JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE));
+				assertThat(methodMarkers[0].getAttribute(ValidationErrorManager.PREFERENCE_KEY_ATTRIBUTE_NAME, ""),
+						equalTo(JaxrsPreferences.RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER));
+			} else if (entry.getKey().contains("getContent2")) {
+				assertThat(entry.getValue().hasErrors(), is(true));
+				assertThat(methodMarkers.length, equalTo(3));
+			} else if (entry.getKey().contains("update1")) {
+				assertThat(entry.getValue().hasErrors(), is(true));
+				assertThat(methodMarkers.length, equalTo(2));
+			} else if (entry.getKey().contains("update2")) {
+				assertThat(entry.getValue().hasErrors(), is(true));
+				assertThat(methodMarkers.length, equalTo(1));
+			} else if (entry.getKey().contains("update3")) {
+				assertThat(entry.getValue().hasErrors(), is(true));
+				assertThat(methodMarkers.length, equalTo(1));
+			} else {
+				fail("Unexpected method " + entry.getKey());
+			}
+		}
+	}
+
+	@Test
+	public void shouldReportProblemsOnBazResourceMethods() throws CoreException, ValidationException {
+		// preconditions
+		final IType barJavaType = WorkbenchUtils.getType("org.jboss.tools.ws.jaxrs.sample.services.BazResource",
+				javaProject);
+		final JaxrsResource barResource = metamodel.getElement(barJavaType, JaxrsResource.class);
+		deleteJaxrsMarkers(barResource);
+		// operation
+		new JaxrsMetamodelValidator().validate(toSet(barResource.getResource()), project, validationHelper, context,
+				validatorManager, reporter);
+		// validation
+		final IMarker[] markers = findJaxrsMarkers(barResource);
+		assertThat(markers.length, equalTo(6));
+		final Map<String, JaxrsResourceMethod> resourceMethods = barResource.getMethods();
+		for (Entry<String, JaxrsResourceMethod> entry : resourceMethods.entrySet()) {
+			final IMarker[] methodMarkers = findJaxrsMarkers(entry.getValue());
+			if (entry.getKey().contains("getContent1")) {
+				assertThat(entry.getValue().hasErrors(), is(true));
+				assertThat(methodMarkers.length, equalTo(1));
+				assertThat(methodMarkers[0].getType(), equalTo(JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE));
+				assertThat(methodMarkers[0].getAttribute(ValidationErrorManager.PREFERENCE_KEY_ATTRIBUTE_NAME, ""),
+						equalTo(JaxrsPreferences.RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER));
+			} else if (entry.getKey().contains("getContent2")) {
+				assertThat(entry.getValue().hasErrors(), is(true));
+				assertThat(methodMarkers.length, equalTo(2));
+			} else if (entry.getKey().contains("update1")) {
+				assertThat(entry.getValue().hasErrors(), is(true));
+				assertThat(methodMarkers.length, equalTo(2));
+			} else if (entry.getKey().contains("update2")) {
+				assertThat(entry.getValue().hasErrors(), is(false));
+				assertThat(methodMarkers.length, equalTo(0));
+			} else if (entry.getKey().contains("update3")) {
+				assertThat(entry.getValue().hasErrors(), is(true));
+				assertThat(methodMarkers.length, equalTo(1));
+			} else {
+				fail("Unexpected method " + entry.getKey());
+			}
+		}
+	}
+
+	@Test
+	public void shouldNotWarnIfOneApplicationExists() throws CoreException, ValidationException {
+		// preconditions
+		final List<IJaxrsApplication> applications = metamodel.getAllApplications();
+		for (IJaxrsApplication application : applications) {
+			if (application.getElementKind() == EnumElementKind.APPLICATION_WEBXML) {
+				metamodel.remove((JaxrsBaseElement) application);
+			}
+		}
+		deleteJaxrsMarkers(project);
+		// operation
+		new JaxrsMetamodelValidator().validateAll(project, validationHelper, context, validatorManager, reporter);
+		// validation
+		assertThat(project.findMarkers(JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE, false, 0).length, equalTo(0));
+	}
+
+	@Test
+	public void shouldWarnOnProjectIfNoApplicationExists() throws CoreException, ValidationException {
+		// preconditions
+		final List<IJaxrsApplication> applications = metamodel.getAllApplications();
+		for (IJaxrsApplication application : applications) {
+			metamodel.remove((JaxrsBaseElement) application);
+		}
+		deleteJaxrsMarkers(project);
+		// operation
+		new JaxrsMetamodelValidator().validateAll(project, validationHelper, context, validatorManager, reporter);
+		// validation
+		final IMarker[] projectMarkers = project.findMarkers(JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE, false, 0);
+		assertThat(projectMarkers.length, equalTo(1));
+	}
+
+	@Test
+	public void shouldWarnOnProjectIfMultipleApplicationsExist() throws CoreException, ValidationException {
+		// preconditions
+		final List<IJaxrsApplication> applications = metamodel.getAllApplications();
+		assertThat(applications, hasSize(2));
+		deleteJaxrsMarkers(project);
+		// operation
+		new JaxrsMetamodelValidator().validateAll(project, validationHelper, context, validatorManager, reporter);
+		// validation
+		final IMarker[] projectMarkers = project.findMarkers(JaxrsMetamodelValidator.JAXRS_PROBLEM_TYPE, false, 0);
+		assertThat(projectMarkers.length, equalTo(1));
+	}
 }

Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/jdt/JaxrsAnnotationScannerTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/jdt/JaxrsAnnotationScannerTestCase.java	2012-08-24 14:11:54 UTC (rev 43223)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/jdt/JaxrsAnnotationScannerTestCase.java	2012-08-24 16:20:04 UTC (rev 43224)
@@ -60,7 +60,7 @@
 		final List<IMethod> resourceMethods = JaxrsAnnotationsScanner.findResourceMethods(javaProject,new ArrayList<IJaxrsHttpMethod>(),
 				new NullProgressMonitor());
 		// verifications
-		assertThat(resourceMethods.size(), equalTo(14)); // just sub resource methods with @Path annotation
+		assertThat(resourceMethods.size(), equalTo(19)); // just sub resource methods with @Path annotation
 	}
 
 	@Test



More information about the jbosstools-commits mailing list